Oracle Version:11.2.0.3.0
Primary端:
双节点的RAC,scan使用DNS解析,跑两个实例(JSTDB&PAYDB)
Standby端:
单机的Dataguard
1.设置网络环境;
vi /etc/hosts
192.168.253.101 rac1.test.com rac1
192.168.253.102 rac2.test.com rac2
192.168.253.103 rac1-vip.test.com rac1-vip
192.168.253.104 rac2-vip.test.com rac2-vip
10.10.10.11 rac1-priv.test.com rac1-priv
10.10.10.12 rac2-priv.test.com rac2-priv
192.168.253.200 standby
vi /etc/resolv.conf
nameserver 192.168.253.100
nslookup scan.test.com
Server:192.168.253.100
Address:192.168.253.100#53
Name:scan.test.com
Address: 192.168.253.107
Name:scan.test.com
Address: 192.168.253.106
Name:scan.test.com
Address: 192.168.253.105
2.修改force logging;
select force_logging from v$database;
alter database force logging;
--------------------------------------分割线 --------------------------------------
基于同一主机配置 Oracle 11g Data Guard
Oracle Data Guard (RAC+DG) 归档删除策略及脚本
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法
--------------------------------------分割线 --------------------------------------
3.查看并添加standby logfile;
set line 180 pages 1000
col member for a50
select * from v$logfile order by GROUP#;
alter system set standby_file_management=manual scope=both sid='*';
alter database add standby logfile thread 1 group 5 '+DATA/jstdb/onlinelog/standby_redo1-1.log' size 50M;
alter database add standby logfile thread 1 group 6 '+DATA/jstdb/onlinelog/standby_redo1-2.log' size 50M;
alter database add standby logfile thread 1 group 7 '+DATA/jstdb/onlinelog/standby_redo1-3.log' size 50M;
alter database add standby logfile thread 1 group 8 '+DATA/jstdb/onlinelog/standby_redo1-4.log' size 50M;
alter database add standby logfile thread 2 group 9 '+DATA/jstdb/onlinelog/standby_redo2-1.log' size 50M;
alter database add standby logfile thread 2 group 10 '+DATA/jstdb/onlinelog/standby_redo2-2.log' size 50M;
alter database add standby logfile thread 2 group 11 '+DATA/jstdb/onlinelog/standby_redo2-3.log' size 50M;
alter database add standby logfile thread 2 group 12 '+DATA/jstdb/onlinelog/standby_redo2-4.log' size 50M;
alter system set standby_file_management=auto scope=both sid='*';
4.收集主库的相关信息;
set line 180 pages 1000
col value for a90
col name for a50
select name,value from v$parameter
where name in ('db_name',
'db_unique_name',
'log_archive_config',
'log_archive_dest_1',
'log_archive_dest_2',
'log_archive_dest_state_1',
'log_archive_dest_state_2',
'remote_login_passwordfile',
'remote_listener',
'log_archive_format',
'log_archive_max_processes',
'fal_server','fal_client',
'db_file_name_convert',
'log_file_name_convert',
'standby_file_management');
5.创建本地硬盘的归档日志目录以及rman的备份目录;
mkdir -p /u01/arch/JSTDB
chown -R oracle.oinstall /u01/arch/
mkdir -p /u01/rman/JSTDB
chown -R oracle.oinstall /u01/rman/
6.修改主库的DG配置;
ALTER SYSTEM SET DB_UNIQUE_NAME=JSTDB scope=both sid='*';
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(JSTDB,JSTDG1)' scope=both sid='*';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=+FRA/JSTDB/ARCHIVELOG/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JSTDB' scope=both sid='*';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=JSTDG1 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JSTDG1' scope=both sid='*';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both sid='*';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both sid='*';
ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=SHARED scope=spfile sid='*';
ALTER SYSTEM SET REMOTE_LISTENER='scan.test.com:1521' scope=spfile sid='*';
ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=8 SCOPE=both sid='*';
ALTER SYSTEM SET FAL_CLIENT=JSTDB SCOPE=both sid='*';
ALTER SYSTEM SET FAL_SERVER=JSTDG1 SCOPE=both sid='*';
ALTER SYSTEM SET db_file_name_convert='/u01/app/oracle/oradata/JSTDG1/','+DATA/JSTDB/' SCOPE=spfile sid='*';
ALTER SYSTEM SET log_file_name_convert='/u01/app/oracle/oradata/JSTDG1/onlinelog/','+DATA/JSTDB/onlinelog/','/u01/app/oracle/oradata/JSTDG1/onlinelog/','+FRA/JSTDB/onlinelog/','/u01/arch/JSTDG1/','+FRA/JSTDB/ARCHIVELOG/' SCOPE=spfile sid='*';
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO SCOPE=both sid='*';
修改archivelog的格式
alter system set log_archive_format='arch_%r_%t_%s.arc' scope=spfile sid='*';
shutdown immediate
startup
7.创建standby数据库的pfile文件;
create pfile='/u01/rman/initJSTDB.ora' from spfile;