分类: Oracle
2008-03-11 12:41:37
前几天客户要求在GS80上安装oracle,要求是10g RAC的,但是该主机上的操作系统是tru64 51A的版本,无法安装oracle 10g,只好退而求其次,改为oracle 9i RAC的。
网上关于在truCluster上安装oracle RAC的资料不是很多,找到一个官方的E文安装文档,整理了一下,共享给大家。
本次施工也是基于此方案,基本没什么问题。
一、基本信息:
操作系统平台:tru64 5.1A
集群软件:TruCluster 51
硬件平台:GS80×2,MA8000×1
数据库版本:oracle 9.2.0.1
数据库补丁:oracle 9.2.0.8
运行方式:RAC
二、Oracle安装步骤:
1、解压oracle压缩包
gunzip Tru64_9201_Disk1.cpio.gz
gunzip Tru64_9201_Disk2.cpio.gz
gunzip Tru64_9201_Disk3.cpio.gz
gunzip Tru64_9201_Disk4.cpio.gz
cpio -idcmv < Tru64_9201_Disk1.cpio
cpio -idcmv < Tru64_9201_Disk2.cpio
cpio -idcmv < Tru64_9201_Disk3.cpio
cpio -idcmv < Tru64_9201_Disk4.cpio
可以得到四个目录(Disk1, Disk2, Disk3 and Disk4)
注意:可能你所下载到的安装包不一定是这样的,但大体上应该差不多。
2、设置操作系统内核参数(/etc/sysconfigtab):
NEW_WIRE_METHOD 0
VM_SWAP_EAGER 0
UBC_MAX_PERCENT 70+
UBC_BORROW_PERCENT 20
VM_UBCSEQPERCENT 10
VM_UBCSEQPERCENT 10
VM_UBCSEQSTARTPERCENT 50
VM_UBCDIRTYPERCENT 10
MAX_PER_PROC_STACK_SIZE 536870912
PER_PROC_STACK_SIZE 33554432
MAX_PER_PROC_DATA_SIZE 4294967296
PER_PROC_DATA_SIZE 201326592
MAX_PER_PROC_ADDRESS_SIZE 0x40000000000
PER_PROC_ADDRESS_SIZE 0x40000000000
MAX_PROC_PER_USER 1024
MAX_THREADS_PER_USER 4096
MAXUSERS 4096
AIO_TASK_MAX_NUM 1040
SSM_THRESHHOLD 0
SHM_MAX 4278190080
SHM_MIN 1
SHM_MNI 256
SHM_SEG 128
UDP_SENDSPACE 65536
UDP_RECVSPACE 65536
MAX_OBJS 8096
MSG_SIZE 32768
MAX_ASYNC_REQ 2048
MAX_ASYNC_REQ 2048
MAX_SESSIONS 2048
RDG_MAX_AUTO_MSG_WIRES 0
AdvfsSyncMmapPages 0
fifo_do_adaptive 0
查看当前参数命令
/sbin/sysconfig -q ipc
/sbin/sysconfig -q proc
下面是主要的几个参数:
vm:
new_wire_method = 0
vm_swap_eager = 0
ipc:
ssm_threshold = 0
shm_max = 4278190080
shm_min = 1024
shm_mni = 1024
shm_seg = 256
inet:
udp_sendspace = 65536
udp_recvspace = 65536
proc:
max_per_proc_stack_size = 33554432
per_proc_stack_size = 33554432
per_proc_data_size = 268435456
max_per_proc_data_size = 4294967296
max_per_proc_address_space = 10737418240
max_proc_per_user = 1024
max_threads_per_user = 4096
maxusers = 4096
rdg:
max_objs = 8096
msg_size = 32768
max_async_req = 2048
max_sessions = 2048
rdg_max_auto_msg_wires = 0
rt:
aio_task_max_num = 1040
rm:
rm_check_for_ipl = 0
advfs:
AdvfsSyncMmapPages = 0
vfs:
fifo_do_adaptive = 0
修改后需要重启主机。
3、添加oracle安装用户组,管理组,安装用户,管理用户。
Addgroup oinstall
Addgroup dba
Adduser oracle
对于主目录的选择视情况而定。
Oacle用户归属于oisntall组和dba组,只需要在一个节点做。
Oracle用户的.profile类似如下设置:
ORACLE_BASE=/oracle/app; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/9.2.0.8; export ORACLE_HOME
PATH=.PATH:/usr/sbin:/usr/ccs/bin:/usr/bin:/usr/bin/X11:/usr/local/bin
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:/usr/opt/java131:/usr/opt/java131/bin; export PATH
member=`clu_get_info|grep "this member"|awk '{print $6}'`; export member
ORACLE_SID=orcl$member; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JREORACLE_HOME/jlibORACLE_HOME/rdbms/jlib; export CLASSPATH
SRVM_SHARED_CONFIG=/u01/orcl_configuration; export SRVM_SHARED_CONFIG
#(注意SRVM_SHARED_CONFIG的文件名,创建实例是很重要)
DISPLAY=localhost:0.0; export DISPLAY
stty erase "^H"
创建oracle所需的目录,比如oracle数据文件、归档目录等。
touch /oracle/orcl_configuration
4、安装软件
A、运行runInstaller,按照提示步骤进行,注意选择节点时只选择默认节点,以免安装冲突。(切记)
B、运行oracle补丁包,最好在实例创建前做。
5、创建CDSL
这么做主要是为了两边主机上的实例使用不同的网络和日志,
mkcdsl -ac /oracle/app/product/9.2.0.8/network/admin
mkcdsl -ac / oracle /app/oracle/product/9.2.0.8/network/agent
mkcdsl -ac / oracle /app/oracle/product/9.2.0.8/network/log
mkcdsl -ac / oracle /app/oracle/product/9.2.0.8/Apache/Apache/conf
删除CDSL的方法:
rm /oracle/app/product/9.2.0.8/Apache/Apache/conf
mkcdsl -i /oracle/app/product/9.2.0.8/Apache/Apache/conf
6、创建listener.ora、tnsnames.ora文件,使用netca工具去做,注意:每个节点都要做,tnsnames.ora两边节点要一致。
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb1)(PORT = 1521))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/app/product/9.2.0.8)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = orcl1)
(ORACLE_HOME = /oracle/app/product/9.2.0.8)
)
)
Each node should have a copy of the tnsnames.ora file like:
LISTENER_orcl1 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb1)(PORT = 1521))
)
LISTENER_orcl2 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb2)(PORT = 1521))
)
orcl1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb1)(PORT = 1521))
)
(CONNECT_DATA =
(ORACLE_SID = orcl1)
)
)
orcl2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb2)(PORT = 1521))
)
(CONNECT_DATA =
(ORACLE_SID = orcl2)
)
)
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = xjsb2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
7、允许gsd进程和listener
$ORACLE_HOME/bin/gsdctl start
$ORACLE_HOME/bin/lsnrctl start
三、创建数据库
1、 运行dbca工具,按照步骤执行。
2、 如果是第一次安装需要运行srvconfig –init创建cluster configuration文件。
3、 将两个实例添加到cluster configuration文件
srvctl add database -d orcl -o /oracle/app/product/9.2.0.8
srvctl add instance -d orcl -i orcl1 -n xjsb1
srvctl add instance -d orcl -i orcl2 -n xjsb2
注:相关的一些命令:
# remove instance from cluster
srvctl remove instance -d orcl -i orcl2
# Start and stop cluster
srvctl start database -d orcl
srvctl stop database -d orcl
# Start and stop individual instance
srvctl start instance -d orcl -i orcl1
srvctl stop instance -d orcl -i orcl1
# Get status of whole database or specific instance
srvctl status database -d orcl
srvctl status instance -d orcl -i orcl1
# Get current database config
srvctl config database -d EDSP
四、安装后任务
1、创建/sbin/init.d/oracle 文件,并编辑:
#!/bin/sh
#
# change the value of ORACLE_HOME to be correct for your
# installation
ORACLE_HOME=/oracle/app/product/9.2.0.8
PATH=${PATH}ORACLE_HOME/bin:/usr/sbin
HOST=`hostname`
#
# change the value of ORACLE to the login name of the
# oracle owner at your site
#
ORACLE=oracle
export ORACLE_HOME PATH
#
if [ ! "$2" = "ORA_DB" ] ; then
rsh $HOST -l $ORACLE /sbin/init.d/oracle $1 ORA_DB
exit
fi
#
LOG=$ORACLE_HOME/startup.log
touch $LOG
chmod a+r $LOG
#
member=`clu_get_info|grep "this member"|awk '{print $6}'`
#
case $1 in
'start')
echo "$0: starting up" >;>; $LOG
date >;>; $LOG
# Start Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "starting Oracle Net listener"
$ORACLE_HOME/bin/lsnrctl start >;>; $LOG 2>;&1
fi
echo "starting Oracle databases"
# Amended for RAC
$ORACLE_HOME/bin/gsdctl start
$ORACLE_HOME/bin/srvctl start instance -d orcl -i orcl$member >;>; $LOG 2>;&1
$ORACLE_HOME/bin/agentctl start >;>; $LOG 2>;&1
;;
'stop')
echo "$0: shutting down" >;>; $LOG
date >;>; $LOG
# Stop Oracle Net
if [ -f $ORACLE_HOME/bin/tnslsnr ] ;
then
echo "stopping Oracle Net listener"
$ORACLE_HOME/bin/lsnrctl stop >;>; $LOG 2>;&1
fi
echo "stopping Oracle databases"
# Amended for RAC
$ORACLE_HOME/bin/agentctl stop >;>; $LOG 2>;&1
$ORACLE_HOME/bin/srvctl stop instance -d orcl -i orcl$member >;>; $LOG 2>;&1
$ORACLE_HOME/bin/gsdctl stop
;;
*)
echo "usage: $0 {start|stop}"
exit
;;
esac
#
exit
设置该文件权限:chmod 750 /sbin/init.d/oracle
2、设置.rhosts文件,加入root用户,并将root用户添加oinstall和dba组。
3、创建启动关闭连接:
ln -s /sbin/init.d/oracle /sbin/rc3.d/S99oracle
ln -s /sbin/init.d/oracle /sbin/rc0.d/K01oracle
也可以通过truCluster来做,需编写启动关闭脚本。