1、配置/etc/hosts 网络
172.16.10.51 rac1 rac1-publ
1.1.1.1 rac1-priv
172.16.10.55 rac1-vip
172.16.10.52 rac2 rac2-publ
1.1.1.2 rac2-priv
172.16.10.56 rac2-vip
172.16.10.57 rac-scan
—-两个节点相互验证
[root@rac1 ~]# ping 172.16.10.51
PING 172.16.10.51 (172.16.10.51) 56(84) bytes of data.
64 bytes from 172.16.10.51: icmp_seq=1 ttl=64 time=0.372 ms
64 bytes from 172.16.10.51: icmp_seq=2 ttl=64 time=0.214 ms
64 bytes from 172.16.10.51: icmp_seq=3 ttl=64 time=0.199 ms
^C
—- 172.16.10.51 ping statistics —-
3 packets transmitted, 3 received, 0% packet loss, time 2477ms
rtt min/avg/max/mdev = 0.199/0.261/0.372/0.080 ms
[root@rac1 ~]# ping 172.16.10.52
PING 172.16.10.52 (172.16.10.52) 56(84) bytes of data.
64 bytes from 172.16.10.52: icmp_seq=1 ttl=64 time=0.016 ms
64 bytes from 172.16.10.52: icmp_seq=2 ttl=64 time=0.024 ms
^C
—- 172.16.10.52 ping statistics —-
2 packets transmitted, 2 received, 0% packet loss, time 1786ms
rtt min/avg/max/mdev = 0.016/0.020/0.024/0.004 ms
[root@rac1 ~]# ping 1.1.1.2
PING 1.1.1.2 (1.1.1.2) 56(84) bytes of data.
64 bytes from 1.1.1.2: icmp_seq=1 ttl=64 time=0.016 ms
64 bytes from 1.1.1.2: icmp_seq=2 ttl=64 time=0.025 ms
^C
—- 1.1.1.2 ping statistics —-
2 packets transmitted, 2 received, 0% packet loss, time 1643ms
rtt min/avg/max/mdev = 0.016/0.020/0.025/0.006 ms
[root@rac1 ~]# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.305 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=64 time=0.209 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=64 time=0.230 ms
^C
—- 1.1.1.1 ping statistics —-
3 packets transmitted, 3 received, 0% packet loss, time 2351ms
rtt min/avg/max/mdev = 0.209/0.248/0.305/0.041 ms
2、关闭firewall和disabled Selinux
service iptables stop
service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
chkconfig iptables off
vi /etc/selinux/config 修改成==>SELINUX=disabled
setenforce 0
3、配置yum
mkdir /mnt/media
mount /dev/cdrom /mnt/media
cd /etc/yum.repos.d/
mv public-yum-ol6.repo public-yum-ol6.repo.bak
vi oracle.repo
—-添加如下
[OEL6]
name=ORCALELINUX6
baseurl=file: ///mnt/media/
gpgcheck=0
enable=1
—-验证
yum list
—-创建目录scripts
mkdir -p /home/scripts
上传脚本oracle_OS.sh oracle_package.sh 到目录下
—-添加执行权限
[root@rac1 scripts]# chmod o+x oracle_OS.sh
[root@rac1 scripts]# chmod o+x oracle_package.sh
4、运行依赖包脚本
[root@rac1 scripts]# ./oracle_package.sh
-bash: ./oracle_package.sh: /bin/bash^M: bad interpreter: No such file or directory
—文本格式不对
vi oracle_package.sh
:set fileformat=unxi
:wq
vi oracle_OS.sh
:set fileformat=unix
:wq
[root@rac1 scripts]# ./oracle_package.sh
binutils-2.20.51.0.2-5.42.el6 (x86_64)
package compat-libstdc++-33 is not installed
elfutils-libelf-0.158-3.2.el6 (x86_64)
package elfutils-libelf-devel is not installed
gcc-4.4.7-11.el6 (x86_64)
package gcc-c++ is not installed
glibc-2.12-1.149.el6 (x86_64)
glibc-common-2.12-1.149.el6 (x86_64)
glibc-devel-2.12-1.149.el6 (x86_64)
glibc-headers-2.12-1.149.el6 (x86_64)
package ksh is not installed
libaio-0.3.107-10.el6 (x86_64)
package libaio-devel is not installed
libgcc-4.4.7-11.el6 (x86_64)
libstdc++-4.4.7-11.el6 (x86_64)
package libstdc++-devel is not installed
make-3.81-20.el6 (x86_64)
sysstat-9.0.4-27.el6 (x86_64)
package unixODBC is not installed
package unixODBC-devel is not installed
—-安装没有安装的依赖包
yum install compat-libstdc++-33 compat-libcap1 elfutils-libelf-devel gcc-c++ ksh libaio-devel libstdc++-devel unixODBC unixODBC-devel -y
——再次运行脚本是否有未安装的
[root@rac1 scripts]# ./oracle_package.sh
binutils-2.20.51.0.2-5.42.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
elfutils-libelf-0.158-3.2.el6 (x86_64)
elfutils-libelf-devel-0.158-3.2.el6 (x86_64)
gcc-4.4.7-11.el6 (x86_64)
gcc-c++-4.4.7-11.el6 (x86_64)
glibc-2.12-1.149.el6 (x86_64)
glibc-common-2.12-1.149.el6 (x86_64)
glibc-devel-2.12-1.149.el6 (x86_64)
glibc-headers-2.12-1.149.el6 (x86_64)
ksh-20120801-21.el6 (x86_64)
libaio-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (x86_64)
libgcc-4.4.7-11.el6 (x86_64)
libstdc++-4.4.7-11.el6 (x86_64)
libstdc++-devel-4.4.7-11.el6 (x86_64)
make-3.81-20.el6 (x86_64)
sysstat-9.0.4-27.el6 (x86_64)
unixODBC-2.2.14-14.el6 (x86_64)
unixODBC-devel-2.2.14-14.el6 (x86_64)
5、系统参数以及创建用户脚本
运行脚本oracle_OS.sh
[root@rac1 scripts]# ./oracle_OS.sh
uid=501(oracle) gid=6000(oinstall) groups=6000(oinstall),5001(asmdba),6001(dba)
uid=500(grid) gid=6000(oinstall) groups=6000(oinstall),5000(asmadmin),5001(asmdba),5002(asmoper),6001(dba)
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Changing password for user grid.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
cp: cannot create regular file `/bak/security/limits.conf’: No such file or directory
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: “net.bridge.bridge-nf-call-ip6tables” is an unknown key
error: “net.bridge.bridge-nf-call-iptables” is an unknown key
error: “net.bridge.bridge-nf-call-arptables” is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
/etc/security/limits.conf
#
Each line describes a limit for a user in the form:
#
<domain> <type> <item> <value>
#
Where:
<domain> can be:
- a user name
- a group name, with @group syntax
- the wildcard *, for default entry
- the wildcard %, can be also used with %group syntax,
for maxlogin limit
#
<type> can have the two values:
- “soft” for enforcing the soft limits
- “hard” for enforcing hard limits
#
<item> can be one of the following:
- core - limits the core file size (KB)
- data - max data size (KB)
- fsize - maximum filesize (KB)
- memlock - max locked-in-memory address space (KB)
- nofile - max number of open file descriptors
- rss - max resident set size (KB)
- stack - max stack size (KB)
- cpu - max CPU time (MIN)
- nproc - max number of processes
- as - address space limit (KB)
- maxlogins - max number of logins for this user
- maxsyslogins - max number of logins on the system
- priority - the priority to run user process with
- locks - max number of file locks the user can hold
- sigpending - max number of pending signals
- msgqueue - max memory used by POSIX message queues (bytes)
- nice - max nice priority allowed to raise to values: [-20, 19]
- rtprio - max realtime priority
#
<domain> <type> <item> <value>
#
* soft core 0
* hard rss 10000
@student hard nproc 20
@faculty soft nproc 20
@faculty hard nproc 50
ftp hard nproc 0
@student - maxlogins 4
End of file
orcl 2017+08+09
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
%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
session optional pam_console.so
pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include system-auth
-session optional pam_ck_connector.so
orcl 2017+08+09
session required pam_limits.so
Kernel sysctl configuration file for Red Hat Linux
#
For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
sysctl.conf(5) for more details.
Controls IP packet forwarding
net.ipv4.ip_forward = 0
Controls source route verification
net.ipv4.conf.default.rp_filter = 1
Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
Controls whether core dumps will append the PID to the core filename.
Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
#
orcl 2017+08+09
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65000
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
/etc/profile
System wide environment and startup programs, for login setup
Functions and aliases go in /etc/bashrc
It’s NOT a good idea to change this file unless you know what you
are doing. It’s much better to create a custom.sh shell script in
/etc/profile.d/ to make custom changes to your environment, as this
will prevent the need for merging in future updates.
pathmunge () {
case “:${PATH}:” in
:”$1”:)
;;
*)
if [ “$2” = “after” ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z “$EUID” ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
Path manipulation
if [ “$EUID” = “0” ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi
HOSTNAME=/bin/hostname 2>/dev/null
HISTSIZE=1000
if [ “$HISTCONTROL” = “ignorespace” ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
By default, we want umask to get set. This sets it for login shell
Current threshold for system reserved uid/gids is 200
You could check uidgid reservation validity in
/usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ “id -gn“ = “id -un“ ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/.sh ; do
if [ -r “$i” ]; then
if [ “${-#i}” != “$-“ ]; then
. “$i”
else
. “$i” >/dev/null 2>&1
fi
fi
done
unset i
unset -f pathmunge
#
orcl 2017+08+09
if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
#
ntpd is stopped
——二节点创建目录
mkdir -p /home/scripts/
——传送脚本到二节点
[root@rac1 scripts]$scp * root@172.16.10.52:/home/scripts/
The authenticity of host ‘172.16.10.52 (172.16.10.52)’ can’t be established.
RSA key fingerprint is c2:32:ab:f4:3c:ee:c2:c3:8c:be:ea:c9:b8:e3:ff:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.10.52’ (RSA) to the list of known hosts.
root@172.16.10.52’s password:
oracle_OS.sh 100% 3377 3.3KB/s 00:00
oracle_package.sh 100% 759 0.7KB/s 00:00
—-步骤按照上述一节点得检查操作
6、配置GRID用户环境变量
rac1:
vi ~/.bash_profile
—添加如下
ORACLE_SID=+ASM1
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK; export NLS_LANG
ORACLE_BASE=/g01/grid
ORACLE_HOME=/g01/app/grid/11.2.0
TNS_ADMIN=$ORACLE_HOME/network/admin
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdbc
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:$ORACLE_HOME/oracm/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/jdbc/lib
SQLPATH=$ORACLE_HOME/sqlplus/admin:/home/oracle/admin/sql:$ORACLE_HOME/rdbms/admin
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH TNS_ADMIN SQLPATH
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH SQLPATH
NLS_DATE_FORMAT=”yyyy-mm-dd hh24:mi:ss”;export NLS_DATE_FORMAT
echo “ “
echo “ “
echo -e “/e[31;1m**/e[0m”
echo -e “/e[31;1mYou login as grid,Please ask somebody to double check!*/e[0m”
echo -e “/e[31;1m**/e[0m”
echo “ “
echo “ “
export PS1=’/e[31;1m${LOGNAME}@${HOSTNAME}:${PWD}>/e[0m’
alias sql=’sqlplus “/“‘
alias rsql=’rlwrap sqlplus’
alias sqln=”sqlplus /nolog”
alias dba=’sqlplus “/as sysasm”‘
alias ohome=”cd $ORACLE_HOME”
alias rm=’rm -i —‘
alias cp=’cp -i’
alias mv=’mv -i —‘
11G
alias clog=’cd $ORACLEHOME/log/hostname‘
alias bdump=’cd $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace’
alias udump=”cd $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/“
alias cdump=”cd $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/“
alias otail=”tail -f $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/alert$ORACLESID.log”
alias vlog=’tail -200 $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/alert$ORACLE_SID.log’
alias myasm=’cd $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace’
stty erase ^H
最后source ~/.bash_profile
You login as grid,Please ask somebody to double check!*
grid@rac1:/home/scripts>
rac2:
vi ~/.bash_profile
—添加如下
ORACLE_SID=+ASM2
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK; export NLS_LANG
ORACLE_BASE=/g01/grid
ORACLE_HOME=/g01/app/grid/11.2.0/
TNS_ADMIN=$ORACLE_HOME/network/admin
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdbc
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:$ORACLE_HOME/oracm/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/jdbc/lib
SQLPATH=$ORACLE_HOME/sqlplus/admin:/home/oracle/admin/sql:$ORACLE_HOME/rdbms/admin
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH TNS_ADMIN SQLPATH
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH SQLPATH
NLS_DATE_FORMAT=”yyyy-mm-dd hh24:mi:ss”;export NLS_DATE_FORMAT
echo “ “
echo “ “
echo -e “/e[31;1m**/e[0m”
echo -e “/e[31;1mYou login as grid,Please ask somebody to double check!*/e[0m”
echo -e “/e[31;1m**/e[0m”
echo “ “
echo “ “
export PS1=’/e[31;1m${LOGNAME}@${HOSTNAME}:${PWD}>/e[0m’
alias sql=’sqlplus “/“‘
alias rsql=’rlwrap sqlplus’
alias sqln=”sqlplus /nolog”
alias dba=’sqlplus “/as sysasm”‘
alias ohome=”cd $ORACLE_HOME”
alias rm=’rm -i —‘
alias cp=’cp -i’
alias mv=’mv -i —‘
11G
alias clog=’cd $ORACLEHOME/log/hostname‘
alias bdump=’cd $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace’
alias udump=”cd $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/“
alias cdump=”cd $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/“
alias otail=”tail -f $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/alert$ORACLESID.log”
alias vlog=’tail -200 $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace/alert$ORACLE_SID.log’
alias myasm=’cd $ORACLE_BASE/admin/diag/asm/+asm/+ASM/trace’
stty erase ^H
最后source ~/.bash_profile
You login as grid,Please ask somebody to double check!*
grid@rac1:/home/scripts>
7、配置ORACLE用户环境变量
rac1:
—添加如下
ORACLE_SID=orcl1
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK; export NLS_LANG
ORACLE_HOME=/u01/oracle/11.2.0/
ORACLE_BASE=/u01/oracle
TNS_ADMIN=$ORACLE_HOME/network/admin
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdbc
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:$ORACLE_HOME/oracm/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/jdbc/lib
SQLPATH=$ORACLE_HOME/sqlplus/admin:/home/oracle/admin/sql:$ORACLE_HOME/rdbms/admin
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH TNS_ADMIN SQLPATH
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH SQLPATH
NLS_DATE_FORMAT=”yyyy-mm-dd hh24:mi:ss”;export NLS_DATE_FORMAT
echo “ “
echo “ “
echo -e “/e[31;1m**/e[0m”
echo -e “/e[31;1mYou login as oracle,Please ask somebody to double check!*/e[0m”
echo -e “/e[31;1m**/e[0m”
echo “ “
echo “ “
export PS1=’/e[31;1m${LOGNAME}@${HOSTNAME}:${PWD}>/e[0m’
alias sql=’sqlplus “/“‘
alias rsql=’rlwrap sqlplus’
alias sqln=”sqlplus /nolog”
alias dba=’sqlplus “/as sysdba”‘
alias ohome=”cd $ORACLE_HOME”
alias rm=’rm -i —‘
alias cp=’cp -i’
alias mv=’mv -i —‘
——————————————————————————————————————————-
UMASK
——————————————————————————————————————————-
Set the default file mode creation mask
(umask) to 022 to ensure that the user performing
the Oracle software installation creates files
with 644 permissions
——————————————————————————————————————————
umask 022
stty erase ^H
[oracle@rac1 ~]$ source ~/.bash_profile
You login as oracle,Please ask somebody to double check!*
oracle@rac1:/home/oracle>
rac2:
—添加如下
ORACLE_SID=orcl2
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK; export NLS_LANG
ORACLE_HOME=/u01/oracle/11.2.0/
ORACLE_BASE=/u01/oracle
TNS_ADMIN=$ORACLE_HOME/network/admin
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdbc
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:$ORACLE_HOME/oracm/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/jdbc/lib
SQLPATH=$ORACLE_HOME/sqlplus/admin:/home/oracle/admin/sql:$ORACLE_HOME/rdbms/admin
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH TNS_ADMIN SQLPATH
export ORACLE_BASE ORACLE_HOME ORA_NLS33 ORACLE_SID PATH LD_LIBRARY_PATH CLASSPATH SQLPATH
NLS_DATE_FORMAT=”yyyy-mm-dd hh24:mi:ss”;export NLS_DATE_FORMAT
echo “ “
echo “ “
echo -e “/e[31;1m**/e[0m”
echo -e “/e[31;1mYou login as oracle,Please ask somebody to double check!*/e[0m”
echo -e “/e[31;1m**/e[0m”
echo “ “
echo “ “
export PS1=’/e[31;1m${LOGNAME}@${HOSTNAME}:${PWD}>/e[0m’
alias sql=’sqlplus “/“‘
alias rsql=’rlwrap sqlplus’
alias sqln=”sqlplus /nolog”
alias dba=’sqlplus “/as sysdba”‘
alias ohome=”cd $ORACLE_HOME”
alias rm=’rm -i —‘
alias cp=’cp -i’
alias mv=’mv -i —‘
——————————————————————————————————————————-
UMASK
——————————————————————————————————————————-
Set the default file mode creation mask
(umask) to 022 to ensure that the user performing
the Oracle software installation creates files
with 644 permissions
——————————————————————————————————————————
umask 022
stty erase ^H
[oracle@rac2 ~]$ source ~/.bash_profile
You login as oracle,Please ask somebody to double check!*
oracle@rac2:/home/oracle>
8、配置共享存储(root用户)
—-在rac1上执行如下
以下脚本生成asm-disk设备,并追加到99-oracle-asmdevices.rules的规则文件内:
for i in b c d e f g ;
do
echo “KERNEL==/”sd/”, BUS==/”scsi/”, PROGRAM==/”/sbin/scsi_id —whitelisted —replace-whitespace —device=/dev//$name/”, RESULT==/”/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i/”, NAME=/”asm-disk$i/”, OWNER=/”grid/”, GROUP=/”asmadmin/”, MODE=/”0660/”” >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
[root@rac1 scripts]# for i in b c d e f g ;
do
echo “KERNEL==/”sd/”, BUS==/”scsi/”, PROGRAM==/”/sbin/scsi_id —whitelisted —replace-whitespace —device=/dev//$name/”, RESULT==/”/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i/”, NAME=/”asm-disk$i/”, OWNER=/”grid/”, GROUP=/”asmadmin/”, MODE=/”0660/”” >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
[root@rac1 scripts]# start_udev
Starting udev: [ OK ]
[root@rac1 scripts]# ls /dev/asm-disk —-验证是否生成
/dev/asm-diskb /dev/asm-diskc /dev/asm-diskd /dev/asm-diske
[root@rac1 scripts]# cd /etc/udev/rules.d/
—-传送到rac2
[root@rac1 rules.d]# scp 99-oracle-asmdevices.rules root@172.16.10.52:/etc/udev/rules.d/99-oracle-asmdevices.rules
root@172.16.10.52’s password:
99-oracle-asmdevices.rules 100% 1230 1.2KB/s 00:00
—开启并验证
[root@rac2 scripts]# start_udev
Starting udev: [ OK ]
[root@rac2 scripts]# ls /dev/asm* ——验证是否生成
/dev/asm-diskb /dev/asm-diskc /dev/asm-diskd /dev/asm-diske
9、rac1、rac2互信(grid用户两节点互信以及oracle用户两节点互信分别登陆)
RAC1:GRID用户
grid@rac1:/home/grid>mkdir ~/.ssh
mkdir: cannot create directory `/home/grid/.ssh’: File exists
grid@rac1:/home/grid>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_rsa.
Your public key has been saved in /home/grid/.ssh/id_rsa.pub.
The key fingerprint is:
55:88:9d:b9:87:c0:2b:91:e5:3a:87:49:91:51:f7:4d grid@rac1
The key’s randomart image is:
+—[ RSA 2048]——+
| oBoo.+. E |
| +o+.=o o |
| …o.o. . |
| ..+..o . |
| =.S . |
| o |
| |
| |
| |
+————————-+
grid@rac1:/home/grid>ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_dsa.
Your public key has been saved in /home/grid/.ssh/id_dsa.pub.
The key fingerprint is:
11:65:17:a8:99:ae:f7:ca:86:71:6c:c4:50:f4:05:20 grid@rac1
The key’s randomart image is:
+—[ DSA 1024]——+
| Eo=o+o+. |
| .. +.o |
| o.+. |
| . |
| +S |
| . = |
| |
| o.o |
| ooo. |
+————————-+
RAC2:GRID用户
grid@rac2:/home/grid>mkdir ~/.ssh
grid@rac2:/home/grid>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_rsa.
Your public key has been saved in /home/grid/.ssh/id_rsa.pub.
The key fingerprint is:
49:be:e8:c2:ee:f2:eb:ef:7c:df:b7:10:b4:03:f7:c7 grid@rac2
The key’s randomart image is:
+—[ RSA 2048]——+
| |
| |
| . . o |
| o . + o . |
| S + . E|
| . . o . |
| . . . . |
| . oo . . .. |
| **==. .. …. |
+————————-+
grid@rac2:/home/grid>ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_dsa.
Your public key has been saved in /home/grid/.ssh/id_dsa.pub.
The key fingerprint is:
a8:c0:74:6b:85:bd:81:27:ba:b6:49:21:6c:cb:6f:80 grid@rac2
The key’s randomart image is:
+—[ DSA 1024]——+
| |
| + |
| . = = |
|.o o = + |
|oo= o o S |
|Eo.= . |
| o= . |
| o.+ |
| +. |
+————————-+
—-GRID用户互信验证
RAC1:
grid@rac1:/home/grid>cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
grid@rac1:/home/grid>cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
grid@rac1:/home/grid>ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
grid@rac1:/home/grid>ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
grid@rac1:/home/grid>ssh rac1 date
Wed Aug 9 14:19:35 CST 2017
grid@rac1:/home/grid>ssh rac2 date
Wed Aug 9 14:19:38 CST 2017
grid@rac1:/home/grid>ssh rac2-priv date
Wed Aug 9 14:19:42 CST 2017
grid@rac1:/home/grid>ssh rac1-priv date
The authenticity of host ‘rac1-priv (1.1.1.1)’ can’t be established.
RSA key fingerprint is b8:09:fb:58:15:a4:fd:2d:18:51:be:61:2b:ff:bc:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac1-priv,1.1.1.1’ (RSA) to the list of known hosts.
Wed Aug 9 14:19:47 CST 2017
grid@rac1:/home/grid>ssh rac1-priv date
Wed Aug 9 14:19:49 CST 2017
RAC2:
grid@rac1:/home/grid>cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
grid@rac1:/home/grid>cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
grid@rac1:/home/grid>ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
grid@rac1:/home/grid>ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
grid@rac1:/home/grid>ssh rac1 date
Wed Aug 9 14:19:35 CST 2017
grid@rac1:/home/grid>ssh rac2 date
Wed Aug 9 14:19:38 CST 2017
grid@rac1:/home/grid>ssh rac2-priv date
Wed Aug 9 14:19:42 CST 2017
grid@rac1:/home/grid>ssh rac1-priv date
The authenticity of host ‘rac1-priv (1.1.1.1)’ can’t be established.
RSA key fingerprint is b8:09:fb:58:15:a4:fd:2d:18:51:be:61:2b:ff:bc:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac1-priv,1.1.1.1’ (RSA) to the list of known hosts.
Wed Aug 9 14:19:47 CST 2017
grid@rac1:/home/grid>ssh rac1-priv date
Wed Aug 9 14:19:49 CST 2017
ORACLE用户:
RAC1
oracle@rac1:/home/oracle>mkdir ~/.ssh
oracle@rac1:/home/oracle>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ssh-keygen -t dsa .
Your public key has been saved in ssh-keygen -t dsa .pub.
The key fingerprint is:
6e:14:c6:58:5c:a7:17:a8:16:4c:4a:11:5b:6a:f2:8e oracle@rac1
The key’s randomart image is:
+—[ RSA 2048]——+
| ++…o |
| . O+ .o . |
| . +o. . |
| + .o. . |
| ..S |
| o o |
| E . o |
| . |
| |
+————————-+
oracle@rac1:/home/oracle>ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
24:f8:62:ac:1f:b2:ec:cd:72:36:5f:f8:86:65:1e:0c oracle@rac1
The key’s randomart image is:
+—[ DSA 1024]——+
| |
| . |
| . . . |
| . .Eo |
| + .oS |
| o . .= |
| o . .=.. |
| ..*+..oo |
| .+++o… |
+————————-+
RAC2:
oracle@rac2:/home/oracle>mkdir ~/.ssh
oracle@rac2:/home/oracle>ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in ssh-keygen -t dsa .
Your public key has been saved in ssh-keygen -t dsa .pub.
The key fingerprint is:
5a:1c:3f:d8:49:86:f5:4a:3a:66:c5:52:14:4d:8d:f5 oracle@rac2
The key’s randomart image is:
+—[ RSA 2048]——+
| .=+.+. |
| = .o .. |
| + . E|
| . % o |
| S |
| = . . |
| . |
| |
| |
+————————-+
oracle@rac2:/home/oracle>ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
c1:73:5b:1f:80:28:d3:f6:fb:6a:a1:19:6d:15:cc:7b oracle@rac2
The key’s randomart image is:
+—[ DSA 1024]——+
| . . +. |
| o.+ . +. |
| ++.. .o. |
| +.oo.E. |
| S..o .. |
| . = |
| = o |
| o . . |
| … |
+————————-+
RAC1:
oracle@rac1:/home/oracle>cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
oracle@rac1:/home/oracle>cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
oracle@rac1:/home/oracle>ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
oracle@rac2’s password:
oracle@rac1:/home/oracle>ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@rac2’s password:
oracle@rac1:/home/oracle>
RAC2:
oracle@rac2:/home/oracle>cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
oracle@rac2:/home/oracle>cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
oracle@rac2:/home/oracle>ssh rac1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
oracle@rac2:/home/oracle>ssh rac1 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
—-ORACLE用户互信验证
RAC1:
oracle@rac1:/home/oracle>ssh rac1 date
The authenticity of host ‘rac1 (172.16.10.51)’ can’t be established.
RSA key fingerprint is b8:09:fb:58:15:a4:fd:2d:18:51:be:61:2b:ff:bc:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac1,172.16.10.51’ (RSA) to the list of known hosts.
Wed Aug 9 14:29:46 CST 2017
oracle@rac1:/home/oracle>ssh rac1 date
Wed Aug 9 14:29:48 CST 2017
oracle@rac1:/home/oracle>ssh rac2 date
Wed Aug 9 14:29:51 CST 2017
oracle@rac1:/home/oracle>ssh rac2-priv date
The authenticity of host ‘rac2-priv (1.1.1.2)’ can’t be established.
RSA key fingerprint is c2:32:ab:f4:3c:ee:c2:c3:8c:be:ea:c9:b8:e3:ff:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac2-priv,1.1.1.2’ (RSA) to the list of known hosts.
Wed Aug 9 14:29:56 CST 2017
oracle@rac1:/home/oracle>ssh rac2-priv date
Wed Aug 9 14:29:58 CST 2017
oracle@rac1:/home/oracle>ssh rac1-priv date
The authenticity of host ‘rac1-priv (1.1.1.1)’ can’t be established.
RSA key fingerprint is b8:09:fb:58:15:a4:fd:2d:18:51:be:61:2b:ff:bc:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac1-priv,1.1.1.1’ (RSA) to the list of known hosts.
Wed Aug 9 14:30:03 CST 2017
oracle@rac1:/home/oracle>ssh rac1-priv date
Wed Aug 9 14:30:05 CST 2017
oracle@rac1:/home/oracle>
RAC2:
oracle@rac2:/home/oracle>ssh rac1 date
Wed Aug 9 14:30:33 CST 2017
oracle@rac2:/home/oracle>ssh rac2 date
The authenticity of host ‘rac2 (172.16.10.52)’ can’t be established.
RSA key fingerprint is c2:32:ab:f4:3c:ee:c2:c3:8c:be:ea:c9:b8:e3:ff:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac2,172.16.10.52’ (RSA) to the list of known hosts.
Wed Aug 9 14:30:37 CST 2017
oracle@rac2:/home/oracle>ssh rac2 date
Wed Aug 9 14:30:39 CST 2017
oracle@rac2:/home/oracle>ssh rac2-priv date
The authenticity of host ‘rac2-priv (1.1.1.2)’ can’t be established.
RSA key fingerprint is c2:32:ab:f4:3c:ee:c2:c3:8c:be:ea:c9:b8:e3:ff:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac2-priv,1.1.1.2’ (RSA) to the list of known hosts.
Wed Aug 9 14:30:46 CST 2017
oracle@rac2:/home/oracle>ssh rac2-priv date
Wed Aug 9 14:30:47 CST 2017
oracle@rac2:/home/oracle>ssh rac1-priv date
The authenticity of host ‘rac1-priv (1.1.1.1)’ can’t be established.
RSA key fingerprint is b8:09:fb:58:15:a4:fd:2d:18:51:be:61:2b:ff:bc:04.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac1-priv,1.1.1.1’ (RSA) to the list of known hosts.
Wed Aug 9 14:30:52 CST 2017
oracle@rac2:/home/oracle>ssh rac1-priv date
Wed Aug 9 14:30:54 CST 2017
10、上传安装软件grid,并切换用户grid解压
$ cd 软件解压路径中的sshUserSetup
—-验证两节点
grid@rac1:/g01/soft/grid>cd sshsetup/
grid@rac1:/g01/soft/grid/sshsetup>ls
sshUserSetup.sh
grid@rac1:/g01/soft/grid/sshsetup>./sshUserSetup.sh -user grid -hosts “rac1 rac2” -noPromptPassphrase -confirm -advanced
The output of this script is also logged into /tmp/sshUserSetup_2017-08-09-14-37-08.log
Hosts are rac1 rac2
user is grid
Platform:- Linux
Checking if the remote hosts are reachable
PING rac1 (172.16.10.51) 56(84) bytes of data.
64 bytes from rac1 (172.16.10.51): icmp_seq=1 ttl=64 time=0.014 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=2 ttl=64 time=0.018 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=3 ttl=64 time=0.019 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=4 ttl=64 time=0.020 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=5 ttl=64 time=0.020 ms
—- rac1 ping statistics —-
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.014/0.018/0.020/0.003 ms
PING rac2 (172.16.10.52) 56(84) bytes of data.
64 bytes from rac2 (172.16.10.52): icmp_seq=1 ttl=64 time=0.343 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=2 ttl=64 time=0.210 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=3 ttl=64 time=0.197 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=4 ttl=64 time=0.200 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=5 ttl=64 time=0.201 ms
—- rac2 ping statistics —-
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.197/0.230/0.343/0.057 ms
Remote host reachability check succeeded.
The following hosts are reachable: rac1 rac2.
The following hosts are not reachable: .
All hosts are reachable. Proceeding further…
firsthost rac1
numhosts 2
The script will setup SSH connectivity from the host rac1 to all
the remote hosts. After the script is executed, the user can use SSH to run
commands on the remote hosts or copy files between this host rac1
and the remote hosts without being prompted for passwords or confirmations.
NOTE 1:
As part of the setup procedure, this script will use ssh and scp to copy
files between the local host and the remote hosts. Since the script does not
store passwords, you may be prompted for the passwords during the execution of
the script whenever ssh or scp is invoked.
NOTE 2:
AS PER SSH REQUIREMENTS, THIS SCRIPT WILL SECURE THE USER HOME DIRECTORY
AND THE .ssh DIRECTORY BY REVOKING GROUP AND WORLD WRITE PRIVILEDGES TO THESE
directories.
Do you want to continue and let the script make the above mentioned changes (yes/no)?
Confirmation provided on the command line
The user chose yes
User chose to skip passphrase related questions.
Creating .ssh directory on local host, if not present already
Creating authorized_keys file on local host
Changing permissions on authorized_keys to 644 on local host
Creating known_hosts file on local host
Changing permissions on known_hosts to 644 on local host
Creating config file on local host
If a config file exists already at /home/grid/.ssh/config, it would be backed up to /home/grid/.ssh/config.backup.
Creating .ssh directory and setting permissions on remote host rac1
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR grid. THIS IS AN SSH REQUIREMENT.
The script would create ~grid/.ssh/config file on remote host rac1. If a config file exists already at ~grid/.ssh/config, it would be backed up to ~grid/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host rac1.
Warning: Permanently added ‘rac1,172.16.10.51’ (RSA) to the list of known hosts.
grid@rac1’s password:
Done with creating .ssh directory and setting permissions on remote host rac1.
Creating .ssh directory and setting permissions on remote host rac2
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR grid. THIS IS AN SSH REQUIREMENT.
The script would create ~grid/.ssh/config file on remote host rac2. If a config file exists already at ~grid/.ssh/config, it would be backed up to ~grid/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host rac2.
Warning: Permanently added ‘rac2,172.16.10.52’ (RSA) to the list of known hosts.
Done with creating .ssh directory and setting permissions on remote host rac2.
Copying local host public key to the remote host rac1
The user may be prompted for a password or passphrase here since the script would be using SCP for host rac1.
grid@rac1’s password:
Done copying local host public key to the remote host rac1
Copying local host public key to the remote host rac2
The user may be prompted for a password or passphrase here since the script would be using SCP for host rac2.
Done copying local host public key to the remote host rac2
Creating keys on remote host rac1 if they do not exist already. This is required to setup SSH on host rac1.
Creating keys on remote host rac2 if they do not exist already. This is required to setup SSH on host rac2.
Updating authorized_keys file on remote host rac1
Updating known_hosts file on remote host rac1
Updating authorized_keys file on remote host rac2
Updating known_hosts file on remote host rac2
cat: /home/grid/.ssh/known_hosts.tmp: No such file or directory
cat: /home/grid/.ssh/authorized_keys.tmp: No such file or directory
SSH setup is complete.
Verifying SSH setup
The script will now run the date command on the remote nodes using ssh
to verify if ssh is setup correctly. IF THE SETUP IS CORRECTLY SETUP,
THERE SHOULD BE NO OUTPUT OTHER THAN THE DATE AND SSH SHOULD NOT ASK FOR
PASSWORDS. If you see any output other than date or are prompted for the
password, ssh is not setup correctly and you will need to resolve the
issue and set up ssh again.
The possible causes for failure could be:
- The server settings in /etc/ssh/sshd_config file do not allow ssh
for user grid. - The server may have disabled public key based authentication.
- The client public key on the server may be outdated.
- ~grid or ~grid/.ssh on the remote host may not be owned by grid.
- User may not have passed -shared option for shared remote users or
may be passing the -shared option for non-shared remote users. - If there is output in addition to the date, but no password is asked,
it may be a security alert shown as part of company policy. Append the
additional text to the <OMS HOME>/sysman/prov/resources/ignoreMessages.txt file.
—rac1:—
Running /usr/bin/ssh -x -l grid rac1 date to verify SSH connectivity has been setup from local host to rac1.
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL. Please note that being prompted for a passphrase may be OK but being prompted for a password is ERROR.
Wed Aug 9 14:37:30 CST 2017
—rac2:—
Running /usr/bin/ssh -x -l grid rac2 date to verify SSH connectivity has been setup from local host to rac2.
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL. Please note that being prompted for a passphrase may be OK but being prompted for a password is ERROR.
Wed Aug 9 14:37:30 CST 2017
Verifying SSH connectivity has been setup from rac1 to rac1
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL.
bash: -c: line 0: unexpected EOF while looking for matching `”‘
bash: -c: line 1: syntax error: unexpected end of file
Verifying SSH connectivity has been setup from rac1 to rac2
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL.
bash: -c: line 0: unexpected EOF while looking for matching `”‘
bash: -c: line 1: syntax error: unexpected end of file
-Verification from complete-
SSH verification complete.
—-校验环境
grid@rac1:/g01/soft/grid>./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -verbose
Performing pre-checks for cluster services setup
Checking node reachability…
Check: Node reachability from node “rac1”
Destination Node Reachable?
rac2 yes
rac1 yes
Result: Node reachability check passed from node “rac1”
Checking user equivalence…
Check: User equivalence for user “grid”
Node Name Status
rac2 passed
rac1 passed
Result: User equivalence check passed for user “grid”
Checking node connectivity…
Checking hosts config file…
Node Name Status
rac2 passed
rac1 passed
Verification of the hosts config file successful
Interface information for node “rac2”
Name IP Address Subnet Gateway Def. Gateway HW Address MTU
eth0 172.16.10.52 172.16.10.0 0.0.0.0 172.16.10.254 52:54:00:6D:50:B8 1500
eth1 1.1.1.2 1.1.1.0 0.0.0.0 172.16.10.254 52:54:00:EF:BE:90 1500
Interface information for node “rac1”
Name IP Address Subnet Gateway Def. Gateway HW Address MTU
eth0 172.16.10.51 172.16.10.0 0.0.0.0 172.16.10.254 52:54:00:8B:10:77 1500
eth1 1.1.1.1 1.1.1.0 0.0.0.0 172.16.10.254 52:54:00:E9:B0:87 1500
Check: Node connectivity of subnet “172.16.10.0”
Source Destination Connected?
rac2[172.16.10.52] rac1[172.16.10.51] yes
Result: Node connectivity passed for subnet “172.16.10.0” with node(s) rac2,rac1
Check: TCP connectivity of subnet “172.16.10.0”
Source Destination Connected?
rac1:172.16.10.51 rac2:172.16.10.52 passed
Result: TCP connectivity check passed for subnet “172.16.10.0”
Check: Node connectivity of subnet “1.1.1.0”
Source Destination Connected?
rac2[1.1.1.2] rac1[1.1.1.1] yes
Result: Node connectivity passed for subnet “1.1.1.0” with node(s) rac2,rac1
Check: TCP connectivity of subnet “1.1.1.0”
Source Destination Connected?
rac1:1.1.1.1 rac2:1.1.1.2 passed
Result: TCP connectivity check passed for subnet “1.1.1.0”
Interfaces found on subnet “172.16.10.0” that are likely candidates for VIP are:
rac2 eth0:172.16.10.52
rac1 eth0:172.16.10.51
Interfaces found on subnet “1.1.1.0” that are likely candidates for VIP are:
rac2 eth1:1.1.1.2
rac1 eth1:1.1.1.1
WARNING:
Could not find a suitable set of interfaces for the private interconnect
Checking subnet mask consistency…
Subnet mask consistency check passed for subnet “172.16.10.0”.
Subnet mask consistency check passed for subnet “1.1.1.0”.
Subnet mask consistency check passed.
Result: Node connectivity check passed
Checking multicast communication…
Checking subnet “172.16.10.0” for multicast communication with multicast group “230.0.1.0”…
Check of subnet “172.16.10.0” for multicast communication with multicast group “230.0.1.0” passed.
Checking subnet “1.1.1.0” for multicast communication with multicast group “230.0.1.0”…
Check of subnet “1.1.1.0” for multicast communication with multicast group “230.0.1.0” passed.
Check of multicast communication passed.
Checking ASMLib configuration.
Node Name Status
rac2 passed
rac1 passed
Result: Check for ASMLib configuration passed.
Check: Total memory
Node Name Available Required Status
rac2 1.7044GB (1787216.0KB) 1.5GB (1572864.0KB) passed
rac1 1.7044GB (1787216.0KB) 1.5GB (1572864.0KB) passed
Result: Total memory check passed
Check: Available memory
Node Name Available Required Status
rac2 1.5448GB (1619884.0KB) 50MB (51200.0KB) passed
rac1 1.4903GB (1562712.0KB) 50MB (51200.0KB) passed
Result: Available memory check passed
Check: Swap space
Node Name Available Required Status
rac2 3.9375GB (4128764.0KB) 2.5566GB (2680824.0KB) passed
rac1 3.9375GB (4128764.0KB) 2.5566GB (2680824.0KB) passed
Result: Swap space check passed
Check: Free disk space for “rac2:/tmp”
Path Node Name Mount point Available Required Status
/tmp rac2 / 38.5586GB 1GB passed
Result: Free disk space check passed for “rac2:/tmp”
Check: Free disk space for “rac1:/tmp”
Path Node Name Mount point Available Required Status
/tmp rac1 / 37.2788GB 1GB passed
Result: Free disk space check passed for “rac1:/tmp”
Check: User existence for “grid”
Node Name Status Comment
rac2 passed exists(500)
rac1 passed exists(500)
Checking for multiple users with UID value 500
Result: Check for multiple users with UID value 500 passed
Result: User existence check passed for “grid”
Check: Group existence for “oinstall”
Node Name Status Comment
rac2 passed exists
rac1 passed exists
Result: Group existence check passed for “oinstall”
Check: Group existence for “dba”
Node Name Status Comment
rac2 passed exists
rac1 passed exists
Result: Group existence check passed for “dba”
Check: Membership of user “grid” in group “oinstall” [as Primary]
Node Name User Exists Group Exists User in Group Primary Status
rac2 yes yes yes yes passed
rac1 yes yes yes yes passed
Result: Membership check for user “grid” in group “oinstall” [as Primary] passed
Check: Membership of user “grid” in group “dba”
Node Name User Exists Group Exists User in Group Status
rac2 yes yes yes passed
rac1 yes yes yes passed
Result: Membership check for user “grid” in group “dba” passed
Check: Run level
Node Name run level Required Status
rac2 3 3,5 passed
rac1 3 3,5 passed
Result: Run level check passed
Check: Hard limits for “maximum open file descriptors”
Node Name Type Available Required Status
rac2 hard 65536 65536 passed
rac1 hard 65536 65536 passed
Result: Hard limits check passed for “maximum open file descriptors”
Check: Soft limits for “maximum open file descriptors”
Node Name Type Available Required Status
rac2 soft 1024 1024 passed
rac1 soft 1024 1024 passed
Result: Soft limits check passed for “maximum open file descriptors”
Check: Hard limits for “maximum user processes”
Node Name Type Available Required Status
rac2 hard 16384 16384 passed
rac1 hard 16384 16384 passed
Result: Hard limits check passed for “maximum user processes”
Check: Soft limits for “maximum user processes”
Node Name Type Available Required Status
rac2 soft 2047 2047 passed
rac1 soft 2047 2047 passed
Result: Soft limits check passed for “maximum user processes”
Check: System architecture
Node Name Available Required Status
rac2 x86_64 x86_64 passed
rac1 x86_64 x86_64 passed
Result: System architecture check passed
Check: Kernel version
Node Name Available Required Status
rac2 3.8.13-44.1.1.el6uek.x86_64 2.6.32 passed
rac1 3.8.13-44.1.1.el6uek.x86_64 2.6.32 passed
Result: Kernel version check passed
Check: Kernel parameter for “semmsl”
Node Name Current Configured Required Status Comment
rac2 250 250 250 passed
rac1 250 250 250 passed
Result: Kernel parameter check passed for “semmsl”
Check: Kernel parameter for “semmns”
Node Name Current Configured Required Status Comment
rac2 32000 32000 32000 passed
rac1 32000 32000 32000 passed
Result: Kernel parameter check passed for “semmns”
Check: Kernel parameter for “semopm”
Node Name Current Configured Required Status Comment
rac2 100 100 100 passed
rac1 100 100 100 passed
Result: Kernel parameter check passed for “semopm”
Check: Kernel parameter for “semmni”
Node Name Current Configured Required Status Comment
rac2 128 128 128 passed
rac1 128 128 128 passed
Result: Kernel parameter check passed for “semmni”
Check: Kernel parameter for “shmmax”
Node Name Current Configured Required Status Comment
rac2 915054592 915054592 915054592 passed
rac1 915054592 915054592 915054592 passed
Result: Kernel parameter check failed for “shmmax”
Check: Kernel parameter for “shmmni”
Node Name Current Configured Required Status Comment
rac2 4096 4096 4096 passed
rac1 4096 4096 4096 passed
Result: Kernel parameter check passed for “shmmni”
Check: Kernel parameter for “shmall”
Node Name Current Configured Required Status Comment
rac2 2097152 2097152 2097152 passed
rac1 2097152 2097152 2097152 passed
Result: Kernel parameter check passed for “shmall”
Check: Kernel parameter for “file-max”
Node Name Current Configured Required Status Comment
rac2 6815744 6815744 6815744 passed
rac1 6815744 6815744 6815744 passed
Result: Kernel parameter check passed for “file-max”
Check: Kernel parameter for “ip_local_port_range”
Node Name Current Configured Required Status Comment
rac2 between 9000.0 & 65000.0 between 9000.0 & 65000.0 between 9000.0 & 65500.0 passed
rac1 between 9000.0 & 65000.0 between 9000.0 & 65000.0 between 9000.0 & 65500.0 passed
Result: Kernel parameter check passed for “ip_local_port_range”
Check: Kernel parameter for “rmem_default”
Node Name Current Configured Required Status Comment
rac2 262144 262144 262144 passed
rac1 262144 262144 262144 passed
Result: Kernel parameter check passed for “rmem_default”
Check: Kernel parameter for “rmem_max”
Node Name Current Configured Required Status Comment
rac2 4194304 4194304 4194304 passed
rac1 4194304 4194304 4194304 passed
Result: Kernel parameter check passed for “rmem_max”
Check: Kernel parameter for “wmem_default”
Node Name Current Configured Required Status Comment
rac2 262144 262144 262144 passed
rac1 262144 262144 262144 passed
Result: Kernel parameter check passed for “wmem_default”
Check: Kernel parameter for “wmem_max”
Node Name Current Configured Required Status Comment
rac2 1048586 1048586 1048576 passed
rac1 1048586 1048586 1048576 passed
Result: Kernel parameter check passed for “wmem_max”
Check: Kernel parameter for “aio-max-nr”
Node Name Current Configured Required Status Comment
rac2 1048576 1048576 1048576 passed
rac1 1048576 1048576 1048576 passed
Result: Kernel parameter check passed for “aio-max-nr”
Check: Package existence for “binutils”
Node Name Available Required Status
rac2 binutils-2.20.51.0.2-5.42.el6 binutils-2.20.51.0.2 passed
rac1 binutils-2.20.51.0.2-5.42.el6 binutils-2.20.51.0.2 passed
Result: Package existence check passed for “binutils”
Check: Package existence for “compat-libcap1”
Node Name Available Required Status
rac2 compat-libcap1-1.10-1 compat-libcap1-1.10 passed
rac1 compat-libcap1-1.10-1 compat-libcap1-1.10 passed
Result: Package existence check passed for “compat-libcap1”
Check: Package existence for “compat-libstdc++-33(x86_64)”
Node Name Available Required Status
rac2 compat-libstdc++-33(x86_64)-3.2.3-69.el6 compat-libstdc++-33(x86_64)-3.2.3 passed
rac1 compat-libstdc++-33(x86_64)-3.2.3-69.el6 compat-libstdc++-33(x86_64)-3.2.3 passed
Result: Package existence check passed for “compat-libstdc++-33(x86_64)”
Check: Package existence for “libgcc(x86_64)”
Node Name Available Required Status
rac2 libgcc(x86_64)-4.4.7-11.el6 libgcc(x86_64)-4.4.4 passed
rac1 libgcc(x86_64)-4.4.7-11.el6 libgcc(x86_64)-4.4.4 passed
Result: Package existence check passed for “libgcc(x86_64)”
Check: Package existence for “libstdc++(x86_64)”
Node Name Available Required Status
rac2 libstdc++(x86_64)-4.4.7-11.el6 libstdc++(x86_64)-4.4.4 passed
rac1 libstdc++(x86_64)-4.4.7-11.el6 libstdc++(x86_64)-4.4.4 passed
Result: Package existence check passed for “libstdc++(x86_64)”
Check: Package existence for “libstdc++-devel(x86_64)”
Node Name Available Required Status
rac2 libstdc++-devel(x86_64)-4.4.7-11.el6 libstdc++-devel(x86_64)-4.4.4 passed
rac1 libstdc++-devel(x86_64)-4.4.7-11.el6 libstdc++-devel(x86_64)-4.4.4 passed
Result: Package existence check passed for “libstdc++-devel(x86_64)”
Check: Package existence for “sysstat”
Node Name Available Required Status
rac2 sysstat-9.0.4-27.el6 sysstat-9.0.4 passed
rac1 sysstat-9.0.4-27.el6 sysstat-9.0.4 passed
Result: Package existence check passed for “sysstat”
Check: Package existence for “gcc”
Node Name Available Required Status
rac2 gcc-4.4.7-11.el6 gcc-4.4.4 passed
rac1 gcc-4.4.7-11.el6 gcc-4.4.4 passed
Result: Package existence check passed for “gcc”
Check: Package existence for “gcc-c++”
Node Name Available Required Status
rac2 gcc-c++-4.4.7-11.el6 gcc-c++-4.4.4 passed
rac1 gcc-c++-4.4.7-11.el6 gcc-c++-4.4.4 passed
Result: Package existence check passed for “gcc-c++”
Check: Package existence for “ksh”
Node Name Available Required Status
rac2 ksh-20120801-21.el6 ksh-20100621 passed
rac1 ksh-20120801-21.el6 ksh-20100621 passed
Result: Package existence check passed for “ksh”
Check: Package existence for “make”
Node Name Available Required Status
rac2 make-3.81-20.el6 make-3.81 passed
rac1 make-3.81-20.el6 make-3.81 passed
Result: Package existence check passed for “make”
Check: Package existence for “glibc(x86_64)”
Node Name Available Required Status
rac2 glibc(x86_64)-2.12-1.149.el6 glibc(x86_64)-2.12 passed
rac1 glibc(x86_64)-2.12-1.149.el6 glibc(x86_64)-2.12 passed
Result: Package existence check passed for “glibc(x86_64)”
Check: Package existence for “glibc-devel(x86_64)”
Node Name Available Required Status
rac2 glibc-devel(x86_64)-2.12-1.149.el6 glibc-devel(x86_64)-2.12 passed
rac1 glibc-devel(x86_64)-2.12-1.149.el6 glibc-devel(x86_64)-2.12 passed
Result: Package existence check passed for “glibc-devel(x86_64)”
Check: Package existence for “libaio(x86_64)”
Node Name Available Required Status
rac2 libaio(x86_64)-0.3.107-10.el6 libaio(x86_64)-0.3.107 passed
rac1 libaio(x86_64)-0.3.107-10.el6 libaio(x86_64)-0.3.107 passed
Result: Package existence check passed for “libaio(x86_64)”
Check: Package existence for “libaio-devel(x86_64)”
Node Name Available Required Status
rac2 libaio-devel(x86_64)-0.3.107-10.el6 libaio-devel(x86_64)-0.3.107 passed
rac1 libaio-devel(x86_64)-0.3.107-10.el6 libaio-devel(x86_64)-0.3.107 passed
Result: Package existence check passed for “libaio-devel(x86_64)”
Checking for multiple users with UID value 0
Result: Check for multiple users with UID value 0 passed
Check: Current group ID
Result: Current group ID check passed
Starting check for consistency of primary group of root user
Node Name Status
rac2 passed
rac1 passed
Check for consistency of root user’s primary group passed
Starting Clock synchronization checks using Network Time Protocol(NTP)…
NTP Configuration file check started…
Network Time Protocol(NTP) configuration file not found on any of the nodes. Oracle Cluster Time Synchronization Service(CTSS) can be used instead of NTP for time synchronization on the cluster nodes
No NTP Daemons or Services were found to be running
Result: Clock synchronization check using Network Time Protocol(NTP) passed
Checking Core file name pattern consistency…
Core file name pattern consistency check passed.
Checking to make sure user “grid” is not in “root” group
Node Name Status Comment
rac2 passed does not exist
rac1 passed does not exist
Result: User “grid” is not part of “root” group. Check passed
Check default user file creation mask
Node Name Available Required Comment
rac2 0022 0022 passed
rac1 0022 0022 passed
Result: Default user file creation mask check passed
Checking consistency of file “/etc/resolv.conf” across nodes
Checking the file “/etc/resolv.conf” to make sure only one of domain and search entries is defined
File “/etc/resolv.conf” does not have both domain and search entries defined
Checking if domain entry in file “/etc/resolv.conf” is consistent across the nodes…
domain entry in file “/etc/resolv.conf” is consistent across nodes
Checking if search entry in file “/etc/resolv.conf” is consistent across the nodes…
search entry in file “/etc/resolv.conf” is consistent across nodes
Checking DNS response time for an unreachable node
Node Name Status
rac2 failed
rac1 failed
PRVF-5636 : The DNS response time for an unreachable node exceeded “15000” ms on following nodes: rac2,rac1
File “/etc/resolv.conf” is not consistent across nodes
Check: Time zone consistency
Result: Time zone consistency check passed
Pre-check for cluster services setup was unsuccessful on all the nodes.
——安装RPM包
[root@rac1 .vnc]# rpm -ivh /g01/soft/grid/rpm/cvuqdisk-1.0.9-1.rpm
Preparing… ########################################### [100%]
Using default group oinstall to install package
1:cvuqdisk ########################################### [100%]
—传送到rac2节点节点安装
[root@rac1 .vnc]# scp /g01/soft/grid/rpm/cvuqdisk-1.0.9-1.rpm
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 … [[user@]host2:]file2
[root@rac1 .vnc]# scp /g01/soft/grid/rpm/cvuqdisk-1.0.9-1.rpm rac2:/g01
The authenticity of host ‘rac2 (172.16.10.52)’ can’t be established.
RSA key fingerprint is c2:32:ab:f4:3c:ee:c2:c3:8c:be:ea:c9:b8:e3:ff:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘rac2’ (RSA) to the list of known hosts.
root@rac2’s password:
cvuqdisk-1.0.9-1.rpm 100% 8288 8.1KB/s 00:00
[root@rac2 g01]# rpm -ivh cvuqdisk-1.0.9-1.rpm
Preparing… ########################################### [100%]
Using default group oinstall to install package
1:cvuqdisk ########################################### [100%]
11、图形安装GI软件;
—-运行脚本/g01/oraInventory/orainstRoot.sh、/g01/app/grid/11.2.0/root.sh
[root@rac1 .vnc]# /g01/oraInventory/orainstRoot.sh
Changing permissions of /g01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /g01/oraInventory to oinstall.
The execution of the script is complete.
[root@rac1 .vnc]#
[root@rac2 g01]# /g01/oraInventory/orainstRoot.sh
Changing permissions of /g01/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /g01/oraInventory to oinstall.
The execution of the script is complete.
[root@rac1 .vnc]# /g01/app/grid/11.2.0/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /g01/app/grid/11.2.0
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …
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: /g01/app/grid/11.2.0/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
root wallet
root wallet cert
root cert export
peer wallet
profile reader wallet
pa wallet
peer wallet keys
pa wallet keys
peer cert request
pa cert request
peer cert
pa cert
peer root cert TP
profile reader root cert TP
pa root cert TP
peer pa cert TP
pa peer cert TP
profile reader pa cert TP
profile reader peer cert TP
peer user cert
pa user cert
Adding Clusterware entries to upstart
CRS-2672: Attempting to start ‘ora.mdnsd’ on ‘rac1’
CRS-2676: Start of ‘ora.mdnsd’ on ‘rac1’ succeeded
CRS-2672: Attempting to start ‘ora.gpnpd’ on ‘rac1’
CRS-2676: Start of ‘ora.gpnpd’ on ‘rac1’ succeeded
CRS-2672: Attempting to start ‘ora.cssdmonitor’ on ‘rac1’
CRS-2672: Attempting to start ‘ora.gipcd’ on ‘rac1’
CRS-2676: Start of ‘ora.cssdmonitor’ on ‘rac1’ succeeded
CRS-2676: Start of ‘ora.gipcd’ on ‘rac1’ succeeded
CRS-2672: Attempting to start ‘ora.cssd’ on ‘rac1’
CRS-2672: Attempting to start ‘ora.diskmon’ on ‘rac1’
CRS-2676: Start of ‘ora.diskmon’ on ‘rac1’ succeeded
CRS-2676: Start of ‘ora.cssd’ on ‘rac1’ succeeded
ASM created and started successfully.
Disk Group OCRVOTE created successfully.
clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root’, privgrp ‘root’..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 5b6e3c1581064ff6bf6d1954581874f2.
Successfully replaced voting disk group with +OCRVOTE.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
STATE File Universal Id File Name Disk group
- ONLINE 5b6e3c1581064ff6bf6d1954581874f2 (/dev/asm-diskb) [OCRVOTE]
Located 1 voting disk(s).
CRS-2672: Attempting to start ‘ora.asm’ on ‘rac1’
CRS-2676: Start of ‘ora.asm’ on ‘rac1’ succeeded
CRS-2672: Attempting to start ‘ora.OCRVOTE.dg’ on ‘rac1’
CRS-2676: Start of ‘ora.OCRVOTE.dg’ on ‘rac1’ succeeded
Configure Oracle Grid Infrastructure for a Cluster … succeeded
[root@rac2 g01]# /g01/app/grid/11.2.0/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= grid
ORACLE_HOME= /g01/app/grid/11.2.0
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …
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: /g01/app/grid/11.2.0/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
Adding Clusterware entries to upstart
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac1, number 1, and is terminating
An active cluster was found during exclusive startup, restarting to join the cluster
Configure Oracle Grid Infrastructure for a Cluster … succeeded
——图形化安装最后报错
Oracle Cluster Verification Utility failed.可忽略
是由于/etc/hosts内配置了SCAN IP ,导致~
在两个节点相互ping SCAN IP 是否可通。
若通,则可忽略!
—-验证集群是否正常
grid@rac1:/home/grid>crsctl status res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCRVOTE.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
Cluster Resources
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac1
ora.cvu
1 ONLINE ONLINE rac1
ora.oc4j
1 ONLINE ONLINE rac1
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac1
grid@rac2:/home/grid>crsctl status res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.OCRVOTE.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
Cluster Resources
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac1
ora.cvu
1 ONLINE ONLINE rac1
ora.oc4j
1 ONLINE ONLINE rac1
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac1
12、上传安装软件oracle,并切换用户oracle解压
$ cd 软件解压路径中的sshSetup
install readme.html response rpm runInstaller sshsetup stage welcome.html
oracle@rac1:/u01/database>cd sshsetup/
oracle@rac1:/u01/database/sshsetup>ls
sshUserSetup.sh
oracle@rac1:/u01/database/sshsetup>./sshUserSetup.sh -user oracle -hosts “rac1 rac2” -noPromptPassphrase -confirm -advanced
The output of this script is also logged into /tmp/sshUserSetup_2017-08-09-16-31-18.log
Hosts are rac1 rac2
user is oracle
Platform:- Linux
Checking if the remote hosts are reachable
PING rac1 (172.16.10.51) 56(84) bytes of data.
64 bytes from rac1 (172.16.10.51): icmp_seq=1 ttl=64 time=0.014 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=2 ttl=64 time=0.021 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=3 ttl=64 time=0.020 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=4 ttl=64 time=0.021 ms
64 bytes from rac1 (172.16.10.51): icmp_seq=5 ttl=64 time=0.021 ms
—- rac1 ping statistics —-
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 0.014/0.019/0.021/0.004 ms
PING rac2 (172.16.10.52) 56(84) bytes of data.
64 bytes from rac2 (172.16.10.52): icmp_seq=1 ttl=64 time=0.176 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=2 ttl=64 time=0.195 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=3 ttl=64 time=0.127 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=4 ttl=64 time=0.229 ms
64 bytes from rac2 (172.16.10.52): icmp_seq=5 ttl=64 time=0.196 ms
—- rac2 ping statistics —-
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.127/0.184/0.229/0.036 ms
Remote host reachability check succeeded.
The following hosts are reachable: rac1 rac2.
The following hosts are not reachable: .
All hosts are reachable. Proceeding further…
firsthost rac1
numhosts 2
The script will setup SSH connectivity from the host rac1 to all
the remote hosts. After the script is executed, the user can use SSH to run
commands on the remote hosts or copy files between this host rac1
and the remote hosts without being prompted for passwords or confirmations.
NOTE 1:
As part of the setup procedure, this script will use ssh and scp to copy
files between the local host and the remote hosts. Since the script does not
store passwords, you may be prompted for the passwords during the execution of
the script whenever ssh or scp is invoked.
NOTE 2:
AS PER SSH REQUIREMENTS, THIS SCRIPT WILL SECURE THE USER HOME DIRECTORY
AND THE .ssh DIRECTORY BY REVOKING GROUP AND WORLD WRITE PRIVILEDGES TO THESE
directories.
Do you want to continue and let the script make the above mentioned changes (yes/no)?
Confirmation provided on the command line
The user chose yes
User chose to skip passphrase related questions.
Creating .ssh directory on local host, if not present already
Creating authorized_keys file on local host
Changing permissions on authorized_keys to 644 on local host
Creating known_hosts file on local host
Changing permissions on known_hosts to 644 on local host
Creating config file on local host
If a config file exists already at /home/oracle/.ssh/config, it would be backed up to /home/oracle/.ssh/config.backup.
Creating .ssh directory and setting permissions on remote host rac1
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR oracle. THIS IS AN SSH REQUIREMENT.
The script would create ~oracle/.ssh/config file on remote host rac1. If a config file exists already at ~oracle/.ssh/config, it would be backed up to ~oracle/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host rac1.
Warning: Permanently added ‘rac1,172.16.10.51’ (RSA) to the list of known hosts.
oracle@rac1’s password:
Permission denied, please try again.
oracle@rac1’s password:
Done with creating .ssh directory and setting permissions on remote host rac1.
Creating .ssh directory and setting permissions on remote host rac2
THE SCRIPT WOULD ALSO BE REVOKING WRITE PERMISSIONS FOR group AND others ON THE HOME DIRECTORY FOR oracle. THIS IS AN SSH REQUIREMENT.
The script would create ~oracle/.ssh/config file on remote host rac2. If a config file exists already at ~oracle/.ssh/config, it would be backed up to ~oracle/.ssh/config.backup.
The user may be prompted for a password here since the script would be running SSH on host rac2.
Warning: Permanently added ‘rac2,172.16.10.52’ (RSA) to the list of known hosts.
Done with creating .ssh directory and setting permissions on remote host rac2.
Copying local host public key to the remote host rac1
The user may be prompted for a password or passphrase here since the script would be using SCP for host rac1.
oracle@rac1’s password:
Permission denied, please try again.
oracle@rac1’s password:
Done copying local host public key to the remote host rac1
Copying local host public key to the remote host rac2
The user may be prompted for a password or passphrase here since the script would be using SCP for host rac2.
Done copying local host public key to the remote host rac2
Creating keys on remote host rac1 if they do not exist already. This is required to setup SSH on host rac1.
Creating keys on remote host rac2 if they do not exist already. This is required to setup SSH on host rac2.
Updating authorized_keys file on remote host rac1
Updating known_hosts file on remote host rac1
Updating authorized_keys file on remote host rac2
Updating known_hosts file on remote host rac2
cat: /home/oracle/.ssh/known_hosts.tmp: No such file or directory
cat: /home/oracle/.ssh/authorized_keys.tmp: No such file or directory
SSH setup is complete.
Verifying SSH setup
The script will now run the date command on the remote nodes using ssh
to verify if ssh is setup correctly. IF THE SETUP IS CORRECTLY SETUP,
THERE SHOULD BE NO OUTPUT OTHER THAN THE DATE AND SSH SHOULD NOT ASK FOR
PASSWORDS. If you see any output other than date or are prompted for the
password, ssh is not setup correctly and you will need to resolve the
issue and set up ssh again.
The possible causes for failure could be:
- The server settings in /etc/ssh/sshd_config file do not allow ssh
for user oracle. - The server may have disabled public key based authentication.
- The client public key on the server may be outdated.
- ~oracle or ~oracle/.ssh on the remote host may not be owned by oracle.
- User may not have passed -shared option for shared remote users or
may be passing the -shared option for non-shared remote users. - If there is output in addition to the date, but no password is asked,
it may be a security alert shown as part of company policy. Append the
additional text to the <OMS HOME>/sysman/prov/resources/ignoreMessages.txt file.
—rac1:—
Running /usr/bin/ssh -x -l oracle rac1 date to verify SSH connectivity has been setup from local host to rac1.
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL. Please note that being prompted for a passphrase may be OK but being prompted for a password is ERROR.
Wed Aug 9 16:31:49 CST 2017
—rac2:—
Running /usr/bin/ssh -x -l oracle rac2 date to verify SSH connectivity has been setup from local host to rac2.
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL. Please note that being prompted for a passphrase may be OK but being prompted for a password is ERROR.
Wed Aug 9 16:31:50 CST 2017
Verifying SSH connectivity has been setup from rac1 to rac1
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL.
bash: -c: line 0: unexpected EOF while looking for matching `”‘
bash: -c: line 1: syntax error: unexpected end of file
Verifying SSH connectivity has been setup from rac1 to rac2
IF YOU SEE ANY OTHER OUTPUT BESIDES THE OUTPUT OF THE DATE COMMAND OR IF YOU ARE PROMPTED FOR A PASSWORD HERE, IT MEANS SSH SETUP HAS NOT BEEN SUCCESSFUL.
bash: -c: line 0: unexpected EOF while looking for matching `”‘
bash: -c: line 1: syntax error: unexpected end of file
-Verification from complete-
SSH verification complete.
$ vi /g01/oraInventory/ContentsXML/inventory.xml
找到 这行<HOME NAME="Ora11g_gridinfrahome1" LOC="/opt/grid/products/11.2.0" TYPE="O" IDX="1" CRS="true"> —-添加 CRS=”true”即可(有就不用添加)
—图形化安装
执行脚本:现在rac1执行再到rac2上执行
/u01/oracle/11.2.0/root.sh
——-RAC环境搭建完成
—-DBCA建库
grid@rac1:/home/grid>sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 9 17:02:13 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> create diskgroup data external redundancy disk ‘/dev/asm-diske’ ATTRIBUTE ‘compatible.rdbms’ = ‘11.2’,’compatible.asm’ = ‘11.2’;
Diskgroup created.
SQL> alter system set “_high_priority_processes”=’LMS*’ scope=spfile;
System altered.
grid@rac2:/home/grid>sqlplus / as sysasm
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 9 17:03:19 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options
SQL> alter diskgroup data mount;
Diskgroup altered.
SQL> alter system set “_high_priority_processes”=’LMS*’ scope=spfile;
System altered.
—-DBCA图形化建库
RAC-RAC DG搭建
环境:
PRIMARY STANDBY
Cluster 11.2.0.4.0 11.2.0.4.0
Cluster Nodes Rac1 rac2 Rac3 rac4
Scan 172.16.10.57 172.16.10.60
vips 172.16.10.55 rac1-vip
172.16.10.56 rac2-vip 172.16.10.58 rac3-vip
172.16.10.59 rac4-vip
DB_UNIQUE_NAME orcl stdby
DB_NAME orcl orcl
instance orcl1 orcl2 stdby1 stdby2
DB STORAGE ASM ASM
DB LISTENER ORCL_LISTENER ORCL_LISTENER
ASM diskgroup for DB files DATA DATA
ORACLE_HOME /u01/oracle/11.2.0 /u01/oracle/11.2.0
1、 主库RAC环境是否开启归档,并开启force logging模式
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 10:26:30 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select name,log_mode,force_logging from v$database;
NAME LOG_MODE FOR
ORCL NOARCHIVELOG NO
—-开启归档以及force模式
oracle@rac1:/home/oracle>srvctl stop database -d orcl
oracle@rac1:/home/oracle>srvctl start instance -d orcl -i orcl1 -o mount
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 10:33:02 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database archivelog;
Database altered.
SQL> alter database force logging;
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
oracle@rac1:/home/oracle>srvctl stop instance -d orcl -i orcl1 -o abort
oracle@rac1:/home/oracle>srvctl start database -d orcl
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 10:35:42 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select name,log_mode,force_logging from v$database;
NAME LOG_MODE FOR
ORCL ARCHIVELOG YES
2、 查看主库相关参数信息
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 11 13:41:00 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> set linesize 9999
SQL> select INST_ID, dbid,name,DB_UNIQUE_NAME,current_scn,protection_mode,database_role,force_logging,open_mode,switchover_status from gv$database;
INST_ID DBID NAME DB_UNIQUE_NAME CURRENT_SCN PROTECTION_MODE DATABASE_ROLE FOR OPEN_MODE SWITCHOVER_STATUS
2 1479366288 ORCL orcl 1188871 MAXIMUM PERFORMANCE PRIMARY YES READ WRITE FAILED DESTINATION
1 1479366288 ORCL orcl 1188871 MAXIMUM PERFORMANCE PRIMARY YES READ WRITE FAILED DESTINATION
3、 生成密码文件并传送到rac3、rac4中得ORACLE_HOME/dbs目录中
——没有就下面语句生成,有就不用
oracle@rac1:/u01/oracle/11.2.0/dbs>orapwd file=orapworcl1 password=yunq111 force=y
oracle@rac1:/u01/oracle/11.2.0/dbs>ls
arch2_1_951585556.dbf hc_orcl1.dat init.ora initorcl1.ora orapworcl orapworcl1
一节点传送到其他三个节点,并根据实例名更名orapworcl2 orapwstdby1 orawstdby2
oracle@rac1:/u01/oracle/11.2.0/dbs>scp orapworcl oracle@172.16.10.53:/u01/oracle/11.2.0/dbs/
The authenticity of host ‘172.16.10.53 (172.16.10.53)’ can’t be established.
RSA key fingerprint is 44:e4:16:6e:39:a0:61:f1:27:87:ea:3a:57:e4:72:e4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.10.53’ (RSA) to the list of known hosts.
oracle@172.16.10.53’s password:
orapworcl 100% 1536 1.5KB/s 00:00
oracle@rac1:/u01/oracle/11.2.0/dbs>scp orapworcl oracle@172.16.10.54:/u01/oracle/11.2.0/dbs/
The authenticity of host ‘172.16.10.54 (172.16.10.54)’ can’t be established.
RSA key fingerprint is 4c:5e:cd:96:00:9d:b9:36:7d:a7:d0:31:84:42:5f:51.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.10.54’ (RSA) to the list of known hosts.
oracle@172.16.10.54’s password:
orapworcl 100% 1536 1.5KB/s 00:00
oracle@rac2:/u01/oracle/11.2.0/dbs>scp orapworcl2 oracle@172.16.10.54:/u01/oracle/11.2.0/dbs
The authenticity of host ‘172.16.10.54 (172.16.10.54)’ can’t be established.
RSA key fingerprint is 4c:5e:cd:96:00:9d:b9:36:7d:a7:d0:31:84:42:5f:51.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.16.10.54’ (RSA) to the list of known hosts.
oracle@172.16.10.54’s password:
orapworcl2 100% 1536 1.5KB/s 00:00
4、 创建备库相关目录
grid@rac3:/g01/app/grid/11.2.0/bin>./asmcmd
ASMCMD> ls
DATA/
OCRVOTE/
ASMCMD> cd data
ASMCMD>mkdir STDBY
ASMCMD> mkdir DATAFILE
ASMCMD> mkdir TEMPFILE
ASMCMD> mkdir CONTROLFILE
ASMCMD> mkdir ONLINELOG
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
TEMPFILE/
所创建得adump、dpdump、hdump 此处admin后面为db_name得名字(两个备库节点都需要)
oracle@rac3:/u01/oracle>mkdir -p admin/orcl/adump
5、 创建备库控制文件,并传送到存放控制文件路径下
oracle@rac1:/u01/oracle/11.2.0/dbs>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 10:47:43 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database create standby controlfile as ‘/u01/control01.ctl’;
Database altered.
SQL>exit
oracle@rac1:/u01>scp control01.ctl oracle@172.16.10.53:/u01
oracle@172.16.10.53’s password:
control01.ctl 100% 18MB 17.6MB/s 00:00
grid@rac3:/g01/app/grid/11.2.0/bin>./asmcmd
ASMCMD> ls
DATA/
OCRVOTE/
ASMCMD> cd data
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
TEMPFILE/
ASMCMD> cd controlfile
ASMCMD> ls
ASMCMD> cp /u01/control01.ctl .
copying /u01/control01.ctl -> +data/controlfile/control01.ctl
ASMCMD> ls
control01.ctl
6、 创建PFILE文件,修改相对应得参数,并传送到备库dbs目录下
——修改如下参数
stdby1.db_cache_size=255852544
stdby2.db_cache_size=255852544
stdby1.java_pool_size=4194304
stdby2.java_pool_size=4194304
stdby1.large_pool_size=8388608
stdby2.large_pool_size=8388608
stdby1.pga_aggregate_target=306184192
stdby2.pga_aggregate_target=306184192
stdby1.sga_target=457179136
stdby2.sga_target=457179136
stdby1.shared_io_pool_size=0
stdby2.shared_io_pool_size=0
stdby1.shared_pool_size=180355072
stdby2.shared_pool_size=180355072
stdby1.streams_pool_size=0
stby2.streams_pool_size=0
.audit_file_dest=’/u01/oracle/admin/stdby/adump’ .control_files=’+DATA/STDBY/controlfile/control01.ctl’
.dispatchers=’(PROTOCOL=TCP) (SERVICE=stdbyXDB)’ .log_archive_dest_1=’location=+DATA/STDBY/ONLINELOG/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=stdby’
stdby1.instance_number=1
stdby2.instance_number=2
stdby1.thread=1
stdby2.thread=2
.cluster_database=true
stdby1.undo_tablespace=’UNDOTBS1’
stdby2.undo_tablespace=’UNDOTBS2’
—-添加如下参数 .db_unique_name=’stdby’
.log_archive_config=’dg_config(stdby,orcl)’ .log_archive_dest_2=’service=orcl1 LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl’
.log_archive_dest_state_1=enable .log_archive_dest_state_2=enable
.fal_server=’orcl1’,’orcl2’ .fal_client=’stdby1’
.db_file_name_convert=’+DATA/orcl/datafile/‘,’+DATA/stdby/datafile/‘,’+DATA/orcl/tempfile/‘,’+DATA/stdby/tempfile/‘ .log_file_name_convert=’+DATA/orcl/onlinelog/‘,’+DATA/stdby/onlinelog/‘
*.standby_file_management=’auto’
—将修改完的参数文件传送到备库RAC3dbs目录
oracle@rac1:/u01>scp test.ora oracle@172.16.10.53:/u01/oracle/11.2.0/dbs/
oracle@172.16.10.53’s password:
test.ora 100% 1759 1.7KB/s 00:00
7、 修改主库参数
oracle@rac1:/u01>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 13:12:03 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter system set log_archive_config=’DG_CONFIG=(orcl,stdby)’ sid=’*’;
System altered.
SQL> alter system set log_archive_dest_state_1=enable sid=’*’;
System altered.
SQL> alter system set log_archive_dest_state_2=enable sid=’*’;
System altered.
SQL> alter system set log_archive_dest_1=’location=/u01/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl’ scope=both SID=’orcl1’;
System altered.
SQL> alter system set log_archive_dest_1=’location=/u01/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl’ scope=both SID=’orcl2’;
System altered.
SQL> alter system set log_archive_dest_2=’service=stdby1 LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdby’ scope =both SID=’*’;
System altered.
SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile ;
System altered.
SQL> ALTER SYSTEM SET FAL_CLIENT = ‘orcl1’ SCOPE=SPFILE;
System altered.
SQL> alter system set fal_server=’stdby1’,’stdby2’ scope=spfile;
System altered.
SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT=’+DATA/stdby/datafile/‘,’+DATA/orcl/datafile/‘ ,’+DATA/stdby/tempfile/‘ ,’+DATA/orcl/tempfile/‘ scope=spfile;
System altered.
SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT=,’+DATA/stdby/onlinelog/‘,’+DATA/orcl/onlinelog/‘ scope=spfile;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT=,’+DATA/orcl/onlinelog/‘,’+DATA/orcl/onlinelog/‘ scope=spfile
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
SQL> show parameter convert
NAME TYPE VALUE
db_file_name_convert string
log_file_name_convert string
SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT=’+DATA/stdby/onlinelog/‘,’+DATA/orcl/onlinelog/‘ scope=spfile;
System altered.
SQL> alter system set standby_file_management=’AUTO’ sid=’*’;
System altered.
SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT=’+DATA/stdby/onlinelog/‘,’+DATA/orcl/onlinelog/‘ scope=spfile;
System altered.
SQL> alter system set standby_file_management=’AUTO’ sid=’*’;
System altered.
8、 配置监听文件
配置Listener.ora:
grid@rac1:/g01/app/grid/11.2.0/network/admin>vi listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME= orcl)
(ORACLE_HOME=/g01/app/grid/11.2.0/)
(SID_NAME=orcl1)
)
)
grid@rac2:/g01/app/grid/11.2.0/network/admin> vi listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME= orcl)
(ORACLE_HOME=/g01/app/grid/11.2.0/)
(SID_NAME=orcl2)
)
)
grid@rac3:/g01/app/grid/11.2.0/network/admin>vi listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME= stdby)
(ORACLE_HOME=/g01/app/grid/11.2.0/)
(SID_NAME=stdby1)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = stdby)
(ORACLE_HOME = /u01/oracle/11.2.0)
(SID_NAME = stdby1)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.58)(PORT = 1521))
)
grid@rac4:/g01/app/grid/11.2.0/network/admin>vi listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME= stdby)
(ORACLE_HOME=/g01/app/grid/11.2.0/)
(SID_NAME=stdby2)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = stdby)
(ORACLE_HOME = /u01/oracle/11.2.0)
(SID_NAME = stdby1)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.58)(PORT = 1521))
)
配置tnsnames.ora:
oracle@rac1:/u01/oracle/11.2.0/network/admin>cat tnsnames.ora
tnsnames.ora Network Configuration File: /u01/oracle/11.2.0/network/admin/tnsnames.ora
Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
———-需要将下面四个配置分别到rac1、rac2、rac3、rac4中得tns文件中添加
orcl1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.55)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(instance_name = orcl1)
)
)
orcl2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.56)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(instance_name = orcl2)
)
)
stdby1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.58)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stdby)
(instance_name = stdby1)
)
)
stdby2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.59)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stdby)
(instance_name = stdby2)
)
)
——相互测试TNSPING 能否通
出现如下才算测通:
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 10-AUG-2017 13:46:54
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.10.55)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) (instance_name = orcl1)))
OK (10 msec)
——利用sqlplus sys/密码@TNS连接符测试
9、 利用duplicate拷贝数据文件至备库
oracle@rac3:/u01/oracle/11.2.0/dbs>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 14:04:17 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=’/u01/oracle/11.2.0/dbs/test.ora’;
ORACLE instance started.
Total System Global Area 759943168 bytes
Fixed Size 2257112 bytes
Variable Size 562040616 bytes
Database Buffers 192937984 bytes
Redo Buffers 2707456 bytes
SQL>exit
oracle@rac3:/u01/oracle/11.2.0/dbs>rman target sys/yunq111@orcl1 auxiliary sys/yunq111@stdby1
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Aug 11 23:27:00 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1479366288)
connected to auxiliary database: ORCL (not mounted)
—-执行如下语句:
RMAN> duplicate target database for standby from active database nofilenamecheck;
10、 在备库上创建SPFILE文件
oracle@rac3:/u01/oracle/11.2.0/dbs>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 11 23:56:59 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> create spfile=’+DATA/stdby/spfilestdby.ora’ from pfile=’/u01/oracle/11.2.0/dbs/test.ora’;
File created.
——创建完了之后关闭数据库
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
11、 编辑备库上一节点和二节点的pfile文件
oracle@rac3:/u01/oracle/11.2.0/dbs>vi initstdby1.ora
oracle@rac3:/u01/oracle/11.2.0/dbs>ls
1 hc_orcl1.dat hc_stdby1.dat init.ora initstdby1.ora orapworcl1 orapwstdby1 test.ora
oracle@rac3:/u01/oracle/11.2.0/dbs>cat initstdby1.ora
SPFILE=’+DATA/STDBY/spfilestdby.ora’
oracle@rac4:/u01/oracle/11.2.0/dbs>ls
init.ora orapworcl2 orapwstdby2
oracle@rac4:/u01/oracle/11.2.0/dbs>ls
init.ora initstdby2.ora orapworcl2 orapwstdby2
oracle@rac4:/u01/oracle/11.2.0/dbs>vi initstdby2.ora
oracle@rac4:/u01/oracle/11.2.0/dbs>cat initstdby2.ora
SPFILE=’+DATA/STDBY/spfilestdby.ora’
12、 启动数据库到Mount 状态,并将数据库信息注册到集群中
oracle@rac3:/u01/oracle/11.2.0/dbs>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 12 00:09:48 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 759943168 bytes
Fixed Size 2257112 bytes
Variable Size 562040616 bytes
Database Buffers 192937984 bytes
Redo Buffers 2707456 bytes
Database mounted.
SQL> exit
——将数据库信息注册到集群中
参数: -d <db_unique_name> Unique name for the database
oracle@rac3:/u01/oracle/11.2.0/dbs>srvctl add database -d stdby -o $ORACLE_HOME -p +data/stdby/spfilestdby.ora
oracle@rac3:/u01/oracle/11.2.0/dbs>srvctl add instance -d stdby -i stdby1 -n rac3
oracle@rac3:/u01/oracle/11.2.0/dbs>srvctl add instance -d stdby -i stdby2 -n rac4
—-查看集群状态
grid@rac3:/home/grid>crsctl status res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.DATA.dg
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.LISTENER.lsnr
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.LISTENER1.lsnr
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.OCRVOTE.dg
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.asm
ONLINE ONLINE rac3 Started
ONLINE ONLINE rac4 Started
ora.gsd
OFFLINE OFFLINE rac3
OFFLINE OFFLINE rac4
ora.net1.network
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.ons
ONLINE ONLINE rac3
ONLINE ONLINE rac4
Cluster Resources
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac3
ora.cvu
1 ONLINE ONLINE rac4
ora.oc4j
1 ONLINE ONLINE rac4
ora.rac3.vip
1 ONLINE ONLINE rac3
ora.rac4.vip
1 ONLINE ONLINE rac4
ora.scan1.vip
1 ONLINE ONLINE rac3
ora.stdby.db
1 OFFLINE OFFLINE
2 OFFLINE OFFLINE
13、 启动数据库mount状态
oracle@rac3:/u01/oracle/11.2.0/dbs>srvctl start database -d stdby -o mount
PRCR-1079 : Failed to start resource ora.stdby.db
CRS-5017: The resource action “ora.stdby.db start” encountered the following error:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
. For details refer to “(:CLSN00107:)” in “/g01/app/grid/11.2.0/log/rac3/agent/crsd/oraagent_oracle/oraagent_oracle.log”.
CRS-5017: The resource action “ora.stdby.db start” encountered the following error:
ORA-00205: error in identifying control file, check alert log for more info
. For details refer to “(:CLSN00107:)” in “/g01/app/grid/11.2.0/log/rac4/agent/crsd/oraagent_oracle/oraagent_oracle.log”.
oracle@rac3:/u01/oracle/11.2.0/dbs>crsctl status res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.DATA.dg
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.LISTENER.lsnr
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.LISTENER1.lsnr
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.OCRVOTE.dg
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.asm
ONLINE ONLINE rac3 Started
ONLINE ONLINE rac4 Started
ora.gsd
OFFLINE OFFLINE rac3
OFFLINE OFFLINE rac4
ora.net1.network
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.ons
ONLINE ONLINE rac3
ONLINE ONLINE rac4
Cluster Resources
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac3
ora.cvu
1 ONLINE ONLINE rac4
ora.oc4j
1 ONLINE ONLINE rac4
ora.rac3.vip
1 ONLINE ONLINE rac3
ora.rac4.vip
1 ONLINE ONLINE rac4
ora.scan1.vip
1 ONLINE ONLINE rac3
ora.stdby.db
1 ONLINE INTERMEDIATE rac3 Mounted (Closed)
2 OFFLINE OFFLINE Instance Shutdown
—切换到二节点手动启动mount
oracle@rac4:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 12 00:29:20 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORA-01565: error in identifying file ‘+DATA/stdby/spfilestdby.ora’
ORA-17503: ksfdopn:2 Failed to open file +DATA/stdby/spfilestdby.ora
ORA-15001: diskgroup “DATA” does not exist or is not mounted
ORA-15040: diskgroup is incomplete
——查看oracle_alert日志
CRS-2674: Start of ‘ora.stdby.db’ on ‘rac4’ failed
ORA-15025: could not open disk “/dev/asm-diske”
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9
SUCCESS: diskgroup DATA was dismounted
ERROR: diskgroup DATA was not mounted
ORA-01565: Unable to open Spfile +DATA/stdby/spfilestdby.ora.
USER (ospid: 25598): terminating the instance due to error 1565
Instance terminated by USER, pid = 25598
Sat Aug 12 00:29:39 2017
ORA-1092 : opitsk aborting process
oracle@rac4:/u01/oracle/diag/rdbms/stdby/stdby2/trace>id oracle
uid=501(oracle) gid=6000(oinstall) groups=6000(oinstall),5001(asmdba),6001(dba)
oracle@rac4:/u01/oracle/diag/rdbms/stdby/stdby2/trace>su - root
Password:
[root@rac4 ~]# ll /dev/asm*
brw-rw——. 1 grid asmadmin 8, 16 Aug 12 00:33 /dev/asm-diskb
brw-rw——. 1 grid asmadmin 8, 32 Aug 10 15:38 /dev/asm-diskc
brw-rw——. 1 grid asmadmin 8, 48 Aug 12 00:29 /dev/asm-diskd
brw-rw——. 1 grid asmadmin 8, 64 Aug 12 00:33 /dev/asm-diske
[root@rac4 ~]# usermod -aG asmadmin oracle
[root@rac4 ~]# id oracle
uid=501(oracle) gid=6000(oinstall) groups=6000(oinstall),5000(asmadmin),5001(asmdba),6001(dba)
oracle@rac4:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 12 00:29:20 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORA-01565: error in identifying file ‘+DATA/stdby/spfilestdby.ora’
ORA-17503: ksfdopn:2 Failed to open file +DATA/stdby/spfilestdby.ora
ORA-15001: diskgroup “DATA” does not exist or is not mounted
ORA-15040: diskgroup is incomplete
oracle@rac4:/u01/oracle/11.2.0/dbs>ls -ltra /u01/oracle/11.2.0/bin/oracle
-rwsr-s—x. 1 oracle oinstall 239626689 Aug 10 17:10 /u01/oracle/11.2.0/bin/oracle
[root@rac4 ~]# chown oracle:asmadmin /u01/oracle/11.2.0/bin/oracle
[root@rac4 ~]# su - oracle
You login as oracle,Please ask somebody to double check!*
oracle@rac4:/home/oracle>ls -ltra /u01/oracle/11.2.0/bin/oracle
-rwxr-x—x. 1 oracle asmadmin 239626689 Aug 10 17:10 /u01/oracle/11.2.0/bin/oracle
oracle@rac4:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Aug 12 01:20:24 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 759943168 bytes
Fixed Size 2257112 bytes
Variable Size 562040616 bytes
Database Buffers 192937984 bytes
Redo Buffers 2707456 bytes
Database mounted.
——-j解决上述问题。
grid@rac4:/home/grid>crsctl status res -t
NAME TARGET STATE SERVER STATE_DETAILS
Local Resources
ora.DATA.dg
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.LISTENER.lsnr
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.LISTENER1.lsnr
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.OCRVOTE.dg
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.asm
ONLINE ONLINE rac3 Started
ONLINE ONLINE rac4 Started
ora.gsd
OFFLINE OFFLINE rac3
OFFLINE OFFLINE rac4
ora.net1.network
ONLINE ONLINE rac3
ONLINE ONLINE rac4
ora.ons
ONLINE ONLINE rac3
ONLINE ONLINE rac4
Cluster Resources
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac3
ora.cvu
1 ONLINE ONLINE rac4
ora.oc4j
1 ONLINE ONLINE rac4
ora.rac3.vip
1 ONLINE ONLINE rac3
ora.rac4.vip
1 ONLINE ONLINE rac4
ora.scan1.vip
1 ONLINE ONLINE rac3
ora.stdby.db
1 ONLINE INTERMEDIATE rac3 Mounted (Closed)
2 ONLINE INTERMEDIATE rac4 Mounted (Closed)
14、 在主备库上建重做日志组
—查看主库日志组大小及个数确认建多少个
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 08:35:29 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select group#,thread#,sequence#,bytes/1024/1024,members from v$log;
GROUP# THREAD# SEQUENCE# BYTES/1024/1024 MEMBERS
1 1 21 50 1
2 1 20 50 1
3 2 17 50 1
4 2 16 50 1
Stdby备库重做日志组个数=(主库每个实例组组数+1)实例个数
Stdby备库重做日志组个数=(2+1)2=6
备库:
oracle@rac3:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 08:40:16 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database add standby logfile thread 1 group 5 ‘+data/stdby/onlinelog/redo5.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 1 group 6 ‘+data/stdby/onlinelog/redo6.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 1 group 7 ‘+data/stdby/onlinelog/redo7.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 2 group 8 ‘+data/stdby/onlinelog/redo8.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 2 group 9 ‘+data/stdby/onlinelog/redo9.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 2 group 10 ‘+data/stdby/onlinelog/redo10.log’ size 50m;
Database altered.
主库:
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 08:35:29 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database add standby logfile thread 1 group 5 ‘+data/orcl/onlinelog/redo5.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 1 group 6 ‘+data/orcl/onlinelog/redo6.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 1 group 7 ‘+data/orcl/onlinelog/redo7.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 2 group 8 ‘+data/orcl/onlinelog/redo8.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 2 group 9 ‘+data/orcl/onlinelog/redo9.log’ size 50m;
Database altered.
SQL> alter database add standby logfile thread 2 group 10 ‘+data/orcl/onlinelog/redo10.log’ size 50m;
Database altered.
15、 备库应用日志
备库两个节点都open read only;
SQL> alter database open read only;
Database altered.
——备库应用日志进程只能在一个节点上运行,不能两个节点同时开启—如下
一节点:
oracle@rac3:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 08:40:16 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database recover managed standby database disconnect from session using current logfile;
Database altered.
———查看一节点的ORACLE_alert日志,发现如下错误
—-ORA-01555
——查看主库undo相关参数
SQL> show parameter undo
NAME TYPE VALUE
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS1
——查看备库undo相关参数
SQL> show parameter undo
NAME TYPE VALUE
undo_management string AUTO
undo_retention integer 900
undo_tablespace string
可发现-备库未设置UNDO表空间-
为备库设置与主库同等大小的UNDO表空间。
——查看主库节点UNDO表空间大小
SQL> select file_name,tablespace_name,bytes/1024/1024 from dba_data_files;
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024
+DATA/orcl/datafile/users.259.951585391
USERS 5
+DATA/orcl/datafile/undotbs1.258.951585391
UNDOTBS1 75
+DATA/orcl/datafile/sysaux.257.951585391
SYSAUX 690
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024
+DATA/orcl/datafile/system.256.951585391
SYSTEM 740
+DATA/orcl/datafile/undotbs2.264.951585661
UNDOTBS2 25
——-为备库创建UNDO表空间
SQL> create undo tablespace UNDOTBS1 datafile ‘+data/stdby/datafile/UNDOTBS1.dbf’ size 75m autoextend on;
create undo tablespace UNDOTBS1 datafile ‘+data/stdby/datafile/UNDOTBS1.dbf’ size 75m autoextend on
*
ERROR at line 1:
ORA-01543: tablespace ‘UNDOTBS1’ already exists
SQL> select file_name,tablespace_name,bytes/1024/1024,maxbytes/1024/1024 from dba_data_files;
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024 MAXBYTES/1024/1024
+DATA/stdby/datafile/users.271.951780739
USERS 5 32767.9844
+DATA/stdby/datafile/undotbs1.269.951780717
UNDOTBS1 75 32767.9844
+DATA/stdby/datafile/sysaux.268.951780601
SYSAUX 680 32767.9844
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024 MAXBYTES/1024/1024
+DATA/stdby/datafile/system.267.951780457
SYSTEM 740 32767.9844
+DATA/stdby/datafile/undotbs2.270.951780731
UNDOTBS2 25 32767.9844
—-UNDO表空间是存在的。查看之前所修改的参数文件、发现UNDO表空间之前的实例名未更改,还是保留的orcl1、orcl2,将这个参数更改为stdby1/stdby2
oracle@rac3:/u01/oracle/11.2.0/dbs>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 09:19:39 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter system set undo_tablespace = ‘UNDOTBS1’ scope = both SID=’stdby1’;
alter system set undo_tablespace = ‘UNDOTBS1’ scope = both SID=’stdby1’
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-01682: read-only DB cannot allocate temporary space in tablespace UNDOTBS1
——关闭两个备库两个节点—将一节点启动到nomount状态;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 759943168 bytes
Fixed Size 2257112 bytes
Variable Size 658509608 bytes
Database Buffers 96468992 bytes
Redo Buffers 2707456 bytes
SQL> alter system set undo_tablespace = ‘UNDOTBS1’ scope = spfile SID=’stdby1’;
System altered.
SQL> alter system set undo_tablespace = ‘UNDOTBS2’ scope = spfile SID=’stdby2’;
System altered.
—-重启两个节点数据库
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 759943168 bytes
Fixed Size 2257112 bytes
Variable Size 658509608 bytes
Database Buffers 96468992 bytes
Redo Buffers 2707456 bytes
——验证是否存在UNDO表空间值
SQL> show parameter undo
NAME TYPE
VALUE
undo_management string
AUTO
undo_retention integer
900
undo_tablespace string
UNDOTBS1
SQL> alter database mount standby database;
Database altered.
SQL> alter database open read only;
Database altered.
——重新启动日志应用,观看alert日志
SQL> alter database recover managed standby database disconnect from session using current logfile;
Database altered.
二节点:如果想在二节点应用则会报如下错误
oracle@rac4:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 08:56:35 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter database recover managed standby database disconnect from session using current logfile;
alter database recover managed standby database disconnect from session using current logfile
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active
16、 验证是否同步
—-分别在主库一节点、二节点上创建数据文件
一节点:
oracle@rac1:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 10:11:55 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter standby
NAME TYPE VALUE
standby_archive_dest string ?/dbs/arch
standby_file_management string AUTO
SQL> create tablespace zxx datafile ‘+DATA/orcl/datafile/zxx1.dbf’ size 10m;
Tablespace created.
二节点:
oracle@rac2:/home/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 10:11:55 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter tablespace zxx add datafile ‘+DATA/orcl/datafile/zxx2.dbf’ size 10m;
Tablespace altered.
——-由于用的最大可用模式、所以不用通过切换日志归档来验证
如果是最大性能模式,就需要通过切换归档来验证,两个节点运行alter system switch logfile;
—-验证备库是否存在上述所添加的数据文件
—-alter 日志
语句查询:
oracle@rac3:/u01/oracle/11.2.0/dbs>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Aug 14 09:23:31 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select file_name,tablespace_name,bytes/1024/1024,maxbytes/1024/1024 from dba_data_files;
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024 MAXBYTES/1024/1024
+DATA/stdby/datafile/users.271.951780739
USERS 5 32767.9844
+DATA/stdby/datafile/undotbs1.269.951780717
UNDOTBS1 75 32767.9844
+DATA/stdby/datafile/sysaux.268.951780601
SYSAUX 690 32767.9844
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024 MAXBYTES/1024/1024
+DATA/stdby/datafile/system.267.951780457
SYSTEM 740 32767.9844
+DATA/stdby/datafile/undotbs2.270.951780731
UNDOTBS2 25 32767.9844
+DATA/stdby/datafile/zxx.264.951992111
ZXX 10 0
FILE_NAME
TABLESPACE_NAME BYTES/1024/1024 MAXBYTES/1024/1024
+DATA/stdby/datafile/zxx.263.951992199
ZXX 10 0
7 rows selected.
——-主备同步应用成功。
版权声明:本文为博主原创文章,未经博主允许不得转载。



