Oracle RAC+DG环境搭建的方法是什么
发表于:2025-11-07 作者:千家信息网编辑
千家信息网最后更新 2025年11月07日,本篇内容主要讲解"Oracle RAC+DG环境搭建的方法是什么",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Oracle RAC+DG环境搭建的方法是什
千家信息网最后更新 2025年11月07日Oracle RAC+DG环境搭建的方法是什么
本篇内容主要讲解"Oracle RAC+DG环境搭建的方法是什么",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Oracle RAC+DG环境搭建的方法是什么"吧!
分两个脚本 env.sh 和rpm.sh
env.sh 整体脚本如下,修改相关数据库实例名后,在四台主机上直接执行:
#!/bin/bash# #Purpose: 1. set the Environment and OS parameter# 2. create 6 groups (oinstall,dba,oper,asmadmin,asmdba,asmoper) and 2 user(oracle,grid)# 3. create the necessary directory# #Usage: It would be called by main.sh or you can execute it alonely and Separately in two nodes.# Log on as the superuser('root'),and then execute this script##Notice: # 2. you can edit the config firtly. It will be run in two nodes, so you must modify # ORACLE_SID and ORACLE_SID_GRID# #Author: yunxiaochong#################################################################################################################### config #######################################################Define parameter, Same as the following directory. (refer to step 2) ##########################################################################################################################oracle #ORACLE_SID="DEVDB1" #ORACLE_BASE="/u01/app/oracle" #ORACLE_HOME="${ORACLE_BASE}/product/11.2/db_1" #ORACLE_HOSTNAME=`hostname` #ORACLE_UNQNAME='DEVDB' #ORACLE_BASE_HEAD=/`echo $ORACLE_BASE | cut -d\/ -f2` #/u01 #APP=$ORACLE_BASE_HEAD/`echo $ORACLE_BASE | cut -d\/ -f3` #/u01/app # ##grid #ORACLE_SID_GRID="+ASM1" #ORACLE_BASE_GRID="/u01/app/grid" #ORACLE_HOME_GRID="/u01/app/11.2/grid" ####################################################################################################### HOSTNAME## IPTABLES#service iptables stop > /dev/null#chkconfig iptables off > /dev/null#config DNS # vim /etc/resolv.conf# search localdomain# nameserver 10.28.254.19#chkconfig iptables off # vm /etc/hosts##SELinux#setenforce 0 #vim /etc/selinux/config#SELINUX=disabled#ntpd#service ntpd status#chkconfig ntpd off########################################################################################### steps infomation ###################################################################################################echo "*************************************************************************"echo "** step0 : clean user and group and delete directory **"echo "** step1 : create 6 groups and 2 users **" echo "** step2 : create necessary directory for oracle and grid **" echo "** step3 : Set the Environment ~/.bash_profile **" echo "** step4 : modify the /etc/security/limits.conf. **"echo "** step5 : modify the /etc/pam.d/login. **"echo "** step6 : modify the /etc/profile. **"echo "** step7 : modify the /etc/sysctl.conf and make the changes take effect**"echo "*************************************************************************"#step0: check OS (cpu and mem)##################################clear logrm -rf ./log &> /dev/null######################################################################################### step0: clean user and group and delete directory ###############################################################################################clean usersfor user in oracle griddo id $user &> /dev/nullif [ $? -eq 0 ]; then userdel -r $user echo "step0_1 :: deleted existed $user" >> ./logfi done##clean groupsfor group in dba oinstall oper asmadmin asmdba asmoperdoegrep "^$group" /etc/group &>/dev/nullif [ $? -eq 0 ]; then groupdel $group echo "step0_2 :: deleted existed $group" >> ./logfidone##clean directoriesrm -rf $ORACLE_BASE rm -rf $ORACLE_BASE_GRIDrm -rf $ORACLE_HOME_GRIDecho "Successful finished...step0 : cleaned users,groups and directories" | tee -a ./log################################################################################################ step1: create groups and users #########################################################################################################create groupsgroupadd -g 1100 oinstall group_oinstall=$?groupadd -g 1101 dbagroup_dba=$? groupadd -g 1102 opergroup_oper=$?#----------------------------------#groupadd -g 1200 asmadmin group_asmadmin=$?groupadd -g 1201 asmdba group_asmdba=$?groupadd -g 1202 asmoper group_asmoper=$?#create usersuseradd -m -u 1100 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracleuser_oracle=$?echo "oracle" | passwd --stdin oracle >/dev/nulluser_oracle_p=$?#----------------------------------------------------------------------#useradd -m -u 1200 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" griduser_grid=$?echo "grid" | passwd --stdin grid >/dev/nulluser_grid_P=$?if [ $group_oinstall == 0 -a $group_asmadmin == 0 -a $group_asmdba == 0 -a $group_asmoper == 0 \ -a $user_grid == 0 -a $user_grid_P == 0 -a $group_dba == 0 -a $group_oper == 0 \-a $user_oracle == 0 -a $user_oracle_p == 0 ];then echo "step1_1 :: created groups and users" >> ./log else echo "create groups and users failed" exit 1fiecho "Successful finished...step1 : created users and groups" | tee -a ./log################################################################################################# step2: create directory ##########################################################################################################step2 : create directory if [ ! -d $ORACLE_BASE_GRID -a ! -d $ORACLE_HOME_GRID ]; then mkdir -p $ORACLE_BASE_GRIDmkdir -p $ORACLE_HOME_GRIDchown -R grid:oinstall $ORACLE_BASE_HEADecho "step2_1 ::directory for grid finished" >> ./logelseecho "step2_1 ::directory for grid create failed" >> ./logexit 2fi if [ ! -d $ORACLE_BASE ]; then mkdir -p $ORACLE_BASE chown oracle:oinstall $ORACLE_BASE chmod -R 775 $ORACLE_BASE_HEAD echo "step2_2::directory for oracle finished" >> ./logelse echo "step2_2::directory for oracle is already OK" >> ./logexit 2fi echo "Successful finished...step2 : The necessary directory has been finished" | tee -a ./log ################################################################################################# step3: Set the Environment ~/.bash_profile ###########################################################################################################oracle .bash_profilesed -i '/TMP/d' /home/oracle/.bash_profile echo "export TMP=/tmp">> /home/oracle/.bash_profilesed -i '/TMPDIR/d' /home/oracle/.bash_profile echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profilesed -i '/ORACLE_HOSTNAME/d' /home/oracle/.bash_profile echo "export ORACLE_HOSTNAME=${ORACLE_HOSTNAME}">> /home/oracle/.bash_profilesed -i '/ORACLE_SID/d' /home/oracle/.bash_profile echo "export ORACLE_SID=${ORACLE_SID}">> /home/oracle/.bash_profile sed -i '/PS1/d' /home/oracle/.bash_profileecho 'export PS1="[\u@${ORACLE_SID}@\h:\W]"' >> /home/oracle/.bash_profilesed -i '/ORACLE_BASE/d' /home/oracle/.bash_profileecho "export ORACLE_BASE=${ORACLE_BASE}">> /home/oracle/.bash_profilesed -i '/ORACLE_HOME/d' /home/oracle/.bash_profileecho "export ORACLE_HOME=${ORACLE_HOME}">> /home/oracle/.bash_profilesed -i '/ORACLE_UNQNAME/d' /home/oracle/.bash_profileecho "export ORACLE_UNQNAME=${ORACLE_UNQNAME}">> /home/oracle/.bash_profilesed -i '/TNS_ADMIN/d' /home/oracle/.bash_profileecho "export TNS_ADMIN=${ORACLE_HOME}/network/admin" >> /home/oracle/.bash_profilesed -i '/ORACLE_TERM/d' /home/oracle/.bash_profileecho "export ORACLE_TERM=xterm">> /home/oracle/.bash_profilesed -i '/PATH/d' /home/oracle/.bash_profile#echo "export PATH=/usr/sbin:$PATH">> /home/oracle/.bash_profileecho "export PATH=${ORACLE_HOME}/bin:$PATH">> /home/oracle/.bash_profilesed -i '/LD_LIBRARY_PATH/d' /home/oracle/.bash_profileecho "export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib">> /home/oracle/.bash_profilesed -i '/CLASSPATH/d' /home/oracle/.bash_profileecho "export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib">> /home/oracle/.bash_profilesed -i '/EDITOR/d' /home/oracle/.bash_profileecho "export EDITOR=vim" >> /home/oracle/.bash_profilesed -i '/LANG=en_US/d' /home/oracle/.bash_profileecho "export" >> /home/oracle/.bash_profilesed -i '/NLS/d' /home/oracle/.bash_profileecho "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profileecho "export NLS_DATE_FORMAT='yyyy/mm/dd hh34:mi:ss'" >> /home/oracle/.bash_profilesed -i '/umask/d' /home/oracle/.bash_profileecho "umask 022">> /home/oracle/.bash_profileecho "modify the /home/oracle/.bash_profile had been succeed." >> ./log##grid .bash_profilesed -i '/TMP/d' /home/grid/.bash_profileecho "export TMP=/tmp">> /home/grid/.bash_profile sed -i '/TMPDIR/d' /home/grid/.bash_profileecho "export TMPDIR=$TMP">>/home/grid/.bash_profile sed -i '/ORACLE_SID/d' /home/grid/.bash_profileecho "export ORACLE_SID=$ORACLE_SID_GRID">> /home/grid/.bash_profile sed -i '/PS1/d' /home/oracle/.bash_profileecho 'export PS1="[\u@${ORACLE_SID}@\h:\W]"' >> /home/oracle/.bash_profilesed -i '/ORACLE_BASE/d' /home/grid/.bash_profileecho "export ORACLE_BASE=$ORACLE_BASE_GRID">> /home/grid/.bash_profilesed -i '/ORACLE_HOME/d' /home/grid/.bash_profileecho "export ORACLE_HOME=$ORACLE_HOME_GRID">> /home/grid/.bash_profilesed -i '/ORACLE_TERM/d' /home/grid/.bash_profileecho "export ORACLE_TERM=xterm">> /home/grid/.bash_profilesed -i '/NLS/d' /home/grid/.bash_profileecho "export NLS_DATE_FORMAT='yyyy/mm/dd hh34:mi:ss'" >> /home/grid/.bash_profileecho "export TNS_ADMIN=$ORACLE_HOME_GRID/network/admin" >> /home/grid/.bash_profilesed -i '/PATH/d' /home/grid/.bash_profileecho "export PATH=$ORACLE_HOME_GRID/bin:$PATH">> /home/grid/.bash_profileecho "export LD_LIBRARY_PATH=$ORACLE_HOME_GRID/lib:/lib:/usr/lib">> /home/grid/.bash_profilesed -i '/CLASSPATH/d' /home/grid/.bash_profileecho "export CLASSPATH=$ORACLE_HOME_GRID/JRE:$ORACLE_HOME_GRID/jlib:$ORACLE_HOME_GRID/rdbms/jlib">> /home/grid/.bash_profilesed -i '/EDITOR/d' /home/grid/.bash_profileecho "export EDITOR=vim" >> /home/grid/.bash_profilesed -i '/LANG/d' /home/grid/.bash_profileecho "export" >> /home/grid/.bash_profileecho "export NLS_LANG=american_america.AL32UTF8" >> /home/grid/.bash_profilesed -i '/umask/d' /home/grid/.bash_profileecho "umask 022">> /home/grid/.bash_profile echo "modify the /home/grid/.bash_profile had been succeed." >> ./log echo "Successful finished...step3 : The Environment(~/.bash_profile ) has been set successfully" | tee -a ./log##################################################################################################################### step4 : modify the /etc/security/limits.conf #############################################################################################################################backup firstly\cp /etc/security/limits.conf /etc/security/limits.conf.baksed -i '/oracle/d' /etc/security/limits.confsed -i '/grid/d' /etc/security/limits.confecho "oracle soft nproc 2047" >>/etc/security/limits.confecho "oracle hard nproc 16384" >>/etc/security/limits.confecho "oracle soft nofile 1024" >>/etc/security/limits.confecho "oracle hard nofile 65536" >>/etc/security/limits.confecho "grid soft nproc 2047" >>/etc/security/limits.confecho "grid hard nproc 16384" >>/etc/security/limits.confecho "grid soft nofile 1024" >>/etc/security/limits.confecho "grid hard nofile 65536" >>/etc/security/limits.confecho "Successful finished...step4 : Modified the /etc/security/limits.conf has been succeed." | tee -a ./log###################################################################################################################### step5 : modify the /etc/pam.d/login ######################################################################################################################################step5: #backup firstly\cp /etc/pam.d/login /etc/pam.d/login.baksed -i '/pam_limits.so/d' /etc/pam.d/loginecho "session required /lib/security/pam_limits.so" >>/etc/pam.d/loginecho "session required pam_limits.so" >>/etc/pam.d/loginecho "Successful finished...step5 : Modified the /etc/pam.d/login has been succeed." | tee -a ./log###################################################################################################################### step6 : modify the /etc/profile ######################################################################################################################################backup firstly\cp /etc/profile /etc/profile.bak rown=`grep -n "oracle" /etc/profile | head -1 | cut -d: -f1`if [ $rown ];then sed -i ''"$rown"',$d' /etc/profilefiecho 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >> /etc/profileecho 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profileecho 'ulimit -p 16384' >> /etc/profileecho 'ulimit -n 65536' >> /etc/profileecho 'else' >> /etc/profileecho 'ulimit -u 16384 -n 65536' >> /etc/profileecho 'fi' >> /etc/profileecho 'fi' >> /etc/profileecho "Successful finished...step6 : Modified the /etc/profile has been succeed." | tee -a ./log###################################################################################################################### step7 : modify the /etc/sysctl.conf and make the changes take effect ################################################################################################################backup firstly\cp /etc/sysctl.conf /etc/sysctl.conf.bakrown=`grep -n "fs.aio-max-nr" /etc/sysctl.conf|head -1|cut -d: -f1`if [ $rown ];then sed -i ''"$rown"',$d' /etc/sysctl.conffiecho "fs.aio-max-nr = 1048576" >> /etc/sysctl.confecho "fs.file-max = 6815744" >> /etc/sysctl.confecho "kernel.shmall = 2097152" >> /etc/sysctl.confecho "kernel.shmmax = 8363284480" >> /etc/sysctl.confecho "kernel.shmmni = 4096" >> /etc/sysctl.confecho "kernel.sem = 250 32000 100 128" >> /etc/sysctl.confecho "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.confecho "net.core.rmem_default = 262144" >> /etc/sysctl.confecho "net.core.rmem_max = 4194304" >> /etc/sysctl.confecho "net.core.wmem_default = 262144" >> /etc/sysctl.confecho "net.core.wmem_max = 1048586" >> /etc/sysctl.confecho "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.confecho "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.confsysctl -p &> /dev/nullecho "Successful finished...step6 : Modified the /etc/sysctl.conf has been succeed." | tee -a ./logrpm.sh 脚本如下,同样在四个主机上执行:
#!/bin/bash#/usr/bin/yum install binutils -y -q/usr/bin/yum install compat-libstdc++* -y -q/usr/bin/yum install compat-libcap1* -y -q/usr/bin/yum install gcc -y -q/usr/bin/yum install glibc -y -q/usr/bin/yum install glibc-devel -y -q/usr/bin/yum install ksh -y -q/usr/bin/yum install libaio -y -q/usr/bin/yum install libaio-devel -y -q/usr/bin/yum install libgcc -y -q/usr/bin/yum install libstdc++ -y -q/usr/bin/yum install libstdc++-devel -y -q/usr/bin/yum install libXext -y -q/usr/bin/yum install libXtst -y -q/usr/bin/yum install libX11 -y -q/usr/bin/yum install libXau -y -q/usr/bin/yum install libXi -y -q/usr/bin/yum install make -y -q/usr/bin/yum install sysstat -y -q
执行结果如下:
到此,相信大家对"Oracle RAC+DG环境搭建的方法是什么"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
方法
环境
脚本
主机
内容
学习
实用
更深
两个
兴趣
实例
实用性
实际
操作简单
数据
数据库
整体
更多
朋友
结果
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
产生计算机网络安全问题
沧州软件开发培训机构
交通终端服务器安装施工
十三五网络安全规划意义
福建超频服务器出厂价
中国有声资源数据库方言调查
饥荒加别人的服务器卡
计算机网络技术当兵有用吗
秘宝猎人所有服务器
怎么用string数据库
数据库放在线下
丽水电脑软件开发需要学什么
县委组织部网络安全自查总结
甘肃新一代网络技术服务资费
王者用的谁的服务器
我的世界造服务器如何弄公告
服务器搭建网站收集数据
机器人软件开发中心
数据库单价表保留一位小数
中国科学论文引文数据库
arm实验工资管理数据库
中国农业银行软件开发笔试
税务网络安全检查情况汇报
个人网站选什么服务器
a3纸三年级网络安全手抄报
360还是网络安全股吗
吉林智慧城管软件开发公司
存储技术和数据库
惠州APP软件开发招聘信息
大足区网络软件开发流程要求