这几天在虚拟机上练习安装Solaris10,体验了一下Solaris的非凡。简单记录下相关操作的步骤:
1.安装oracle部分。
1.solaris10 上安装oracle10比较简单些,先修改一下内存参数
用root用户修改 vi /etc/system
(G 去到最后一行 按ESC a插入以下代码)
set noexec_user_stack=1
set semsys:seminfo_semmni=100
set semsys:seminfo_semmns=1024
set semsys:seminfo_semmsl=256
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
2。修改oracle用户的.profile 环境变量文件。
-bash-3.00$ pwd
/u01/oracle
-bash-3.00$ vi .profile
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/app/10.2.0
export ORACLE_SID=tones
export PATH=$ORACLE_HOME/bin:/usr/local/bin:$PATH
export DISPLAY=192.168.1.109:0.0
export NLS_LANG="simplified chinese_china.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:Mi:SS"
stty erase ^H
alias sqlplus='rlwrap sqlplus' --最后安装rlwrap后增加
alias rman='rlwrap rman' --最后安装rlwrap后增加
3.ftp上传oracle10g到solaris系统里,就可以安装了,
上传虚拟机时,网络经常会断开。使用FileZilla FTP软件限速600k左右上传,基本就能传完了,即使断开重新启动虚拟器后,也可以续传。
4.安装oracle10g, 这步很简单,就不说了。
5..安装oracle完成后,安装rlwrap时,提示错误,应该是gcc包没有安装到。
root:/opt/solaris/rlwrap-0.24#./configure
configure:1835: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
2. 安装 gcc,rlwrap包部分
1.下载gcc相关的包,解压并安装
root:/opt/solaris/rlwrap-0.24#gunzip gcc-3.4.6-sol10-x86-local.gz
root:/opt/solaris/rlwrap-0.24#gunzip lib*
root:/opt/solaris/rlwrap-0.24#pkgadd -d gcc-3.4.6-sol10-x86-local
root:/opt/solaris/rlwrap-0.24#pkgadd -d libgcc-3.4.6-sol10-x86-local
root:/opt/solaris/rlwrap-0.24#pkgadd -d libiconv-1.11-sol10-x86-local
root:/opt/solaris/rlwrap-0.24#pkgadd -d libintl-3.4.0-sol10-x86-local
root:/opt/solaris/rlwrap-0.24#ls /cdrom/sol_10_1009_x86/Solaris_10/Product/
root:/opt/solaris/rlwrap-0.24#pkadd -d /cdrom/sol_10_1009_x86/Solaris_10/Product/ SUNWwgetr
root:/opt/solaris/rlwrap-0.24#pkgadd -d /cdrom/sol_10_1009_x86/Solaris_10/Product/ SUNWwgetr
root:/opt/solaris/rlwrap-0.24#pkgadd -d /cdrom/sol_10_1009_x86/Solaris_10/Product/ SUNWwgetu
root:/opt/solaris/rlwrap-0.24#pkgadd -d /cdrom/sol_10_1009_x86/Solaris_10/Product/ SUNWwgetS
root:/opt/solaris/rlwrap-0.24#pkgadd -d /cdrom/sol_10_1009_x86/Solaris_10/Product/ SUNWgcmn
2.修改root的 .profile文件。并重新启动服务器
在 .profile文件中增加如下内容
export LD_LIBRAEY_PATH=/usr/local/lib:.
export CC=gcc
3.开始再次安装。有了新的提示,需要安装readline包
root:/opt/solaris/rlwrap-0.24#./configure
checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
....................
checking for tgetent... no
checking for tgetent in -lcurses... yes
checking for readline in -lreadline... no
configure: error:
You need the GNU readline library( ftp://ftp.gnu.org/gnu/readline/ ) to build --提示需要先安装readline包
this program!
4.安装readline包
root:/opt/solaris/rlwrap-0.24#cd ..
root:/opt/solaris#gunzip readline-5.2.tar.gz
root:/opt/solaris#tar xvf readline-5.2.tar
root:/opt/solaris#cd readline-5.2
root:/opt/solaris/readline-5.2#./configure --配置完成
checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
..........
checking configuration for building shared libraries... supported
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating examples/Makefile
config.status: creating shlib/Makefile
config.status: creating config.h
config.status: executing default commands
root:/opt/solaris/readline-5.2#gmake && gmake install --安装完成
5.重新安装rlwrap 包
root:/opt/solaris/readline-5.2#cd ..
root:/opt/solaris#cd rlwrap-0.24
root:/opt/solaris/rlwrap-0.24#./configure
checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
checking for a BSD-compatible install... tools/install-sh -c
checking whether build environment is sane... yes
checking for gawk... no
................
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: creating doc/rlwrap.man
config.status: creating distribution/rlwrap.spec
config.status: creating config.h
config.status: executing depfiles commands
Now do:
make (or gmake) to build rlwrap
make check for instructions how to test it
make install to install it
root:/opt/solaris/rlwrap-0.24#make && make install 安装完成
6.修改oracle的profile文件
-bash-3.00$ vi .profile
".profile" 10 ÐУ¬351 ×Ö・û
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/app/10.2.0
export ORACLE_SID=tones
export PATH=$ORACLE_HOME/bin:/usr/local/bin:$PATH --路径中加入红色部分
export DISPLAY=192.168.1.109:0.0
export NLS_LANG="simplified chinese_china.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:Mi:SS"
stty erase ^H
alias sqlplus='rlwrap sqlplus' 加入别名映射
alias rman='rlwrap rman'
~
7.开始登陆sqlplus .提示错误
-bash-3.00$ sqlplus / as sysdba
ld.so.1: rlwrap: 致命的: libreadline.so.5: 打开失败:无此文件或者目录
-bash-3.00$ rman
ld.so.1: rlwrap: 致命的: libreadline.so.5: 打开失败:无此文件或者目录
8.拷贝需要的文件。
root:/opt/solaris/rlwrap-0.24#cp /usr/local/lib/libreadline* /lib
root:/opt/solaris/rlwrap-0.24#cp /usr/local/lib/libreadline* /usr/lib
root:/opt/solaris/rlwrap-0.24#su oracle
oracle:/opt/solaris/rlwrap-0.24#rlwrap sqlplus
ld.so.1: rlwrap: 致命的: libgcc_s.so.1: 打开失败:无此文件或者目录 --发现提示的文件名变了。
root:/opt/solaris/rlwrap-0.24#cp /usr/local/lib/libgcc_s.so* /usr/lib
root:/opt/solaris/rlwrap-0.24#id
uid=0(root) gid=0(root)
root:/opt/solaris/rlwrap-0.24#su - oracle
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
You have new mail.
9.登陆正常了。
-bash-3.00$ id
uid=103(oracle) gid=101(oinstall)
-bash-3.00$ pwd
/u01/oracle
-bash-3.00$ rlwrap sqlplus
SQL*Plus: Release 10.2.0.2.0 - Production on 星期六 31 19:15:18 2010
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
至此回显操作正常完成。
3:solaris编辑crontab自动任务部分:
root:/#cd /usr/spool/cron/crontabs/
root:/usr/spool/cron/crontabs#ls -l
总数 12
-rw------- 1 root sys 190 2009 9月 4 adm
-r-------- 1 root root 452 2009 9月 4 lp
-rwxrwxrwx 1 oracle oinstall 44 7月 31日 11:47 oracle
-rw------- 1 root sys 482 7月 29日 19:21 root
-rw------- 1 root sys 308 2009 9月 4 sys
-r-------- 1 root sys 404 7月 29日 19:19 uucp
--查看用户定义的crontab 任务。
root:/#crontab -l oracle
59 11 * * * /orabk/scripts/rman_backup_0.sh
Solaris直接修改好像是有问题,按e参数后,弹出个44的数字来。
-bash-3.00$ crontab -e
44
^C
?
-bash-3.00$
如果想要修改crontab,一般做以下的几步就可以了
(参考: http://www.chinaunix.net/jh/6/271992.html)
1.将crontab 推到一个自定义的文件上
-bash-3.00$ crontab -l >aaa
-bash-3.00$ ls
aaa app install oradata
admin archive oraInventory
2.编辑这个文件,做需要的修改
-bash-3.00$ vi aaa
"aaa" 1行,¬44个字符
33 08 * * * /orabk/scripts/rman_backup_0.sh --修改为8:33分
~
"aaa" 1行,¬44个字符
3.推回crontab
-bash-3.00$ crontab aaa
-bash-3.00$ crontab -l
33 08 * * * /orabk/scripts/rman_backup_0.sh
-bash-3.00$ date
2010年08月01日 星期日 08时32分57秒 CST
-bash-3.00$ date
2010年08月01日 星期日 08时33分05秒 CST
--到8:33分后,查看进程,可以看到rman的进程在工作了。
-bash-3.00$ ps -ef | grep rman
oracle 1389 1386 7 08:33:01 ? 0:02 rman target / log=/orabk/logs/20100801.log append cmdfile=/orabk/scripts/rman_b
oracle 1386 1385 0 08:33:01 ? 0:00 /bin/bash /orabk/scripts/rman_backup_0.sh
oracle 1385 286 1 08:33:01 ? 0:00 sh -c /orabk/scripts/rman_backup_0.sh
oracle 1401 1355 0 08:33:08 pts/5 0:00 grep rman
查看日志文件,已经生成了20100801.log 的日志文件了,表示oracle的crontab任务设置生效了。
-bash-3.00$ ls /orabk/logs
20100801.log
-bash-3.00$