1. 程式人生 > >搭建類似生產環境的RAC

搭建類似生產環境的RAC

install the necessary packages

yum install -y 

 

建立組、使用者和目錄

建立使用者組

groupadd -g 2000 oinstall
groupadd -g 2100 asmadmin
groupadd -g 2200 dba
groupadd -g 2201 oper
groupadd -g 2300 asmdba
groupadd -g 2301 asmoper
useradd -u 2100 -g oinstall -G asmadmin,asmdba,asmoper grid
useradd -u 2101 -g oinstall -G dba,oper,asmdba oracle

  

建立目錄

mkdir -p  /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chown -R 775 /u01

  

設定環境變數

1. 修改 root 使用者環境變數

alias sl='vi /var/log/messagesr'
alias rpmb='rpm -qa --queryformat %-{name}-%{version}-%{release}-%{arch}"\n"'

--- run the following command

echo "alias sl='vi /var/log/messagesr'
alias rpmb='rpm -qa --queryformat %-{name}-%{version}-%{release}-%{arch}"\n"'" >> ~/.bash_profile

 

2. 修改 grid 使用者環境變數

alias ls="ls -FA"
ORACLE_SID=+ASM1;export ORACLE_SID
ORACLE_BASE=/u01/app/grid;export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid;export ORACLE_HOME
GRID_HOME=/u01/app/11.2.0/grid;export GRID_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql;export ORACLE_PATH
ORACLE_TERM=xterm;export ORACLE_TERM
TNS_ADMIN=$ORACLE_HOME/network/admin;export $TNS_ADMIN
PATH=.:${JAVA_HOME}/bin/:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=$PATH:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=$PATH:/u01/app/common/oracle/bin
PATH=$PATH:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch
export $PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/ctx/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export $CLASSPATH
export TMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export SQLPATH=~/admin/sql:$ORACLE_HOME/sqlplus/admin
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
umask 022

  

3. change the ENV of user  "oracle"

alias ls="ls -FA"
ORACLE_SID=ractest1;export ORACLE_SID
ORACLE_UNQNAME=ractest;export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle;export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;export ORACLE_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql;export ORACLE_PATH
ORACLE_TERM=xterm;export ORACLE_TERM
TNS_ADMIN=$ORACLE_HOME/network/admin;export $TNS_ADMIN
PATH=.:${JAVA_HOME}/bin/:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=$PATH:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=$PATH:/u01/app/common/oracle/bin
PATH=$PATH:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch
export $PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/ctx/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export $CLASSPATH
export TMP=/tmp
export TMPDIR=/tmp
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export SQLPATH=~/admin/sql:$ORACLE_HOME/sqlplus/admin
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
umask 022