RAC静默安装与DG搭建
一、主机配置
1、节点1:
① 内存:15.57GB
② SWAP交换空间大小:2GB
③ 根目录挂载磁盘:48GB
④ HOSTNAME:vmrac-01
⑤ 网卡:eth0 172.16.40.162、eth1 172.16.2.165
2、节点2:
① 内存:15.57GB
② SWAP交换空间大小:2GB
③ 根目录挂载磁盘:97GB
④ HOSTNAME:vmrac-02
⑤ 网卡:eth0 172.16.40.163、eth1 172.16.2.166
二、检查服务和缺失的RPM包
1、查看防火墙和SELINUX
① 防火墙:
service iptables status // 查看防火墙的状态
service iptables stop // 关闭防火墙
chkconfig --list iptables // 查看下次开机是否自动打开服务
chkconfig iptables off // 关闭下次开机自动打开服务
② SELINUX:
vi /etc/selinux/config
SELINUX=disable
2、取消系统的ntp设置,采用 oracle 自带的时间同步服务
禁用ntp:
service ntpd stop
chkconfig ntpd off
rm -rf /var/run/ntpd.pid
mv /etc/ntp.conf /etc/ntp.conf.org
3、配置yum,检查oracle所需的包:(参见联机文档《Grid Infrastructure Installation Guide for Linux》2.8.2)
rpm -qa | grep binutils (x86_64)
rpm -qa | grep glibc (x86_64 & i686)
rpm -qa | grep glibc-headers (x86_64)
rpm -qa | grep glibc-common
rpm -qa | grep glibc-devel (x86_64 & i686)
*rpm -qa | grep pdksh (i686)
*rpm -qa | grep ksh
rpm -qa | grep libaio (x86_64 & i686)
*rpm -qa | grep libaio-devel (x86_64 & i686)
rpm -qa | grep libgcc (x86_64 & i686)
rpm -qa | grep libstdc++ (x86_64 & i686)
*rpm -qa | grep libstdc++-devel (x86_64 & i686)
*rpm -qa | grep compat-libstdc++-33 (x86_64 & i686)
rpm -qa | grep make (x86_64)
rpm -qa | grep gcc (x86_64)
*rpm -qa | grep gcc-c++ (x86_64)
rpm -qa | grep sysstat (x86_64)
*rpm -qa | grep compat-libcap1 (x86_64)
*rpm -qa | grep numactl-devel (x86_64)
*rpm -qa | grep libXp (x86_64)
*rpm -qa | grep unixODBC
*rpm -qa | grep unixODBC-devel
rpm -qa | grep elfutils-libelf (x86_64)
*rpm -qa | grep elfutils-libelf-devel (x86_64)
rpm -qa | grep tigervnc-server
注:其中带*的为此次安装需要安装的包
4、 安装rlwrap
安装rlwrap是为了sqlplus、rman、asmcmd方便编辑命令。使用源码包或则RPM包装,在源码包安装的时候可能需要安装以下包:
yum install readline
yum install readline-devel
三、修改linux核心参数和资源限制
1、修改核心参数
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 8388608 //共享内存总量,以页为单位。推荐设置为物理内存大小除以分页大小,Linux 共享内存页大小为4KB
kernel.shmmax = 16725073919 //Linux进程可以分配的单独共享内存段的最大值,shmmax最大为内存大小减1,要大于一半的内存量
kernel.shmmni = 4096 //共享内存段的最大数量,shmmni 缺省值 4096 ,一般肯定是够用了
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
sysctl -p 生效
2、修改oracle和grid用户资源限制:
① vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
修改后 ulimit -a 查看
② shell资源 资源名 软限制 硬限制
打开文件描述符 nofile 最小1024 最小65536
单个用户可用进程数 nproc 最小2047 最小16384
进程堆栈段的大小 stack 最小10240 KB 最小10240KB,通常32768KB
③ 查看用户的上述资源限制:
oracle用户:
ulimit -Sn nofile 软限制
ulimit -Hn nofile 硬限制
ulimit -Su nproc 软限制
ulimit -Hu nproc 硬限制
ulimit -Ss stack 软限制
ulimit -Hs stack 硬限制
grid用户略
四、创建用户及相应目录并修改权限
1、创建组和用户
groupadd -g 500 oinstall
groupadd -g 501 asmadmin
groupadd -g 502 asmdba
groupadd -g 503 asmoper
groupadd -g 504 dba
groupadd -g 505 oper
useradd -g oinstall -G asmadmin,asmdba,asmoper,dba -u 500 grid
useradd -g oinstall -G asmdba,dba,oper -u 501 oracle
passwd Dtoracle123#
passwd Dtoracle123#
2、创建grid 和oracle的安装目录,并修改属性
mkdir -p /u01/app/oracle/product/11.2.0/db_1
mkdir -p /u01/app/grid_base
mkdir -p /u01/app/grid_home
chmod -R 775 /u01
chown -R oracle:oinstall /u01
chown -R grid:oinstall /u01/app/grid_base
chown -R grid:oinstall /u01/app/grid_home
3、修改oracle 、grid的环境变量
① grid:
umask 022
ORACLE_BASE=/u01/app/grid_base
ORACLE_HOME=/u01/app/grid_home
ORACLE_SID=+ASM1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
#export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
#export NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SSXFF'
#alias sqlplus='rlwrap sqlplus'
#alias asmcmd='rlwrap asmcmd'
② oracle
umask 022
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=rac1
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib:/usr/lib
#export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms
/jlib
#export TNS_ADMIN=$ORACLE_HOME/network/admin
#export NLS_LANG="simplified chinese"_china.al32utf8
#export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
#export NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SSXFF'
#export NLS_TIMESTAMP_TZ_FORMAT='YYYY-MM-DD HH24:MI:SSXFF TZR'
#alias sqlplus='rlwrap sqlplus'
#alias rman='rlwrap rman'
五、修改/etc/hosts文件
vi /etc/hosts
192.168.3.88 vmrac-01
略
六、配置共享磁盘,采用UDEV方式
① ll /dev/sd*:
brw-rw---- 1 root disk 8, 0 12月 12 10:58 /dev/sda
brw-rw---- 1 root disk 8, 16 12月 12 10:58 /dev/sdb
brw-rw---- 1 root disk 8, 32 12月 12 10:58 /dev/sdc
② [root@vmrac-01 rules.d]# scsi_id --whitelisted --replace-whitespace --device=/dev/sda
368886030000010f9fa16eb9563779565
[root@vmrac-01 rules.d]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
36888603000002210fa16eb9563779565
[root@vmrac-01 rules.d]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc
36888603000002211fa16eb9563779565
[root@vmrac-01 ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdd
3688860300000195cfa16eb9563779565
[root@vmrac-01 ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sde
368886030000019a4fa16eb9563779565
[root@vmrac-01 ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdf
36888603000001959fa16eb9563779565
[root@vmrac-01 ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdg
36888603000001f01fa16eb9563779565
③ vi 90-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="3688860300000195cfa16e
b9563779565", NAME="asmdisk1", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="36888603000002210fa16e
b9563779565", NAME="asmdisk2", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="36888603000002211fa16e
b9563779565", NAME="asmdisk3", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="368886030000010f9fa16e
b9563779565", NAME="asmdisk4", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="368886030000010f9fa16e
b9563779565", NAME="asmdisk5", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="368886030000010f9fa16e
b9563779565", NAME="asmdisk6", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id i --whitelisted --device=/dev/$name", RESULT=="368886030000010f9fa16e
b9563779565", NAME="asmdisk7", ACTION=="add|change", OWNER="grid",GROUP="asmadmin", MODE="0660"
start_udev
ll /dev/asmdisk*
注:sda、sdb、sdc用于创建OCR磁盘,sdd、sde用于DATA磁盘,sdf、sdg用于FRA磁盘
七、检查时间
vmrac-01和vmrac-02时间必须一致(用date看)
八、建立主机间的信任关系
1、 执行脚本
./sshUserSetup.sh -user grid -hosts "vmrac-01 vmrac-02" - noPromptPassphrase -confirm -advanced
2、 手工建立
su - grid
mkdir .ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat /home/grid/.ssh/id_rsa.pub >> /home/grid/.ssh/authorized_keys
cat /home/grid/.ssh/id_dsa.pub >> /home/grid/.ssh/authorized_keys
scp 114.116.150.85:/home/grid/.ssh/id_dsa.pub /home/grid
scp 114.116.150.85:/home/grid/.ssh/id_rsa.pub /home/grid
cat /home/grid/id_rsa.pub >> /home/grid/.ssh/authorized_keys
cat /home/grid/id_dsa.pub >> /home/grid/.ssh/authorized_keys
scp /home/grid/.ssh/authorized_keys 114.116.150.85:/home/grid/.ssh/
su - oracle
mkdir .ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat /home/oracle/.ssh/id_rsa.pub >> /home/oracle/.ssh/authorized_keys
cat /home/oracle/.ssh/id_dsa.pub >> /home/oracle/.ssh/authorized_keys
scp 114.116.150.85:/home/oracle/.ssh/id_dsa.pub /home/oracle
scp 114.116.150.85:/home/oracle/.ssh/id_rsa.pub /home/oracle
cat /home/oracle/id_rsa.pub >> /home/oracle/.ssh/authorized_keys
cat /home/oracle/id_dsa.pub >> /home/oracle/.ssh/authorized_keys
scp /home/oracle/.ssh/authorized_keys 114.116.150.85:/home/oracle/.ssh/
九、安装软件
1、RAC层次架构
① 存储层
RAC是一个多实例、单数据库的系统。数据文件、联机日志、控制文件、甚至归档日志等文件在一个集群中只有一份。所有节点都平等地使用这些文件。共享数据一般都是采用EMC等存储阵列,每个服务器通过HBA卡和光纤线连接到存储。
② 网络层
在整个RAC环境中,实际上有3个网络存在:
1)由Public网卡接入的网络,用于对外提供数据查询等服务
2)由Private网卡组成的私有网络;提供心跳和缓存融合
3)存储设备、光纤适配器提供,提供SCSI存储数据
③ 集群件层
单实例环境下,Oracle是运行在OS kernel之上。RAC环境下,存储设备是共享的。如果还依赖OS Kernal的服务,就无法保证多个主机间的协调工作,这时就需要引入额外的控制机制,这个机制就是位于Oracle和OS Kernel之间的CRS,它会在OS Kernel之前截获请求,然后和其他节点上的CRS协商,最终完成上层的请求。
④ 应用层
集群环境之所以能够提供高可用性,是因为CRS对运行于其上的应用进行监视,并在发生异常进行重启、切换等干预手段。这些被CRS监控的对象就叫做CRS Resource。
CRS Resource 有两类:
1)、Nodeapp包括
GSD(Global Service Daemon)、ONS(Oracle Notification Service Daemon)、VIP、Listener
2)、database -related resource包括
Database、Instance和Service
⑤、两节点RAC软件结构
2、安装grid软件
① su - grid
解压安装介质、
② 使用runcluvfy.sh 来执行安装前的预检查,来避免由于环境配置引发的安装失败问题。
su - grid
cd /u01/software/grid
/u01/software/grid/runcluvfy.sh stage -pre crsinst -n vmrac-01,vmrac-02 -verbose
检查完成后
cd /u01/software/grid/respone
cat grid_install.rsp | grep -v ^# | grep -v ^$ >> grid.rsp
vi grid.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v11_2_0
// 标注响应文件版本
ORACLE_HOSTNAME=vmrac-01 //主机名
INVENTORY_LOCATION=/u01/app/oraInventory //指定产品清单oracle inventory目录的路径
SELECTED_LANGUAGES=en //指定语言
oracle.install.option=CRS_CONFIG
ORACLE_BASE=/u01/app/grid_base //grid的BASE和HOME目录
ORACLE_HOME=/u01/app/grid_home
oracle.install.asm.OSDBA=asmdba //添加所需要的组
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.gpnp.scanName=vmrac-scan //scan 名,要与hosts对应
oracle.install.crs.config.gpnp.scanPort=1521 //listener对外服务端口
oracle.install.crs.config.clusterName=hwy-cluster //cluster 名称
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.gpnp.gnsSubDomain=
oracle.install.crs.config.gpnp.gnsVIPAddress=
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
oracle.install.crs.config.clusterNodes=vmrac-01:vmrac-01-vip,vmrac-02:vmrac-02-vip
// 配置网络信息,格式为:node1:node1-vip,node2:node2-vip
oracle.install.crs.config.networkInterfaceList=eth0:172.15.22.0:1,eth1:172.15.1.0:2
// 格式为: eth0:141.88.24.0:1,eth1:10.2.1.0:2,eth2:141.88.52.0:3
oracle.install.crs.config.storageOption=ASM_STORAGE //配置存储形式
oracle.install.crs.config.sharedFileSystemStorage.diskDriveMapping=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskLocations=
oracle.install.crs.config.sharedFileSystemStorage.votingDiskRedundancy=
oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=
oracle.install.crs.config.sharedFileSystemStorage.ocrRedundancy=
oracle.install.crs.config.useIPMI=false //配置 IPMI
oracle.install.crs.config.ipmi.bmcUsername=
oracle.install.crs.config.ipmi.bmcPassword=
oracle.install.asm.SYSASMPassword= //配置ASM
oracle.install.asm.diskGroup.name=CRS // 磁盘的名字
oracle.install.asm.diskGroup.redundancy=NORMAL //选择冗余方式
oracle.install.asm.diskGroup.AUSize=4 //设置AU为4M
oracle.install.asm.diskGroup.disks=/dev/asmdisk1,/dev/asmdisk2,/dev/asmdisk3
//选择要添加的磁盘
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/asmdisk*
oracle.install.asm.monitorPassword= //密码
oracle.install.crs.upgrade.clusterNodes=
oracle.install.asm.upgradeASM=false
oracle.installer.autoupdates.option=SKIP_UPDATES
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
PROXY_HOST=
PROXY_PORT=0
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
③ 执行脚本
./runInstaller -responseFile /u01/software/grid/response/grid.rsp -silent -ignorePrereq -ignoreSysPrereqs -showProgress
在两个节点分别执行脚本
vmrac-01:/u01/app/oraInventory/orainstRoot.sh
vmrac-02:/u01/app/oraInventory/orainstRoot.sh
vmrac-01:/u01/app/grid_home/root.sh
(可以通过tail -f /u01/app/grid_home/install/root_vmrac-01_2017-12-13_10-06-24.log
查看安装进度)
vmrac-02:/u01/app/grid_home/root.sh
(可以通过tail -f /u01/app/grid_home/install/root_vmrac-02_2017-12-13_11-31-26.log
查看安装进度)
如果在安装过程中报错运行/u01/app/grid_home/crs/install/roothas.pl -deconfig -force -verbose)修改后再次执行脚本。
④ Grid安装完成后的检查工作
crsctl check crs
crsctl stat res -t
olsnodes -n
srvctl status asm -a
ocrcheck
crsctl query css votedisk
3、安装oracle软件
① 解压安装包
② 配置oracle信任关系
./sshUserSetup.sh -user oracle -hosts "vmrac-01 vmrac-02" - noPromptPassphrase -confirm -advanced
(如果在之前配置了就不用重新配置)
③ 执行脚本
./runInstaller -silent -debug -force -ignoreSysPrereqs -ignorePrereq \
FROM_LOCATION=/u01/software/database/stage/products.xml \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.isCustomInstall=false \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=oinstall \
oracle.install.db.CLUSTER_NODES=vmrac-01,vmrac-02 \
DECLINE_SECURITY_UPDATES=true
如果在执行过程中报
Before you can install Oracle RAC, you must install Oracle Grid Infrastructure on all servers (Oracle Clusterware and Oracle ASM) to create a cluster.
修改/u01/app/oraInventory/ContentsXML/inventory.xml
<HOME NAME="Ora11g_gridinfrahome1" LOC="/u01/app/grid_home" TYPE="O" IDX="1" CRS="true">
将CRS改为true
4、配置监听
grid用户执行
netca -silent -responsefile /u01/app/grid_home/assistants/netca/netca.rsp
5、创建DATA和FRA磁盘组
①asmca -silent -createDiskGroup -sysAsmPassword 123123 -diskString '/dev/' -diskGroupName DATA -diskList '/dev/asmdisk4,/dev/asmdisk5,/dev/asmdisk6' -redundancy EXTERNAL -compatible.asm 11.2 -compatible.rdbms 11.2
②asmca -silent -createDiskGroup -sysAsmPassword 123123 -diskString '/dev/' -diskGroupName FRA -diskList '/dev/asmdisk7' -au_size 4 -redundancy EXTERNAL -compatible.asm 11.2 -compatible.rdbms 11.2
十、搭建DG
1、主备机信息
① rac-01: rac-02:
192.168.3.88 vmrac-01 192.168.3.88 vmrac-01
略
② vmrac-01: vmrac02:
192.168.3.88 vmrac-01 192.168.3.88 vmrac-01
略
③
db_name ins_name hostname db_uniq_name service_dbname tnsnames
rac-01 orcl orcl1 rac-01 orcl orcl orcltds
rac-02 orcl orcl2 rac-02 orcl orcl orcltds
vmrac-01 vmorcl orcle1 vmrac-01 vmorcl vmorcl vmorcltds
vmrac-02 vmorcl orcl2 vmrac-02 vmorcl vmorcl vmorcltds
2、修改控制文件参数
主机:
①alter database force logging;
②alter system set log_archive_config='DG_CONFIG=(orcl,vmorcl)';
③alter system set log_archive_dest_1='location=+FRA valid_for=(all_logfiles,all_roles) db_unique_name=orcl';
④alter system set log_archive_dest_2='service=vmorcltds LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=vmorcl';
⑤LOG_ARCHIVE_DEST_STATE_1=ENABLE,LOG_ARCHIVE_DEST_STATE_2=ENABLE (默认是enable)
⑥alter system set fal_server=vmorcltds;
⑦alter system set standby_file_management='AUTO';
备机:
①alter database force logging;
②alter system set log_archive_config='DG_CONFIG=(orcl,vmorcl)';
③alter system set log_archive_dest_1='location=+FRA valid_for=(all_logfiles,all_roles) db_unique_name=vmorcl';
④alter system set log_archive_dest_2='service=vmorcltds LGWR ASYNC valid_for=(online_logfiles,primary_role) db_unique_name=orcl';
⑤LOG_ARCHIVE_DEST_STATE_1=ENABLE,LOG_ARCHIVE_DEST_STATE_2=ENABLE (默认是enable)
⑥alter system set fal_server=orcltds;
⑦alter system set standby_file_management='AUTO';
⑧alter system set REMOTE_LISTENER='vmrac-scan:1521'
3、创建审计目录
mkdir -p /u01/app/oracle/admin/orcl/adump
4、生成数据库全备,传到备机
主机:
①rman target /
②backup current controlfile for standby format '/u01/software/backup/std.con'
③ backup database format '/u01/software/backup/db_%U.bak'
备机:
scp 172.16.35.153:/u01/software/backup/db_1msm1f6t_1_1.bak ./
scp 172.16.35.153:/u01/software/backup/std.con ./
scp 172.16.35.153:/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl1 /u01/app/oracle/product/11.2.0/db_1/dbs/orapwvmorcl1
(分别拷贝到各自节点上,SID要对应)
新建一个哑参,对应主机在备机asm上创建相应目录
①rman target /
②restore spfile to '+DATA/racdb/spfile' from '/u01/software/backup/db_%U.bak';
③shutdown immediate之后以asm中的spfile启动,在启动之前要设置sga和pga的,备机内存要比主机小(主机128G,备机16G)
④vi /u01/app/oracle/product/11.2.0/db_1/dbs/initorcl1.ora
SPFILE='+DATA/orcl/spfileorcl.ora'
(节点2也相应创建)
⑤startup nomount
restore standby controlfile from '/u01/software/backup/std.con'
⑥备机修改参数,参照修改控制文件中备机
⑦alte database mount
rman target /
catalog start with '/u01/software/backup'
lsit backup
restore database;
⑧节点1启动不了数据库,修改参数
alter system set cluster_interconnects = '172.16.2.166' scope=spfile sid='orcl1' ;
alter system set cluster_interconnects = '172.16.2.167' scope=spfile sid='orcl2' ;
⑨添加standby日志组,clear logfile
alter database add standby logfile thread 1 ('+DATA/vmorcl/onlinelog/std_redo01_1.log','+DATA/vmorcl/onlinelog/std_redo01_2.log') size 512M;
.......
alter database add standby logfile thread 1 ('+DATA/vmorcl/onlinelog/std_redo06_1.log','+DATA/vmorcl/onlinelog/std_redo06_2.log') size 512M;
alter database add standby logfile thread 2 ('+DATA/vmorcl/onlinelog/std_redo07_1.log','+DATA/vmorcl/onlinelog/std_redo07_2.log') size 512M;
......
alter database add standby logfile thread 2 ('+DATA/vmorcl/onlinelog/std_redo12_1.log','+DATA/vmorcl/onlinelog/std_redo12_2.log') size 512M;
alter database clear logfile group 1;
......
5、配置监听
vi /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
orcltds =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.155)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.156)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
vmorcltds =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.163)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.40.164)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = vmorcl)
)
)
分别在主备节点上远程连接测试
6、查看归档日志是否传到备机
select name from v$archived_log;
查看DG的几个进程RFS,LNS,MRP,LSP的状态
select process,sid,status from v$managed_standby;
备机应用日志:
recover managed standby database using current logfile disconnect from session;
DG搭建完成!