Oracle9i RAC for RedFlag Linux DC4.1 32bit 安装流程
borlung
|
1#
borlung 发表于 2006-10-31 15:12
Oracle9i RAC for RedFlag Linux DC4.1 32bit 安装流程
Oracle9i RAC for RedFlag Linux DC4.1 32bit 安装流程
一、红旗DC4.1安装 分区情况: 挂接点 空间(M) /boot 500 LVM /opt 20000 /usr 5000 /var 5000 /home 10000 swap 2000 / 27000 二、系统前期准备 1.系统基本情况说明 两台DELL 6850,内存4GB,本地盘73GB(RAID之后) 操作系统红旗linux DC4.1 ## 操作系统安装(1#、2#盘),补丁安装(3#、6#盘) 2.安装红旗linux for oracle软件支持包 在红旗linux安装盘Disk1/Asianux/RPMS下,安装名称为oracle9i_support-1.0-2AX.i386.rpm的系统包 # rpm –ivh oracle9i_support-1.0-2AX.i386.rpm 3. 网络设置 一号机public:192.168.0.100 Oracle1 private:192.168.1.100 Oracle1P 二号机public:192.168.0.101 Oracle2 private:192.168.1.101 Oracle1P 编辑/etc/hosts文件,加入以下行,使机器名能够被正确解析 192.168.0.100 Oracle1 192.168.0.101 Oracle2 192.168.1.100 Oracle1P 192.168.1.101 Oracle2P 4.配置ftp服务 打开proftpd服务 # service proftpd restart 5.配置rsh和rlogin,使oracle用户能够两边机器使用rsh和rcp命令 编辑/etc/hosts.equiv,写入双方公用和私用网络名 Oracle1 Oracle2 Oracle1P Oracle2P 编辑/root/.rhosts,写入双方公用和私用网络名 Oracle1 Oracle2 Oracle1P Oracle2P 编辑/etc/xinetd.d/目录下rsh、rlogin、rexec三个文件,将其中的disable=yes修改成为disable=no 编辑/etc/pam.d/rsh,屏蔽{ auth required pam_rhosts_auth.so }这一行(在这一行前加#号) 编辑/etc/securetty,加入以下三行 rexec rsh rlogin 将/usr/kerberos/bin目录下的rcp、rsh、rlogin更名 # mv /usr/kerberos/bin/rcp /usr/kerberos/bin/rcp.bak # mv /usr/kerberos/bin/rsh /usr/kerberos/bin/rsh.bak # mv /usr/kerberos/bin/rlogin /usr/kerberos/bin/rlogin.bak 重启xinetd服务 # service xinetd restart 测试root用户以及oracle用户是否能够进行rcp 保证两台机器4个IP之间都能使用rcp进行远程拷贝 (在Oracle1、OAOrcle2上进行以下测试) # rlogin Oracle1 # rlogin Oracle1P # rcp –r Oracle1:/tmp /tmp 6.使用 #fdisk –l 命令确认两台机器都能看到共享盘阵,其中/dev/sdb2划分给本次实施用 盘阵的划分为: 设备名 空间(M) /dev/sdb1 5000 /dev/sdb2 300000 /dev/sdb3 600000 /dev/sdb4 5000 三、数据库前期准备 1.创建oracle用户、dba组、oninstall组 保证两台机器上oracle用户ID和dba组ID完全一致。主目录选择为/home/oracle,shell类型选择bash。 # groupadd –g 500 dba(cat /etc/group) # groupadd –g 501 oinstall(cat /etc/group) # useradd –g dba –G oinstall –u 500 –d /home/oracle oracle(cat /etc/passwd) # passwd oracle 创建/var/opt/oracle目录并修改属主。 # mkdir /var/opt/oracle # chown oracle.dba /var/opt/oracle 2.修改oracle用户配置文件/home/oracle/.bash_profile,内容如下 export ORACLE_BASE=/opt/oracle export ORACLE_HOME=$ORACLE_BASE/product/9.2.0 export PATH=$PATH:$ORACLE_HOME/oracm/bin:/bin:/sbin:/usr/bin:/usr/sbin:$ORACLE_HOME/bin:/usr/ccs/bin:/usr/bin/X11/:/usr/local/bin export DISPLAY=127.0.0.1:0.0 export ORACLE_SID=zgdb2 export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib 3.修改核心参数配置文件,在/etc/sysctl.conf中添加如下行 net.core.rmem_default = 262144 net.core.rmem_max = 262144 net.core.wmem_default = 262144 net.core.rmem_max = 262144 net.ipv4.tcp_sack=0 net.ipv4.tcp_timestamps=0 fs.file-max = 65536 kernel.sem = 500 64000 100 128 kernel.shmmax = 2147483648(4294967296) 四、安装OCFS和OCM 1.安装OCFS软件 A、使用ocfstool工具配置 # ocfstool 选择Tasks中的Generate Config菜单: 修改Interface中的网络接口为oracle RAC的内网接口eth1,NodeName为:Oracle1然后按OK确定,退出ocfstool。查看/etc/ocfs.conf文件配置是否正确,如果要重新配置则需删除/etc/ocfs.conf B、加载ocfs模块 # load_ocfs C、创建ocfs分区 # mkdir /data # mkfs –t ocfs -b 128 -g 500 -L data -m /data -p 0755 -u 500 /dev/sdb2 –F # chown –R oracle:dba /data E、编辑/etc/rc.local文件,加入如下行(该步骤是由于发现系统重启时未能自动加载ocfs模块和mount ocfs文件系统添加) /sbin/load_ocfs sleep 2 /bin/mount -t ocfs -o _netdev /dev/sdb2 /data 2. 安装OCM软件 A、创建quorum.dbf和srvm.dbf # dd if=/dev/zero of=/data/quorum.dbf bs=1M count=20 # dd if=/dev/zero of=/data/srvm.dbf bs=1M count=100 # chown root:dba /data/quorum.dbf # chmod 664 /data/quorum.dbf # chown oracle:dba /data/srvm.dbf # chmod 664 /data/srvm.dbf B、运行ORACLE安装光盘上的runInstaller,选择安装目录,安装OCM 9.2.0.4 输入集群控制文件/data/quorum.dbf和两台机器publi、private网卡的名称。 C、配置hangcheck模块 确认系统是否已经安装该模块 # find -name "hangcheck-timer.o" /lib/modules/2.4.21-20.19AXsmp/kernel/drivers/char/hangcheck-timer.o 加载该模块 # cd /lib/modules/2.4.21-20.19AXsmp/kernel/drivers/char # /sbin/insmod hangcheck-timer hangcheck_tick=30 hangcheck_margin=180 查看模块是否添加成功(hangchec-ktimer) # /sbin/lsmod 编辑/etc/modules.conf添加 options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" 添加/etc/rc.local文件中以下行 /sbin/modprobe hangcheck-timer G、修改OCM配置 修改$ORACLE_HOME/oracm/admin/cmcfg.ora 添加一行KernelModuleName=hangcheck-timer 修改MissCount=210 修改两台机器的 HostName=data1(一号机) HostName=data2(二号机) 修改$ORACLE_HOME/oracm/bin/ocmstart.sh,在文件头添加如下行 ORACLE_HOME=/opt/oracle/product/9.2.0 OCMS_HOME=/opt/oracle/product/9.2.0 export ORACLE_HOME export OCMS_HOME H、启动OCM # /opt/oracle/product/9.2.0/oracm/bin/ocmstart.sh I、将OCM启动加到开机自动启动脚本。编辑/etc/rc.local,添加 ORACLE_HOME=/opt/oracle/product/9.2.0 rm -rf $ORACLE_HOME/oracm/log/* $ORACLE_HOME/oracm/bin/ocmstart.sh 五、安装RDBMS 1.运行ORACLE安装光盘,安装oracle9.2.0.4 $ /mnt/cdrom/runInstaller 按照提示安装即可 2.监听配置使用默认配置即可 六、创建数据库(采用脚本建库) 一号机: 1、创建Oracle所需的目录,以及sys用户密码 # su - oracle $ mkdir /opt/oracle/admin/data/bdump $ mkdir /opt/oracle/admin/data/cdump $ mkdir /opt/oracle/admin/data/create $ mkdir /opt/oracle/admin/data/pfile $ mkdir /opt/oracle/admin/data/udump $ export ORACLE_SID=data1 $ echo Add this entry in the oratab $ echo "rkxt:/opt/oracle/product/9.2.0:Y" >>/etc/oratab $ orapwd file=/opt/oracle/product/9.2.0/dbs/orapwdata1 password=change_on_install 2、CreateDB connect SYS/change_on_install as SYSDBA set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/CreateDB.log startup nomount pfile="/opt/oracle/admin/data/scripts/init.ora"; CREATE DATABASE rkxt CONTROLFILE REUSE MAXINSTANCES 32 MAXLOGHISTORY 0 MAXLOGFILES 192 MAXLOGMEMBERS 3 MAXDATAFILES 1024 DATAFILE '/data/system' SIZE 2047M REUSE EXTENT MANAGEMENT LOCAL DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/data/temp1' SIZE 2047M REUSE, '/data/temp2' SIZE 2047M REUSE UNDO TABLESPACE "UNDOTBS1" DATAFILE '/data/undo1' SIZE 2047M REUSE CHARACTER SET UTF8 NATIONAL CHARACTER SET AL16UTF16 LOGFILE GROUP 1 ('/data/redo11a','/data/redo11b') SIZE 127M REUSE, GROUP 2 ('/data/redo12a','/data/redo12b') SIZE 127M REUSE, GROUP 3 ('/data/redo13a','/data/redo13b') SIZE 127M REUSE; spool off 3、DB1 CREATE UNDO TABLESPACE "UNDOTBS2" DATAFILE '/data/undo2' SIZE 2047M REUSE; ALTER DATABASE ADD LOGFILE THREAD 2 ('/data/redo21a','/data/redo21b') SIZE 127M REUSE; ALTER DATABASE ADD LOGFILE THREAD 2 ( '/data/redo22a','/data/redo22b') SIZE 127M REUSE; ALTER DATABASE ADD LOGFILE THREAD 2 ( '/data/redo23a','/data/redo23b') SIZE 127M REUSE; 4、CreateDBFiles connect SYS/change_on_install as SYSDBA set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/CreateDBFiles.log CREATE TABLESPACE "INDX" LOGGING DATAFILE '/data/indx' SIZE 1023M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ; CREATE TABLESPACE "TOOLS" LOGGING DATAFILE '/data/tools' SIZE 1023M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ; CREATE TABLESPACE "USERS" LOGGING DATAFILE '/data/user' SIZE 1023M REUSE EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ; spool off 5、CreateDBCatalog connect SYS/change_on_install as SYSDBA set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/CreateDBCatalog.log @/opt/opt/oracle/product/9.2.0/rdbms/admin/catalog.sql; @/opt/opt/oracle/product/9.2.0/rdbms/admin/catexp7.sql; @/opt/opt/oracle/product/9.2.0/rdbms/admin/catblock.sql; @/opt/opt/oracle/product/9.2.0/rdbms/admin/catproc.sql; @/opt/opt/oracle/product/9.2.0/rdbms/admin/catoctk.sql; @/opt/opt/oracle/product/9.2.0/rdbms/admin/owminst.plb; connect SYSTEM/manager @/opt/opt/oracle/product/9.2.0/sqlplus/admin/pupbld.sql; connect SYSTEM/manager set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/sqlPlusHelp.log @/opt/opt/oracle/product/9.2.0/sqlplus/admin/help/hlpbld.sql helpus.sql; spool off spool off 6、CreateClustDBViews connect SYS/change_on_install as SYSDBA set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/CreateClustDBViews.log @/opt/opt/oracle/product/9.2.0/rdbms/admin/catclust.sql; spool off 7、postDBCreation connect SYS/change_on_install as SYSDBA set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/postDBCreation.log @/opt/opt/oracle/product/9.2.0/rdbms/admin/utlrp.sql; ALTER DATABASE DATAFILE '/data/indx' AUTOEXTEND OFF; ALTER DATABASE DATAFILE '/data/system' AUTOEXTEND OFF; ALTER DATABASE DATAFILE '/data/tools' AUTOEXTEND OFF; ALTER DATABASE DATAFILE '/data/undo1' AUTOEXTEND OFF; ALTER DATABASE DATAFILE '/data/undo2' AUTOEXTEND OFF; ALTER DATABASE DATAFILE '/data/user' AUTOEXTEND OFF; ALTER DATABASE TEMPFILE '/data/temp1' AUTOEXTEND OFF; ALTER DATABASE TEMPFILE '/data/temp2' AUTOEXTEND OFF; shutdown ; connect SYS/change_on_install as SYSDBA set echo on spool /opt/opt/oracle/product/9.2.0/assistants/dbca/logs/postDBCreation.log create spfile='/data/spfile' FROM pfile='/opt/oracle/admin/data/scripts/init.ora'; startup pfile="/opt/oracle/admin/data/scripts/init.ora"; ALTER DATABASE ENABLE PUBLIC THREAD 2; spool off cp init.ora /opt/oracle/product/9.2.0/dbs/initdata1.ora shutdown ; 二号机: $ mkdir /opt/oracle/admin/data/bdump $ mkdir /opt/oracle/admin/data/cdump $ mkdir /opt/oracle/admin/data/create $ mkdir /opt/oracle/admin/data/pfile $ mkdir /opt/oracle/admin/data/udump $ export ORACLE_SID=data2 $ echo Add this entry in the oratab $ echo "rkxt:/opt/oracle/product/9.2.0:Y" >>/etc/oratab $ orapwd file=/opt/oracle/product/9.2.0/dbs/orapwdata1 password=change_on_install $ cp init.ora /opt/oracle/product/9.2.0/dbs/initdata1.ora 后期工作 1.客户端配置 编辑$ORACLE_HOME/network/admin/tnsnames.ora文件,添加内容如下 data = (DESCRIPTION = (load_balance=yes) (failover=on) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.100)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.101)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = data) (failover_mode= (type=select) (method=basic) ) ) ) 使用命令sqlplus “用户名/密码@data” 即可连接并行数据库,并且能够实现负载均衡和失败切换。 2.数据文件创建的注意事项 数据文件都要放置在/data目录下。单个数据文件大小不要超过2GB。由于使用ocfs文件系统,数据文件名称可随意定义。 3.sys用户和system用户密码的修改 $ sqlplus /nolog SQL> conn / as sysdba SQL> alter user sys identified by newpassword; SQL> alter user system identified by newpassword; 4.等VERITAS备份软件正常上线时再打开数据库归档模式。 附录一 数据库ZGDB基本情况说明 项目 实际数值 数据库名称 Oracle 数据库软件版本 9.2.0.4 数据库版本 9.2.0.4 归档模式 非归档 自动归档模式 非自动归档 数据文件存放目录 /data 字符集 ZHS16GBK sys用户密码 change_on_install system用户密码 Manager 附录二 数据库启动停止脚本(脚本存放路径:/sbin) 一号机: 启动脚本 ## filename : /sbin/oastart.sh su - oracle << EOF export ORACLE_SID=data1 lsnrctl start sqlulus /nolog coon / as sysdba; startup exit << EOF 停止脚本 ## filename : /sbin/oastop.sh su - oracle << EOF export ORACLE_SID=data1 sqlplus /nolog conn / as sysdba; shutdown immediate\ exit lsnrctl stop << EOF 二号机: 启动脚本 ## filename : /sbin/oastart.sh su - oracle << EOF export ORACLE_SID=data2 lsnrctl start splulus /nolog conn / as sysdba; startup exit << EOF 停止脚本 ## filename : /sbin/oastop.sh su - oracle << EOF export ORACLE_SID=data2 sqlplus /nolog conn / as sysdba; shutdown immediate\ exit lsnrctl stop << EOF 为保障数据库系统正常允许,建议采用人工方式启动或停止数据库。 |