一、环境准备
|
主机 1 (主库) |
主机 2 (备库) |
操作系统 |
Centos6.5 64 位 |
Centos6.5 64 位 |
主机名 |
Primary |
Standby |
IP |
192.168.2.11 |
192.168.2.12 |
数据库软件版本 |
oracle 11.2.0.4 |
oracle 11.2.0.4 |
ORACLE_BASE |
/u01/app/oracle |
/u01/app/oracle |
ORACLE_HOME |
/u01/app/oracle/product/11.2.0/db_1 |
/u01/app/oracle/product/11.2.0/db_1 |
ORACLE_SID |
orcl |
lorcl |
二、数据库安装
1. 基础参数设置
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# vi /etc/hosts
[root@localhost ~]# /etc/init.d/iptables stop
[root@localhost ~]# chkconfig iptables off
[root@localhost ~]# vi /etc/pam.d/login
session required /lib64/security/pam_limits.so
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled
[root@localhost ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@localhost ~]# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
[root@localhost ~]# sysctl -p
[root@localhost ~]# vi /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
2. 创建用户和组,设置环境变量
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# groupadd oper
[root@localhost ~]# useradd -g oinstall -G dba,oper oracle
[root@localhost ~]# passwd oracle
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ vi .bash_profile
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
使环境变量生效
[oracle@localhost ~]$ source .bash_profile
3. 配置本地 yum 源
[root@localhost ~]# umount /dev/cdrom
[root@localhost ~]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# mount -o remount,rw /dev/cdrom /mnt/cdrom
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost ~]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost ~]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
[root@localhost ~]# mv CentOS-Vault.repo CentOS-Vault.repo.bak
[root@localhost yum.repos.d]# vi /etc/yum.repos.d/CentOS-Media.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum list
[root@localhost yum.repos.d]# yum -y install binutils compat-libcap1 compat-libstdc* gcc gcc-c++* glibc glibc-devel ksh libgcc libstdc libaio libaio-devel make elfutils-libelf-devel sysstat
[root@strong ~]# chown -R oracle.oinstall /u01