.前期环境准备

1.网络及主机名规划

 

 

2.安装软件包

使用YUM安装

# yum install -y binutils-* compat-libstdc++-* elfutils-libelf-*elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-*glibc-headers-* ksh-* libaio-* libaio-devel-*libgcc-* libstdc++-*make-*sysstat-* expat-* pdksh-* unixODBC-* libXp*

3. 建立用户和组

/usr/sbin/groupadd -g 501 oinstall

/usr/sbin/groupadd -g 502 dba

/usr/sbin/groupadd -g 504 asmadmin

/usr/sbin/groupadd -g 506 asmdba

/usr/sbin/groupadd -g 507 asmoper

/usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper,dba grid

/usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle

 

 

4. 创建grid目录结构

mkdir -p /u01/app/oraInventory

chown -R grid:oinstall /u01/app/oraInventory

chmod -R 775 /u01/app/oraInventory

 

mkdir -p /u01/app/grid

chmod -R 775 /u01/app/grid

chown -R grid:oinstall /u01/app/grid

 

mkdir -p /u01/app/11.2.0/grid

chown -R grid:oinstall /u01/app/11.2.0/grid

chmod -R 775 /u01/app/11.2.0/grid

 

mkdir -p /u01/software

chown -R grid:oinstall /u01/software/

chmod -R 775 /u01/software/

 

5.创建oracle目录结构

mkdir -p /u01/app/oracle

mkdir -p /u01/app/oracle/cfgtoollogs

chown -R oracle:oinstall /u01/app/oracle

chmod -R 775 /u01/app/oracle

 

mkdir -p /u01/app/oracle/product/11.2.0/db_1

chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1

chmod -R 775 /u01/app/oracle/product/11.2.0/db_1

mkdir p /u01/software

chmod -R 775 /u01

6. 配置内核参数

vi /etc/sysctl.conf

 

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 6553600

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

 

生效:sysctl -p

 

7. 修改limits文件

 

vi /etc/security/limits.conf

 

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

 

8. 配置hangcheck-timer(11gr2+不用配置)

 

modprobe hangcheck-timer hangcheck_tick=1 hangcheck_margin=10 hangcheck_reboot=1

 

 

9. 修改pam文件

#vi /etc/pam.d/login

 

添加一行

session required pam_limits.so

 

10.配置ssh互信

(oraclegrid两个用户)

 

su - oracle

 

方法一:

 

1ssh-keygen -t rsa

2cd .ssh/

3mv id_rsa.pub authorized_keys

4ls -l

5chmod 600 authorized_keys

6cd ..

7scp -r .ssh/ 192.168.54.2:/home/oracle

 

grid测试:

 

ssh lxdrac1 date && ssh lxdrac1priv date && ssh lxdrac2 date && ssh lxdrac2priv date

ssh racjtv1 date && ssh racjtv1pri date && ssh racjtv2 date && ssh racjtv2pri date

 

 

 

 

 

oracle测试:

 

 

方法二:

 

$GI_OUI/sshsetup/sshUserSetup.sh -user grid -hosts "lxdrac1 lxdrac2" -advanced -noPromptPassphrase

$OUI_HOME/sshsetup/sshUserSetup.sh -user oracle -hosts "lxdrac1 lxdrac2" -advanced -noPromptPassphrase

11.用户环境变量设置

grid用户

 

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid

export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID=+ASM2

 

oracle用户

 

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export PATH=$ORACLE_HOME/bin:$PATH

export ORACLE_SID=lxdrac1

12. 关闭不需要的服务

chkconfigautofs off

chkconfigacpid off

chkconfigsendmail off

chkconfigcups-config-daemon off

chkconfigcpus off

chkconfigxfs off

chkconfiglm_sensors off

chkconfiggpm off

chkconfigopenibd off

chkconfigpcmcia off

chkconfigcpuspeed off

chkconfignfslock off

chkconfigip6tables off

chkconfigrpcidmapd off

chkconfigapmd off

chkconfigsendmail off

chkconfigarptables_jf off

chkconifgmicrocode_ctl off

chkconfigrpcgssd off

chkconfig ntpd off

 

/sbin/service ntpd stop

mv /etc/ntp.conf /etc/ntp.conf.bak (这时候oracle会自动启用自己的NTP服务)

 

 

13.共享存储规划

 

 

 

 

 

 

Vote_OCR

/dev/sdb1

/dev/raw/raw1

2g

Vote_OCR

/dev/sdb2

/dev/raw/raw2

2g

Vote_OCR

/ dev/sdb3

/dev/raw/raw3

2g

DATA

dev/sdb5

/dev/raw/raw4

5g

DATA

dev/sdb6

/dev/raw/raw5

5g

DATA

dev/sdb7

/dev/raw/raw6

5g

 

 

做完分区之后 在两个节点上分别执行以下命令:

# partprobe

 

配置raw设备(每个节点都操作)

#vi /etc/udev/rules.d/60-raw.rules

ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"

ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"

ACTION=="add", KERNEL=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N"

ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw4 %N"

ACTION=="add", KERNEL=="sdb6", RUN+="/bin/raw /dev/raw/raw5 %N"

ACTION=="add", KERNEL=="sdb7", RUN+="/bin/raw /dev/raw/raw6 %N"

KERNEL=="raw*", OWNER="grid" GROUP="asmadmin", MODE="0660"

# start_udev

启动 udev

[确定]

 

 

 

.安装GI

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.安装数据库软件

 

 

 

 

 

 

 

 

 

 

.配置ASM DATADG

 

 

 

.建库