一步一步搭建11gR2 rac+dg之DG 机器配置(七)
作者:互联网
DG 机器配置
本文文档结构:
这一步的DG机器配置就相当于安装单实例的DB+ASM 一样,这里我把之前的文档内容直接拷贝过来了,也不做过多的解释了
安装之前的配置工作
检查硬件
在正式安装开始前,请先检查你的软硬件条件是否满足安装需要。
硬件上可以使用命令查看内存情况和 CPU 特性:
#more /proc/meminfo
#more /proc/cpuinfo
其中内存的要求是不低于 1G
下面的不是必须的,可选使用
#df –k /dev/shm 检查共享内存
#df –k /tmp 检查临时磁盘空间
#more /proc/version 检查操作系统版本
#uname –r 检查内核版本
内存
# grep MemTotal /proc/meminfo
交换空间
# grep SwapTotal /proc/meminfo
磁盘空间
# df -ah
# free
#free -m
安装软件包检查
可以统一检查:
rpm -q binutils \
compat-libstdc++-33 \
elfutils-libelf \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
ksh \
libaio \
libaio-devel \
libgomp \
libgcc \
libstdc++ \
libstdc++-devel \
make \
sysstat \
unixODBC \
unixODBC-devel \
numactl-devel
我们可以看到没有安装过的包会已is not installed 出现:
[root@rhel6_lhr ~]# rpm -q binutils \
> compat-libstdc++-33 \
> elfutils-libelf \
> gcc \
> gcc-c++ \
> glibc \
> glibc-common \
> glibc-devel \
> glibc-headers \
> ksh \
> libaio \
> libaio-devel \
> libgomp \
> libgcc \
> libstdc++ \
> libstdc++-devel \
> make \
> sysstat \
> unixODBC \
> unixODBC-devel \
> numactl-devel
binutils-2.20.51.0.2-5.36.el6.x86_64
compat-libstdc++-33-3.2.3-69.el6.x86_64
compat-libstdc++-33-3.2.3-69.el6.i686
elfutils-libelf-0.152-1.el6.x86_64
gcc-4.4.7-4.el6.x86_64
gcc-c++-4.4.7-4.el6.x86_64
glibc-2.12-1.132.el6.x86_64
glibc-common-2.12-1.132.el6.x86_64
glibc-devel-2.12-1.132.el6.x86_64
glibc-headers-2.12-1.132.el6.x86_64
package ksh is not installed
libaio-0.3.107-10.el6.x86_64
libaio-devel-0.3.107-10.el6.x86_64
libaio-devel-0.3.107-10.el6.i686
libgomp-4.4.7-4.el6.x86_64
libgcc-4.4.7-4.el6.x86_64
libstdc++-4.4.7-4.el6.x86_64
libstdc++-devel-4.4.7-4.el6.x86_64
libstdc++-devel-4.4.7-4.el6.i686
make-3.81-20.el6.x86_64
sysstat-9.0.4-22.el6.x86_64
unixODBC-2.2.14-12.el6_3.x86_64
unixODBC-2.2.14-12.el6_3.i686
unixODBC-devel-2.2.14-12.el6_3.i686
unixODBC-devel-2.2.14-12.el6_3.x86_64
package numactl-devel is not installed
[root@rhel6_lhr ~]#
如果部分包不存在
可以批量更新安装,但如果依赖关系缺失,可能需要多执行两遍
或者手工调整
修改主机名
永久生效:
[root@zijuan /]# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=dg
注意:修改主机名后,需要重启系统后生效,或者切换个用户然后切换回来就OK
查看/etc/hosts文件中必须包含a fully qualified name for the server
[root@localhost lhr]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.59.140 dg
[root@localhost lhr]# hostname dg
[root@localhost lhr]# hostname
dg
磁盘准备
这里为了节省空间,我们采用dd命令来faking 5块裸设备磁盘
1块硬盘安装操作系统
234块用于实现ASM 存储数据
5块硬盘用于存储FRA
------------------------ 直接贴脚本,root用户下执行
mkdir /asmdisk
dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk3 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk4 bs=1024k count=2000
dd if=/dev/zero of=/asmdisk/disk5 bs=1024k count=2000
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /asmdisk/disk2
/sbin/losetup /dev/loop3 /asmdisk/disk3
/sbin/losetup /dev/loop4 /asmdisk/disk4
/sbin/losetup /dev/loop5 /asmdisk/disk5
raw /dev/raw/raw1 /dev/loop1
raw /dev/raw/raw2 /dev/loop2
raw /dev/raw/raw3 /dev/loop3
raw /dev/raw/raw4 /dev/loop4
raw /dev/raw/raw5 /dev/loop5
chmod 660 /dev/raw/raw1
chmod 660 /dev/raw/raw2
chmod 660 /dev/raw/raw3
chmod 660 /dev/raw/raw4
chmod 660 /dev/raw/raw5
chown oracle:dba /dev/raw/raw1
chown oracle:dba /dev/raw/raw2
chown oracle:dba /dev/raw/raw3
chown oracle:dba /dev/raw/raw4
chown oracle:dba /dev/raw/raw5
------ 将以下内容添加到文件/etc/rc.local文件中
------Add the following entries to the file "/etc/rc.local"
/sbin/losetup /dev/loop1 /asmdisk/disk1
/sbin/losetup /dev/loop2 /asmdisk/disk2
/sbin/losetup /dev/loop3 /asmdisk/disk3
/sbin/losetup /dev/loop4 /asmdisk/disk4
/sbin/losetup /dev/loop5 /asmdisk/disk5
raw /dev/raw/raw1 /dev/loop1
raw /dev/raw/raw2 /dev/loop2
raw /dev/raw/raw3 /dev/loop3
raw /dev/raw/raw4 /dev/loop4
raw /dev/raw/raw5 /dev/loop5
chmod 660 /dev/raw/raw1
chmod 660 /dev/raw/raw2
chmod 660 /dev/raw/raw3
chmod 660 /dev/raw/raw4
chmod 660 /dev/raw/raw5
chown oracle:dba /dev/raw/raw1
chown oracle:dba /dev/raw/raw2
chown oracle:dba /dev/raw/raw3
chown oracle:dba /dev/raw/raw4
chown oracle:dba /dev/raw/raw5
如果需要删除的话,删除命令:
losetup –d /dev/loop1
losetup –d /dev/loop1
......
查看结果:
[root@dg ~]# ll /dev/raw/raw*
crw-rw---- 1 oracle dba 162, 1 Oct 9 16:35 /dev/raw/raw1
crw-rw---- 1 oracle dba 162, 2 Oct 9 16:35 /dev/raw/raw2
crw-rw---- 1 oracle dba 162, 3 Oct 9 16:35 /dev/raw/raw3
crw-rw---- 1 oracle dba 162, 4 Oct 9 16:35 /dev/raw/raw4
crw-rw---- 1 oracle dba 162, 5 Oct 9 16:35 /dev/raw/raw5
crw-rw---- 1 root disk 162, 0 Oct 5 15:42 /dev/raw/rawctl
[root@dg ~]#
更多请参考:
E:\云盘\资料盘\李华荣(个人整理)\oracle-linux\asmdisk_创建asm磁盘.sql
配置目录、用户等
配置用户及用户组
利用 /usr/sbin/groupadd 命令
------这里Oracle用户可能已经安装过的,没有影响:
代码:
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin
groupadd asmoper
groupadd asmdba
--添加用户到组
useradd -g oinstall -G dba,asmdba,oper,asmadmin oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,dba grid
--修改密码
passwd oracle
passwd grid
echo oracle | passwd --stdin lhr
echo grid | passwd --stdin lhr
---查看属主
[root@rhel_linux_asm ~]# id oracle
uid=501(oracle) gid=502(dba) groups=502(dba),501(oinstall),504(asmadmin),506(asmdba)
[root@rhel_linux_asm ~]# id grid
uid=502(grid) gid=501(oinstall) groups=501(oinstall),502(dba),504(asmadmin),505(asmoper),506(asmdba)
[root@rhel_linux_asm ~]#
创建目录并且配置 grid 和 oracle 用户的配置文件
代码:
--root用户下:
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0/grid
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
--------Oracle User----切换到Oracle用户下------
[root@rhel_linux_asm ~]# su - oracle
[grid@rhel_linux_asm ~]$ vi ~/.bash_profile
export ORACLE_SID=phydb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$PATH:$ORACLE_HOME/bin
export GLOBAL_DB_UNIQUE_NAME=phydb
export ORACLE_HOSTNAME=192.168.59.140
export ORACLE_UNQNAME=phydb
export ORACLE_ALERT=$ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME/$ORACLE_SID/trace
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
alias asmcmd='rlwrap asmcmd'
alias alert_log='tail -200f $ORACLE_ALERT/alert_$ORACLE_SID.log'
alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'
--------Grid User-----切换到grid用户下-----
cd /home/grid
vim .bash_profile
export ORACLE_SID=+ASM
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:$PATH
alias sqlplus='rlwrap sqlplus'
alias asmcmd='rlwrap asmcmd'
alias alert_log='tail -200f $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
修改完成后执行 source .bash_profile 让设置生效
系统内核参数修改
编辑 /etc/security/limits.conf 文件,在文件尾部添加如下内容:
[root@localhost ~]# tail -8 /etc/security/limits.conf
# add by lhr for oracle and grid on 2014-05-02
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
编辑 /etc/pam.d/login 文件,在文件尾部添加如下内容:
[root@localhost ~]# tail -1 /etc/pam.d/login
session required pam_limis.so
[root@localhost ~]#
编辑 /etc/profile 文件,设置 shell 限制,在文件尾部添加如下内容:
[root@localhost ~]# tail -9 /etc/profile
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
/etc/sysctl.conf
Configuring Kernel Parameters for Linux
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
生效
# /sbin/sysctl -p
备库安装grid软件
安装GridInfrastructure:
创建ASM磁盘组
执行root脚本
[root@dg 11.2.0]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@dg 11.2.0]# /u01/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /u01/app/11.2.0/grid
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
LOCAL ADD MODE
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node dg successfully pinned.
Adding Clusterware entries to upstart
dg 2014/10/02 22:59:43 /u01/app/11.2.0/grid/cdata/dg/backup_20141002_225943.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server
[root@dg 11.2.0]#
安装oracle软件
①以oracle用户登录图形界面,执行/home/oracle/database/runInsta
[root@dg ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The contents of "dbhome" have not changed. No need to overwrite.
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@dg ~]#
标签:11gR2,一步,el6,dev,raw,ORACLE,机器配置,oracle,root 来源: https://blog.51cto.com/lhrbest/2694366