Oracle10g VE

#创建CentOS VE 101
vzctl create 101 --ostemplate centos-4-i386-default
vzctl set 101 --userpasswd root:password --save
vzctl set 101 --hostname ve-oracle.example.com --save
vzctl set 101 --ipadd 192.168.0.199 --save

#修改CentOS VE 101资源
vzctl set 101 --kmemsize unlimited --save
vzctl set 101 --lockedpages unlimited --save
vzctl set 101 --privvmpages unlimited --save
vzctl set 101 --shmpages unlimited --save
vzctl set 101 --numproc unlimited --save
vzctl set 101 --numtcpsock unlimited --save
vzctl set 101 --numflock unlimited --save
vzctl set 101 --numpty unlimited --save
vzctl set 101 --numsiginfo unlimited --save
vzctl set 101 --tcpsndbuf unlimited --save
vzctl set 101 --tcprcvbuf unlimited --save
vzctl set 101 --othersockbuf unlimited --save
vzctl set 101 --dgramrcvbuf unlimited --save
vzctl set 101 --numothersock unlimited --save
vzctl set 101 --dcachesize unlimited --save
vzctl set 101 --numfile unlimited --save
vzctl set 101 --numiptent unlimited --save

#修改VPS下CentOS VE配置
cat >> /etc/vz/conf/101.conf <
# Primary parameters
AVNUMPROC="unlimited"
NUMPROC="unlimited"
NUMTCPSOCK="unlimited"
NUMOTHERSOCK="unlimited"
VMGUARPAGES="unlimited"

# Secondary parameters
KMEMSIZE="unlimited"
TCPSNDBUF="unlimited"
TCPRCVBUF="unlimited"
OTHERSOCKBUF="unlimited"
DGRAMRCVBUF="unlimited"
OOMGUARPAGES="unlimited"

# Auxiliary parameters
LOCKEDPAGES="unlimited"
SHMPAGES="unlimited"
PRIVVMPAGES="unlimited"
NUMFILE="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
DCACHESIZE="unlimited"

PHYSPAGES="unlimited"
NUMIPTENT="unlimited"
EOF

#启动 VE 101
vzctl start 101

#修改VE DNS
cat > /etc/resolv.conf<
search example.com
nameserver 202.106.0.20
EOF

#安装必须oracle基本环境包
vzctl exec 101 yum  install binutils compat-db gcc gcc-c++ glibc \
 glibc-common libstdc++ libstdc++-devel gnome-libs make \
 pdksh sysstat libaio xscreensaver openmotif21 xorg-x11-xfs \
 usbutils urw-fonts shared-mime-info perl-libwww-perl \
 perl-XML-Parser perl-URI perl-HTML-Tagset perl-HTML-Parser \
 patch lvm2 intltool libIDL libart_lgpl libbonobo xterm \
 libcap libcroco libgnomecanvas libexif libgnomecups \
 libgnomeprint22 libsoup libwnck libxklavier

#检查oracle环境包安装情况
vzctl exec 101 rpm -q binutils gcc gcc-c++ glibc gnome-libs \
 libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio

#创建oracle帐户
vzctl exec 101 /usr/sbin/groupadd oinstall
vzctl exec 101 /usr/sbin/groupadd dba
vzctl exec 101 /usr/sbin/useradd -m -g oinstall -G dba oracle
vzctl exec 101 id oracle

#修改oracle密码
vzctl exec 101 passwd oracle

#创建oracle家目录
vzctl exec 101 mkdir /home/oracle
vzctl exec 101 mkdir -p /opt/oracle/product/10.2.0/db_1
vzctl exec 101 mkdir /opt/oradata
vzctl exec 101 chown -R oracle:oinstall /opt/oracle /opt/oradata /home/oracle
vzctl exec 101 chmod -R 775 /opt/oracle /opt/oradata /home/oracle
vzctl exec 101 ln -s /usr/lib/libstdc++.so.6.0.3 /usr/lib/libstdc++.so.5

#修改内核参数
cat >>/etc/sysctl.conf<
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
EOF

#应用内核参数修改
/sbin/sysctl -p

#关闭VE 101并备份系统保留纯净安装环境 -1-
vzctl stop 101
cd /u01/backups
tar czpvf ve-101-preOracle.tar.gz /vz/private/101/ /etc/vz/conf/101.conf

#启动 VE 101
vzctl start 101

#复制Oracle10g安装程序至VE101
cp /u01/software/10201_database_linux32.zip /vz/private/101/home/oracle/
vzctl exec 101 chown oracle:oinstall /home/oracle/10201_database_linux32.zip

#解包并配置安装环境变量
cd /home/oracle/
unzip 10201_database_linux32.zip
cd database/
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export DISPLAY=192.168.0.199:0

#启动oracle安装
./runInstaller

export DISPLAY=192.168.0.199:0
/opt/oracle/oraInventory/orainstRoot.sh
/opt/oracle/product/10.2.0/db_1/root.sh

#配置oracle自启动环境
cd
cat >> /home/oracle/.bashrc<
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=orclbj

#清除安装包
cd /home/oracle/
rm -rf database

#关闭VE 101再次备份 -2-
vzctl stop 101
cd /u01/backups
tar czpvf ve-101-postOracleSoftware.tar.gz \
  /vz/private/101/ /etc/vz/conf/101.conf

#启动VE 101
vzctl start 101

#配置转发端口并启动安装程序创建数据库
export DISPLAY=192.168.0.149:0
dbca

#创建数据库监听
netca

#关闭VE 101 最后备份 -3-
vzctl stop 101
cd /u01/backups
tar czpvf ve-101-postOracleDatabase.tar.gz \
   /vz/private/101/ /etc/vz/conf/101.conf

你可能感兴趣的:(oracle,linux,openvz,proxmox)