步骤如下:
1.A机器上打包
[root@localhost oracle]# zip -r db_1.zip /u01/app/oracle/product/11.2.0/db_1/
2. 准备B机器环境
[root@localhost inst_env_scripts]# ./1preusers.sh
[root@localhost inst_env_scripts]# ./2predir.sh
[root@localhost inst_env_scripts]# ./3prelimits.sh
[root@localhost inst_env_scripts]# ./4presysctl.sh
脚本内容如下
[root@localhost inst_env_scripts]# cat 1preusers.sh
#!/bin/bash
#Purpose:Create 3 groups named 'oinstall','dba','oper', plus 1 users named 'oracle'.
#Also setting the Environment
#variable for oracle user.
#variable for grid user.
#Usage:Log on as the superuser('root'),and then execute the command:#./1preusers.sh
#Author:ding liqing
?
echo "Now create 3 groups named 'oinstall','dba','oper'"
echo "Plus 1 users named 'oracle',Also setting the Environment"
groupadd -g 1000 oinstall
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -u 1101 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
echo "oracle" | passwd --stdin oracle
echo "export TMP=/tmp">> /home/oracle/.bash_profile?
echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profile
echo "export ORACLE_SID=orcl">> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1'>> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin'? >> /home/oracle/.bash_profile
echo 'export PATH=/usr/sbin:$PATH'>> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/oracle/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>> /home/oracle/.bash_profile
echo "export EDITOR=vi" >> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/oracle/.bash_profile
echo "umask 022">> /home/oracle/.bash_profile
?
echo "The Groups and users has been created"
echo "The Environment for oracle also has been set successfully"
?
[root@localhost inst_env_scripts]# cat 2predir.sh
#!/bin/bash
#Purpose:Create the necessary directory for oracle users and change the authention to oracle users.
#Usage:Log on as the superuser('root'),and then execute the command:#./2predir.sh
#Author:ding liqing
?
echo "Now create the necessary directory for oracle users and change the authention to oracle users..."
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01
echo "The necessary directory for oracle users and change the authention to oracle users has been finished"
?
[root@localhost inst_env_scripts]# cat 3prelimits.sh
#!/bin/bash
#Purpose:Change the /etc/security/limits.conf.
#Usage:Log on as the superuser('root'),and then execute the command:#./3prelimits.sh
#Author:ding lq
?
echo "Now modify the /etc/security/limits.conf,but backup it named /etc/security/limits.conf.bak before"
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "Mo