【51CTO精选】截止到目前,还没有传出Oracle 10g/11g在RHEL 6上认证的消息,也就是说还不建议大家在RHEL 6的生产环境中使用Oracle 10g/11g。不过最近看到有些朋友问在***发布的CentOS 6上如何安装Oracle 10g,需要做测试用,而且安装过程中出现了一些问题,所以51CTO编辑决定收集一下这方面的资源,以供参考。
理论上,CentOS 6上的操作方式应该和RHEL 6一样,软件源方面大家自己想办法解决吧,51CTO之前也收集过一些RHEL 6的yum源方面的信息,可以做个参考。
如何在RHEL 6上安装Oracle 10g R2(x86)
预备工作
RHEL 6.0的服务器
类型 | 描述 | 版本 | 文件名称 | 下载站点 |
---|---|---|---|---|
DB | Oracle 10g R2 | 10.2.0.1.0 | 10201_database_linux32.zip | oracle.com |
DB | Oracle 10g R2 Companion CD | 10.2.0.1.0 | 10201_companion_linux32.zip | oracle.com |
DB | Oracle 10g R2 patch-set | 10.2.0.4.0 | p6810189_10204_Linux-x86.zip | support.oracle.com |
TOOLS | oraToolKit | 1.0.2.1.5 | oratoolkit-1.0.2.1.5-1.noarch.rpm | sourceforge.net |
OS | Red Hat Enterprise Linux | 6.0 | rhel-server-6.0-i386-dvd.iso | redhat.com |
安装步骤:
安装Korn Shell和oraToolKit
# su - root # mount /dev/cdrom /mnt; # rpm -ivh /mnt/Server/Packages/ksh-20100621-2.el6.i686.rpm # cd /var/tmp/oracle # ls -1 oratool* oratoolkit-1.0.2.1.5-1.noarch.rpm # rpm -ivh oratoolkit-1.0.2.1.5-1.noarch.rpm
设置用户oracle的密码
# passwd oracle
检查安装包依赖性
# /opt/oracle/otk/current/bin/installManager swReqCheck osSetup10gR2.cfg
如果有缺少什么就补上,补完了再运行一次,直到没有警告了再继续下一步。
下面是从DVD补完依赖性的参考操作:
# cd /mnt/Server/Packages/ # rpm -ivh libstdc++-devel-4.4.4-13.el6.i686.rpm \ kernel-headers-2.6.32-71.el6.i686.rpm \ glibc-headers-2.12-1.7.el6.i686.rpm \ glibc-devel-2.12-1.7.el6.i686.rpm \ gnome-icon-theme-2.28.0-2.el6.noarch.rpm \ dmz-cursor-themes-0.4-4.el6.noarch.rpm \ sgml-common-0.6.3-32.el6.noarch.rpm \ libaio-devel-0.3.107-10.el6.i686.rpm \ ncurses-devel-5.7-3.20090208.el6.i686.rpm \ elfutils-libelf-devel-0.148-1.el6.i686.rpm \ compat-gcc-34-3.4.6-19.el6.i686.rpm \ libXxf86misc-1.0.2-1.el6.i686.rpm \ libXxf86vm-1.1.0-1.el6.i686.rpm \ libXt-1.0.7-1.el6.i686.rpm \ libXmu-1.0.5-1.el6.i686.rpm \ mpfr-2.4.1-6.el6.i686.rpm \ cpp-4.4.4-13.el6.i686.rpm \ xorg-x11-xauth-1.0.2-7.1.el6.i686.rpm \ compat-gcc-34-c++-3.4.6-19.el6.i686.rpm \ libdaemon-0.14-1.el6.i686.rpm \ avahi-0.6.25-8.el6.i686.rpm \ avahi-glib-0.6.25-8.el6.i686.rpm \ shared-mime-info-0.70-4.el6.i686.rpm \ libIDL-0.8.13-2.1.el6.i686.rpm \ ORBit2-2.14.17-3.1.el6.i686.rpm \ GConf2-2.28.0-6.el6.i686.rpm \ gnome-vfs2-2.24.2-6.el6.i686.rpm \ libbonobo-2.24.2-4.el6.i686.rpm \ libtool-ltdl-2.2.6-15.5.el6.i686.rpm \ unixODBC-2.2.14-11.el6.i686.rpm \ gtk2-engines-2.18.4-5.el6.i686.rpm \ libmcpp-2.7.2-4.1.el6.i686.rpm \ mcpp-2.7.2-4.1.el6.i686.rpm \ xorg-x11-server-utils-7.4-15.el6.i686.rpm \ libXv-1.0.5-1.el6.i686.rpm \ ConsoleKit-x11-0.4.1-3.el6.i686.rpm \ xorg-x11-xinit-1.0.9-13.el6.i686.rpm \ libXp-1.0.0-15.1.el6.i686.rpm \ libXxf86dga-1.1.1-1.el6.i686.rpm \ libdmx-1.1.0-1.el6.i686.rpm \ xorg-x11-utils-7.4-8.el6.i686.rpm \ compat-db43-4.3.29-15.el6.i686.rpm \ compat-db42-4.2.52-15.el6.i686.rpm \ ppl-0.10.2-11.el6.i686.rpm \ cloog-ppl-0.15.7-1.2.el6.i686.rpm \ gcc-4.4.4-13.el6.i686.rpm \ gcc-c++-4.4.4-13.el6.i686.rpm \ compat-libstdc++-33-3.2.3-69.el6.i686.rpm \ compat-db-4.6.21-15.el6.i686.rpm \ gnome-themes-2.28.1-6.el6.noarch.rpm \ system-icon-theme-6.0.0-2.el6.noarch.rpm \ system-gnome-theme-60.0.2-1.el6.noarch.rpm \ unixODBC-devel-2.2.14-11.el6.i686.rpm \ readline-devel-6.0-3.el6.i686.rpm \ libgnome-2.28.0-11.el6.i686.rpm # cd /; umount /mnt; eject # /opt/oracle/otk/current/bin/installManager swReqCheck osSetup10gR2.cfg
如果要使用增强的sql*plus……
# cd /opt/oracle/otk/current/tools/rlwrap/ # ./configure # make # make install # /usr/local/bin/rlwrap -v
执行installManager的osSetup
这一步用来设置内核参数、创建路径、文件所有者和其他一些参数设置。如果想进行默认安装那就啥都别动。
# cd /opt/oracle/otk/current/conf/installManager/ # vi osSetup10gR2.cfg # sdiff -s osSetup10gR2.cfg sample/osSetup10gR2.cfg # /opt/oracle/otk/current/bin/installManager osSetup osSetup10gR2.cfg
将Oracle软件移入软件源
Oracle软件就是上面你下载下来的那个。
# cd /var/tmp/oracle # chown oracle:oinstall * # mv 10201_database_linux32.zip 10201_companion_linux32.zip p6810189_10204_Linux-x86.zip /var/opt/oracle/repository/
以oracle身份登录,对PS1变量进行设置
# su - oracle ------------------------------------------------------ oraToolKit 1.0 environment variables ------------------------------------------------------ Installation directory : /opt/oracle/otk Release : 1.0.2.1.5 $RUN directory : /opt/oracle/otk/1.0/bin $LOG_BASE directory : /var/opt/oracle/otk/1.0/log ------------------------------------------------------ <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ grep ^SITE .profile.custom.interactive SITE="<SITE|COMPANY>" <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ vi .profile.custom.interactive <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ grep ^SITE .profile.custom.interactive SITE="Quist-LU" <SITE|COMPANY>:oracle@stquist1p:sidNotSet$ exit # su - oracle Quist-LU:oracle@stquist1p:sidNotSet$
安装Oracle软件
不要用OUI安装,否则你要坐在电脑前面点鼠标。使用swlnst让它自动运行吧。
$ bash $ cd $INSTALL_CONF $ cp sample/swInstEeSrv10gR2-Step[123]-linux-x86.cfg . $ installManager swInst swInstEeSrv10gR2-Step1-linux-x86.cfg $ su - # /opt/oracle/eesrv/10.2.0/db1/root.sh # exit $ installManager swInst swInstEeSrv10gR2-Step2-linux-x86.cfg $ installManager swInst swInstEeSrv10gR2-Step3-linux-x86.cfg $ su - # /opt/oracle/eesrv/10.2.0/db1/root.sh # exit
创建数据库
使用installManager里面的dbSetup来创建数据库。注意路径。执行命令之前,ORACLE_HOME记得先定义了。
$ cd $INSTALL_CONF $ ls -1 dbSetup*.cfg dbSetup-dev.cfg dbSetup-prod.cfg dbSetup-test.cfg $ vi dbSetup-prod.cfg $ sdiff -s dbSetup-prod.cfg sample/dbSetup-prod.cfg ORACLE_HOME=/opt/oracle/eesrv/10.2.0/db1 | ORACLE_HOME=/opt/oracle/sesrv/11.1.0/db1 $ installManager dbSetup dbSetup-prod.cfg
连接到数据库
Oracle数据库到此已经安装完毕,用EZCONNECT或TNS尝试连接一下:
$ bash $ sourceProdEnv $ sqlplus otk/otk@//$ORACLE_HOSTNAME:1531/PROD $ sqlplus otk/otk@PROD
如果你打算在生产环境下使用,那么请继续看下面几个步骤:
用appctl管理Oracle
$ ctl status all $ ctl stop all $ ctl start all
设置数据库备份
backupManager的Rman备份
记得要检查好参数后再执行备份:
$ cd $BACKUP_CONF $ vi prod.cfg $ sdiff -s prod.cfg sample/prod.cfg DISK_DEVICE_MOUNT_POINT="/" | DISK_DEVICE_MOUNT_POINT="/backup01" $ backupManager full prod.cfg
设置cron让它按时备份
手动备份成功后就可以设置夜间自动备份了:
$ crontab -l|head -2 # Example 1: Daily physical database backup # 0 2 * * * [ -d $HOME/../current ] && (ksh -c '. ./.profile >/dev/null; backupManager full <sid_1>.cfg <sid_2>.cfg <sid_n>.cfg >/dev/null') $ crontab -e $ crontab -l|head -2 # Example 1: Daily physical database backup 0 2 * * * [ -d $HOME/../current ] && (ksh -c '. ./.profile >/dev/null; backupManager full prod.cfg >/dev/null')
到此结束。
【编辑推荐】