当前位置: 代码迷 >> 综合 >> Oracle 11gR2 dataguard搭建说明 --- duplicate方式
  详细解决方案

Oracle 11gR2 dataguard搭建说明 --- duplicate方式

热度:25   发布时间:2024-01-12 23:41:07.0

Oracle 11gR2 dataguard 介绍

Oracle 11gR2 dataguard搭建说明 --- rman方式

 

1.配置参数文件

主库参数文件

dg.__db_cache_size=26709327872
dg.__java_pool_size=134217728
dg.__large_pool_size=134217728
dg.__oracle_base='/ora/app/'#ORACLE_BASE set from environment
dg.__pga_aggregate_target=7516192768
dg.__sga_target=30064771072
dg.__shared_io_pool_size=0
dg.__shared_pool_size=2885681152
dg.__streams_pool_size=0
*.audit_file_dest='/ora/app/admin/dg/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/dg/control01.ctl','/ora/app/fast_recovery_area/dg/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='dg'
*.db_recovery_file_dest='/ora/app/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/ora/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dgXDB)'
*.open_cursors=300
*.pga_aggregate_target=7516192768
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=30064771072
*.undo_tablespace='UNDOTBS1'
#dg_parameter
*.db_file_name_convert='/oradata/dg','/oradata/dgtest'
*.db_unique_name='dg'
*.fal_client='dg'
*.fal_server='dgtest'
*.log_archive_config='DG_CONFIG=(dg,dgtest)'
*.log_archive_dest_1='LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg'
*.log_archive_dest_2='SERVICE=dgtest ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgtest COMPRESSION=ENABLE'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=30

备库参数文件

dgtest.__db_cache_size=10737418240
dgtest.__java_pool_size=104857600
dgtest.__large_pool_size=268435456
dgtest.__oracle_base='/ora/app/'#ORACLE_BASE set from environment
dgtest.__pga_aggregate_target=10737418240
dgtest.__sga_target=38654705664
dgtest.__shared_io_pool_size=0
dgtest.__shared_pool_size=5368709120
dgtest.__streams_pool_size=268435456
*.audit_file_dest='/ora/app/admin/dgtest/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/dgtest/control01.ctl','/ora/app/fast_recovery_area/dgtest/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='dgtest'
*.db_recovery_file_dest='/oradata/fra'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/ora/app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dgXDB)'
*.open_cursors=300
*.pga_aggregate_target=1073741824
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=38654705664
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
#dg_parameter
*.db_file_name_convert='/oradata/dg','/oradata/dgtest'
*.db_unique_name='dgtest'
*.fal_client='dgtest'
*.fal_server='dg'
*.log_archive_config='DG_CONFIG=(dg,dgtest)'
*.log_archive_dest_1='LOCATION=/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dgtest'
*.log_archive_dest_2='SERVICE=dg ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dg COMPRESSION=ENABLE'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=30

2.备库创建adump、dpdump、pfile、arch、fra目录

mkdir -p /u01/app/oracle/admin/dgtest/adump
mkdir -p /u01/app/oracle/admin/dgtest/dpdump
mkdir -p /u01/app/oracle/admin/dgtest/pfile
mkdir -p /oradata/fra /ora/app /arch
chwon -R oracle.oinstall /oradata/fra /ora/app /arch

3.主库创建standby_redo文件

alter database add standby logfile group 4 ('/oradata/dg/standby04.log') size 512M;
alter database add standby logfile group 5 ('/oradata/dg/standby05.log') size 512M;
alter database add standby logfile group 6 ('/oradata/dg/standby06.log') size 512M;
alter database add standby logfile group 7 ('/oradata/dg/standby07.log') size 512M;
alter database add standby logfile group 8 ('/oradata/dg/standby08.log') size 512M;

#备库安装软件之后,修改参数文件。主库创建standby

4.同步密码文件

scp /ora/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdg dgtest:/u01/app/oracle/product/11.2.0/db_1/orapwdgtest

5.备库使用pfile启动数据库

startup nomount pfile=’ /u01/app/oracle/product/11.2.0/db_1/dbs/initdgtest.ora’;

6.复制备库

#连接主备库
rman target sys/oracle@dg auxiliary sys/oracle@dgtest
#主备库目录完全一致的情况
duplicate target database for standby nofilenamecheck from active database dorecover;
#主备库目录不一致的情况
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby nofilenamecheck from active database 
dorecover
spfile
parameter_value_convert 'tsldb','tsldbdg'
set instance_name='tsldbdg' 
set db_unique_name='tsldbdg'
set local_listener='tsldbdg'
set db_file_name_convert='/ora/oradata/tsldb/','/ora/oradata/tsldbdg/'
set log_file_name_convert='/ora/oradata/tsldb/','/ora/oradata/tsldbdg/'
set control_files='/ora/oradata/tsldbdg/control01.ctl','/ora/oradata/tsldbdg/control02.ctl','/ora/oradata/tsldbdg/control03.ctl'
set log_archive_dest_1='LOCATION=/ora/arch/ valid_for=(all_logfiles,all_roles) db_unique_name=tsldbdg'
set log_archive_dest_2='SERVICE=tsldb lgwr async valid_for=(online_logfile,primary_role) db_unique_name=tsldb'
set log_archive_max_processes='5'
set standby_file_management='AUTO'
set fal_client='tsldbdg'
set fal_server='tsldb';
release channel c1;
release channel c2;
release channel stby;
}

 

7.案例

run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate auxiliary channel stby1 type disk;
allocate auxiliary channel stby2 type disk;
allocate auxiliary channel stby3 type disk;
allocate auxiliary channel stby4 type disk;
duplicate target database for standby nofilenamecheck from active database ;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel stby1;
release channel stby2;
release channel stby3;
release channel stby4;
}

 日志输出

[oracle@cerpproddb01 ~]$ rman target sys/oracle@db auxiliary sys/oracle@dbdg Recovery Manager: Release 11.2.0.4.0 - Production on Fri May 4 04:02:34 2018Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.connected to target database: DB (DBID=2444650848)
connected to auxiliary database: DB (not mounted)RMAN> run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate auxiliary channel stby1 type disk;
allocate auxiliary channel stby2 type disk;
allocate auxiliary channel stby3 type disk;
allocate auxiliary channel stby4 type disk;
duplicate target database for standby nofilenamecheck from active database ;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel stby1;
release channel stby2;
release channel stby3;
release channel stby4;
19> }using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=1827 device type=DISKallocated channel: c2
channel c2: SID=1884 device type=DISKallocated channel: c3
channel c3: SID=1941 device type=DISKallocated channel: c4
channel c4: SID=1997 device type=DISKallocated channel: stby1
channel stby1: SID=1303 device type=DISKallocated channel: stby2
channel stby2: SID=1345 device type=DISKallocated channel: stby3
channel stby3: SID=1387 device type=DISKallocated channel: stby4
channel stby4: SID=1429 device type=DISKStarting Duplicate Db at 2018-05-04 04:02:45contents of Memory Script:
{backup as copy reusepasswordfile auxiliary format  '/app/oracle/product/11.2.4/db_1/dbs/orapwdbdg'   ;
}
executing Memory ScriptStarting backup at 2018-05-04 04:02:45
Finished backup at 2018-05-04 04:02:47contents of Memory Script:
{backup as copy current controlfile for standby auxiliary format  '/oradata/dbdg/control01.ctl';restore clone primary controlfile to  '/oradata/dbdg/control02.ctl' from '/oradata/dbdg/control01.ctl';
}
executing Memory ScriptStarting backup at 2018-05-04 04:02:47
channel c1: starting datafile copy
copying standby control file
output file name=/app/oracle/product/11.2.4/db_1/dbs/snapcf_db.f tag=TAG20180504T040247 RECID=48 STAMP=975211367
channel c1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2018-05-04 04:02:48Starting restore at 2018-05-04 04:02:48channel stby2: skipped, AUTOBACKUP already found
channel stby3: skipped, AUTOBACKUP already found
channel stby4: skipped, AUTOBACKUP already found
channel stby1: copied control file copy
Finished restore at 2018-05-04 04:02:56contents of Memory Script:
{sql clone 'alter database mount standby database';
}
executing Memory Scriptsql statement: alter database mount standby databasecontents of Memory Script:
{set newname for tempfile  5 to "/oradata/dbdg/tmp01.dbf";set newname for tempfile  6 to "/oradata/dbdg/tmp02.dbf";set newname for tempfile  7 to "/oradata/dbdg/tmp03.dbf";set newname for tempfile  8 to "/oradata/dbdg/tmp04.dbf";switch clone tempfile all;set newname for datafile  1 to "/oradata/dbdg/system01.dbf";set newname for datafile  2 to "/oradata/dbdg/sysaux01.dbf";set newname for datafile  3 to "/oradata/dbdg/undotbs01.dbf";set newname for datafile  4 to "/oradata/dbdg/users01.dbf";set newname for datafile  5 to "/oradata/dbdg/zs01.dbf";set newname for datafile  6 to "/oradata/dbdg/zs02.dbf";set newname for datafile  7 to "/oradata/dbdg/zs_index_01.dbf";set newname for datafile  8 to "/oradata/dbdg/zs_index_02.dbf";set newname for datafile  9 to "/oradata/dbdg/pzjk01.dbf";set newname for datafile  10 to "/oradata/dbdg/zs03.dbf";set newname for datafile  11 to "/oradata/dbdg/lnyj.dbf";set newname for datafile  12 to "/oradata/dbdg/yonghong.dbf";set newname for datafile  13 to "/oradata/dbdg/yonghong_02.dbf";set newname for datafile  14 to "/oradata/dbdg/zs_index_03.dbf";set newname for datafile  15 to "/oradata/dbdg/zs_index_04.dbf";set newname for datafile  16 to "/oradata/dbdg/zs04.dbf";set newname for datafile  17 to "/oradata/dbdg/zs05.dbf";set newname for datafile  18 to "/oradata/dbdg/zs_index_05.dbf";set newname for datafile  19 to "/oradata/dbdg/zs_index_06.dbf";set newname for datafile  20 to "/oradata/dbdg/zs06.dbf";set newname for datafile  21 to "/oradata/dbdg/zs07.dbf";set newname for datafile  22 to "/oradata/dbdg/zs_index_07.dbf";set newname for datafile  23 to "/oradata/dbdg/zs_index_08.dbf";set newname for datafile  24 to "/oradata/dbdg/zs08.dbf";set newname for datafile  25 to "/oradata/dbdg/zs_index_09.dbf";set newname for datafile  26 to "/oradata/dbdg/zs_index_10.dbf";set newname for datafile  27 to "/oradata/dbdg/users02.dbf";set newname for datafile  28 to "/oradata/dbdg/zs09.dbf";backup as copy reusedatafile  1 auxiliary format "/oradata/dbdg/system01.dbf"   datafile 2 auxiliary format "/oradata/dbdg/sysaux01.dbf"   datafile 3 auxiliary format "/oradata/dbdg/undotbs01.dbf"   datafile 4 auxiliary format "/oradata/dbdg/users01.dbf"   datafile 5 auxiliary format "/oradata/dbdg/zs01.dbf"   datafile 6 auxiliary format "/oradata/dbdg/zs02.dbf"   datafile 7 auxiliary format "/oradata/dbdg/zs_index_01.dbf"   datafile 8 auxiliary format "/oradata/dbdg/zs_index_02.dbf"   datafile 9 auxiliary format "/oradata/dbdg/zjk01.dbf"   datafile 10 auxiliary format "/oradata/dbdg/zs03.dbf"   datafile 11 auxiliary format "/oradata/dbdg/lnyj.dbf"   datafile 12 auxiliary format "/oradata/dbdg/yonghong.dbf"   datafile 13 auxiliary format "/oradata/dbdg/yonghong_02.dbf"   datafile 14 auxiliary format "/oradata/dbdg/zs_index_03.dbf"   datafile 15 auxiliary format "/oradata/dbdg/zs_index_04.dbf"   datafile 16 auxiliary format "/oradata/dbdg/zs04.dbf"   datafile 17 auxiliary format "/oradata/dbdg/zs05.dbf"   datafile 18 auxiliary format "/oradata/dbdg/zs_index_05.dbf"   datafile 19 auxiliary format "/oradata/dbdg/zs_index_06.dbf"   datafile 20 auxiliary format "/oradata/dbdg/zs06.dbf"   datafile 21 auxiliary format "/oradata/dbdg/zs07.dbf"   datafile 22 auxiliary format "/oradata/dbdg/zs_index_07.dbf"   datafile 23 auxiliary format "/oradata/dbdg/zs_index_08.dbf"   datafile 24 auxiliary format "/oradata/dbdg/zs08.dbf"   datafile 25 auxiliary format "/oradata/dbdg/zs_index_09.dbf"   datafile 26 auxiliary format "/oradata/dbdg/zs_index_10.dbf"   datafile 27 auxiliary format "/oradata/dbdg/users02.dbf"   datafile 28 auxiliary format "/oradata/dbdg/zs09.dbf"   ;sql 'alter system archive log current';
}
executing Memory Scriptexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMErenamed tempfile 5 to /oradata/dbdg/tmp01.dbf in control file
renamed tempfile 6 to /oradata/dbdg/tmp02.dbf in control file
renamed tempfile 7 to /oradata/dbdg/tmp03.dbf in control file
renamed tempfile 8 to /oradata/dbdg/tmp04.dbf in control fileexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEexecuting command: SET NEWNAMEStarting backup at 2018-05-04 04:03:01
channel c1: starting datafile copy
input datafile file number=00003 name=/oradata/db/undotbs01.dbf
channel c2: starting datafile copy
input datafile file number=00021 name=/oradata/db/cerpzs07.dbf
channel c3: starting datafile copy
input datafile file number=00002 name=/oradata/db/sysaux01.dbf
channel c4: starting datafile copy
input datafile file number=00005 name=/oradata/db/zs01.dbf
output file name=/oradata/dbdg/zs01.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:10:15
channel c4: starting datafile copy
input datafile file number=00006 name=/oradata/db/zs02.dbf
output file name=/oradata/dbdg/sysaux01.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:12:00
channel c3: starting datafile copy
input datafile file number=00007 name=/oradata/db/zs_index_01.dbf
output file name=/oradata/dbdg/zs07.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:13:55
channel c2: starting datafile copy
input datafile file number=00008 name=/oradata/db/zs_index_02.dbf
output file name=/oradata/dbdg/undotbs01.dbf tag=TAG20180504T040301
channel c1: datafile copy complete, elapsed time: 00:18:01
channel c1: starting datafile copy
input datafile file number=00010 name=/oradata/db/zs03.dbf
output file name=/oradata/dbdg/zs02.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:10:01
channel c4: starting datafile copy
input datafile file number=00016 name=/oradata/db/zs04.dbf
output file name=/oradata/dbdg/zs_index_01.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:11:11
channel c3: starting datafile copy
input datafile file number=00017 name=/oradata/db/zs05.dbf
output file name=/oradata/dbdg/zs_index_02.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:11:21
channel c2: starting datafile copy
input datafile file number=00018 name=/oradata/db/zs_index_05.dbf
output file name=/oradata/dbdg/zs03.dbf tag=TAG20180504T040301
channel c1: datafile copy complete, elapsed time: 00:11:00
channel c1: starting datafile copy
input datafile file number=00020 name=/oradata/db/zs06.dbf
output file name=/oradata/dbdg/zs04.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:11:10
channel c4: starting datafile copy
input datafile file number=00015 name=/oradata/db/zs_index_04.dbf
output file name=/oradata/dbdg/zs05.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:09:50
channel c3: starting datafile copy
input datafile file number=00012 name=/oradata/db/yonghong.dbf
output file name=/oradata/dbdg/cerpzs_index_05.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:11:31
channel c2: starting datafile copy
input datafile file number=00013 name=/oradata/db/yonghong_02.dbf
output file name=/oradata/dbdg/zs06.dbf tag=TAG20180504T040301
channel c1: datafile copy complete, elapsed time: 00:13:21
channel c1: starting datafile copy
input datafile file number=00014 name=/oradata/db/zs_index_03.dbf
output file name=/oradata/dbdg/yonghong.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:09:24
channel c3: starting datafile copy
input datafile file number=00019 name=/oradata/db/zs_index_06.dbf
output file name=/oradata/dbdg/yonghong_02.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:06:33
channel c2: starting datafile copy
input datafile file number=00022 name=/oradata/db/zs_index_07.dbf
output file name=/oradata/dbdg/zs_index_04.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:12:59
channel c4: starting datafile copy
input datafile file number=00023 name=/oradata/db/zs_index_08.dbf
output file name=/oradata/dbdg/zs_index_07.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:06:40
channel c2: starting datafile copy
input datafile file number=00024 name=/oradata/db/zs08.dbf
output file name=/oradata/dbdg/zs_index_08.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:06:21
channel c4: starting datafile copy
input datafile file number=00025 name=/oradata/db/zs_index_09.dbf
output file name=/oradata/dbdg/zs_index_03.dbf tag=TAG20180504T040301
channel c1: datafile copy complete, elapsed time: 00:09:09
channel c1: starting datafile copy
input datafile file number=00026 name=/oradata/db/zs_index_10.dbf
output file name=/oradata/dbdg/zs_index_06.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:09:13
channel c3: starting datafile copy
input datafile file number=00028 name=/oradata/db/zs09.dbf
output file name=/oradata/dbdg/zs08.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:07:32
channel c2: starting datafile copy
input datafile file number=00001 name=/oradata/db/system01.dbf
output file name=/oradata/dbdg/zs_index_09.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:07:12
channel c4: starting datafile copy
input datafile file number=00011 name=/oradata/db/lnyj.dbf
output file name=/oradata/dbdg/zs_index_10.dbf tag=TAG20180504T040301
channel c1: datafile copy complete, elapsed time: 00:07:22
channel c1: starting datafile copy
input datafile file number=00009 name=/oradata/db/zjk01.dbf
output file name=/oradata/dbdg/zs09.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:08:00
channel c3: starting datafile copy
input datafile file number=00004 name=/oradata/db/users01.dbf
output file name=/oradata/dbdg/system01.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:03:30
channel c2: starting datafile copy
input datafile file number=00027 name=/oradata/db/users02.dbf
output file name=/oradata/dbdg/cerpzjk01.dbf tag=TAG20180504T040301
channel c1: datafile copy complete, elapsed time: 00:02:46
output file name=/oradata/dbdg/users02.dbf tag=TAG20180504T040301
channel c2: datafile copy complete, elapsed time: 00:01:05
output file name=/oradata/dbdg/users01.dbf tag=TAG20180504T040301
channel c3: datafile copy complete, elapsed time: 00:02:31
output file name=/oradata/dbdg/lnyj.dbf tag=TAG20180504T040301
channel c4: datafile copy complete, elapsed time: 00:04:11
Finished backup at 2018-05-04 05:05:11sql statement: alter system archive log currentcontents of Memory Script:
{switch clone datafile all;
}
executing Memory Scriptdatafile 1 switched to datafile copy
input datafile copy RECID=48 STAMP=975215099 file name=/oradata/dbdg/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=49 STAMP=975215099 file name=/oradata/dbdg/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=50 STAMP=975215099 file name=/oradata/dbdg/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=51 STAMP=975215099 file name=/oradata/dbdg/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=52 STAMP=975215099 file name=/oradata/dbdg/zs01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=53 STAMP=975215099 file name=/oradata/dbdg/zs02.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=54 STAMP=975215099 file name=/oradata/cerpdbdg/cerpzs_index_01.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=55 STAMP=975215099 file name=/oradata/cerpdbdg/cerpzs_index_02.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=56 STAMP=975215099 file name=/oradata/dbdg/zjk01.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=57 STAMP=975215099 file name=/oradata/dbdg/zs03.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=58 STAMP=975215099 file name=/oradata/dbdg/lnyj.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=59 STAMP=975215099 file name=/oradata/dbdg/yonghong.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=60 STAMP=975215099 file name=/oradata/dbdg/yonghong_02.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=61 STAMP=975215099 file name=/oradata/dbdg/zs_index_03.dbf
datafile 15 switched to datafile copy
input datafile copy RECID=62 STAMP=975215099 file name=/oradata/dbdg/zs_index_04.dbf
datafile 16 switched to datafile copy
input datafile copy RECID=63 STAMP=975215099 file name=/oradata/dbdg/zs04.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=64 STAMP=975215099 file name=/oradata/dbdg/zs05.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=65 STAMP=975215099 file name=/oradata/dbdg/zs_index_05.dbf
datafile 19 switched to datafile copy
input datafile copy RECID=66 STAMP=975215099 file name=/oradata/dbdg/zs_index_06.dbf
datafile 20 switched to datafile copy
input datafile copy RECID=67 STAMP=975215100 file name=/oradata/dbdg/zs06.dbf
datafile 21 switched to datafile copy
input datafile copy RECID=68 STAMP=975215100 file name=/oradata/dbdg/zs07.dbf
datafile 22 switched to datafile copy
input datafile copy RECID=69 STAMP=975215100 file name=/oradata/dbdg/zs_index_07.dbf
datafile 23 switched to datafile copy
input datafile copy RECID=70 STAMP=975215100 file name=/oradata/dbdg/zs_index_08.dbf
datafile 24 switched to datafile copy
input datafile copy RECID=71 STAMP=975215100 file name=/oradata/dbdg/zs08.dbf
datafile 25 switched to datafile copy
input datafile copy RECID=72 STAMP=975215100 file name=/oradata/dbdg/zs_index_09.dbf
datafile 26 switched to datafile copy
input datafile copy RECID=73 STAMP=975215100 file name=/oradata/dbdg/zs_index_10.dbf
datafile 27 switched to datafile copy
input datafile copy RECID=74 STAMP=975215100 file name=/oradata/dbdg/users02.dbf
datafile 28 switched to datafile copy
input datafile copy RECID=75 STAMP=975215100 file name=/oradata/dbdg/zs09.dbf
Finished Duplicate Db at 2018-05-04 05:05:56released channel: c1released channel: c2released channel: c3released channel: c4released channel: stby1released channel: stby2released channel: stby3released channel: stby4RMAN> 

8.备库创建standby redo文件

alter database add standby logfile group 4 ('/data/dbdg/standby04.log') size 512M;
alter database add standby logfile group 5 ('/data/dbdg/standby05.log') size 512M;
alter database add standby logfile group 6 ('/data/dbdg/standby06.log') size 512M;
alter database add standby logfile group 7 ('/data/dbdg/standby07.log') size 512M;
alter database add standby logfile group 8 ('/data/dbdg/standby08.log') size 512M;
alter database add standby logfile group 9 ('/data/dbdg/standby09.log') size 512M;

9.备库启动DG

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
recover managed standby database cancel;

10.查看DG状态

SQL> select open_mode,database_role,switchover_status from v$database;OPEN_MODE	     DATABASE_ROLE    SWITCHOVER_STATUS
-------------------- ---------------- --------------------
READ WRITE	     PRIMARY	      UNRESOLVABLE GAP  SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME, APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;SQL> select name,open_mode,switchover#,database_role,switchover_status,guard_status,db_unique_name from v$database;NAME	  OPEN_MODE	       SWITCHOVER# DATABASE_ROLE    SWITCHOVER_STATUS	 GUARD_S DB_UNIQUE_NAME
--------- -------------------- ----------- ---------------- -------------------- ------- ------------------------------
DBDG	  READ ONLY WITH APPLY	1356466709 PHYSICAL STANDBY NOT ALLOWED 	 NONE	 DBDG

 

  相关解决方案