linux系统oracle数据安装配置脚本

linux系统安装oracle数据库前相关配置;

#root
#/etc/sysctl.conf

cp /etc/sysctl.conf /etc/sycotl.confbackup

echo kernel.shmall = 2097152  >>/etc/sysctl.conf
echo kernel.shmmax = 2147483648 >>/etc/sysctl.conf

# semaphores: semmsl, semmns, semopm, semmni
echo kernel.sem = 250 32000 100 128  >>/etc/sysctl.conf
echo fs.file-max = 65536  >>/etc/sysctl.conf
echo net.ipv4.ip_local_port_range = 1024 65000 >>/etc/sysctl.conf
echo net.core.rmem_default=262144  >>/etc/sysctl.conf
echo net.core.rmem_max=262144  >>/etc/sysctl.conf
echo net.core.wmem_default=262144  >>/etc/sysctl.conf
echo net.core.wmem_max=262144   >>/etc/sysctl.conf
 

/sbin/sysctl –p


#/etc/security/limits.conf

cp /etc/security/limits.conf /etc/security/limits.confbackup

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


#/etc/pam.d/login

cp /etc/pam.d/login  /etc/pam.d/loginbackup

echo session    required     /lib/security/pam_limits.so >>/etc/pam.d/login


#root用户创建用户和修改环境变量:

#创建组用户
/usr/sbin/groupadd oinstall 

#创建组用户             
/usr/sbin/groupadd dba 

#创建用户,并设定用户组                  
/usr/sbin/useradd -g oinstall -G dba oracle 

#设定oracle用户的密码/,linux需要强密码    
passwd oracle                          


su - oracle

#用oracle登陆进操作系统,编辑.bash_profile文件(.bash_profile文件为隐藏文件,其位 置在/home/oracle/.bash_profile)
#在.bash_profile文件下方添加如下内容:

cp .bash_profile .bash_profilebackup
 
echo ORACLE_BASE=/oracle/app  >>.bash_profile
echo ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1  >>.bash_profile 
echo ORACLE_SID=TEST           >>.bash_profile
echo PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin   >>.bash_profile
echo LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib  >>.bash_profile
echo LANG=C           >>.bash_profile          
echo export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH LANG  >>.bash_profile

#使上述环境变量设置生效

source .bash_profile


mkdir -p /opt/oracle/app
chmod  -R 777 /opt/oracle/app
chown -R oracle.oinstall /opt/oracle/app

 

#root用户修改redhat发行标识

cp /etc/redhat-release /etc/redhat-release.bak

echo  Red Hat Enterprise Linux AS release 3 \(Taroon\) > /etc/redhat-release

#验证软件包安装和环境变量配置是否正确
rpm -qa | grep compat
rpm -qa | grep make
rpm -qa | grep setarch
echo $ORACLE_SID
echo $ORACLE_HOME
echo $ORACLE_BASE

你可能感兴趣的:(oracle,linux,配置,环境,休闲)