一套dg出现gap现象,不幸的是备库需要的归档在主库已经被删除,需要重做dg,
当然并不是全部的重建,参数文件的一些参数是不用调整了。
备份下主库:
run
{
allocate channel c1 device type disk rate 10000M;
allocate channel c2 device type disk rate 10000M;
allocate channel c3 device type disk rate 10000M;
backup as compressed backupset full database format '/u01/backup_2014_11_27/FULL_%d_%T_%s.bak' include current controlfile for standby; --由于是异地,压缩备份。
release channel c1;
release channel c2;
release channel c3;
}
备库操作。
1.删除原来的控制文件
ASMCMD> rm controlfile
ASMCMD> ls
ASMCMD> cd ..
ASMCMD-8002: entry 'controlfile' does not exist in directory '+REDO/jl/' --如果你删除这个以后就不会再存在这个path 所以就会报错
2.rman恢复控制文件
RMAN> restore controlfile from '/u01/backup_2014_10_27/FULL_MAPP_20141027_1759.bak';
Starting restore at 02-NOV-14
using channel ORA_DISK_1
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=+REDO/mapp_jl/controlfile/controlfile
Finished restore at 02-NOV-14
RMAN>
查看控制文件是否存在
ASMCMD> ls
ONLINELOG/
ASMCMD> ls
CONTROLFILE/
ONLINELOG/
3.原来库启动mount
SQL> alter database mount;
Database altered.
SQL>
4.删除数据文件
ASMCMD> cd datafile
ASMCMD> ls
DATA_PMM.359.861994829
EXPLORATION.320.852507913
MCMS_BIZ.334.852507905
MCMS_LOG.323.852507911
MCONBIZ_DATA.310.852507915
MCONLOG_DATA.315.852507913
MCONTACTBIZ_DATA.321.852507913
MCONTACTLOG_DATA.313.852507915
MCONTACT_BIZ.342.852507911
MCONTACT_LOG.324.852507911
MDISBIZ_DATA.318.852507913
MDISLOG_DATA.312.852507915
MDIS_BIZ.339.852507913
MDIS_LOG.335.852507913
MERS_BIZ.346.852507909
MERS_LOG.344.852507911
MEXP_BIZ.341.852507891
MEXP_LOG.337.852507911
MFASLOGUSR_DATA.316.852507913
MFSBIZUSR_DATA.322.852507913
MIMS_BIZ.343.852507913
MIMS_LOG.336.852507911
MPORTAL_BIZ.338.852507911
MPORTAL_LOG.273.852507911
MPORTAL_SESSION.345.852507911
MTEXTTS_DATA.314.852507915
MTRACEBIZ_DATA.357.861994195
MTRACELOG_DATA.358.861994195
MVIDEOBIZ_DATA.317.852507913
MVIDEOLOG_DATA.319.852507913
MVIDEOLY_DATA.309.852507915
SYSAUX.325.852507911
SYSTEM.326.852507891
UNDOTBS1.332.852507899
UNDOTBS2.333.852507911
USERS.311.852507915
ASMCMD> pwd
+data/mapp_jl/datafile
ASMCMD> rm -rf *
ASMCMD> ls
ASMCMD-8002: entry 'datafile' does not exist in directory '+data/mapp_jl/'
ASMCMD> ls
ASMCMD-8002: entry 'datafile' does not exist in directory '+data/mapp_jl/'
ASMCMD>
ASMCMD> cd datafile
ASMCMD> ls
exploration_temp.dbf
mcontactbiz_data_temp.dbf
mcontactlog_data_temp.dbf
mdisbiz_data_temp.dbf
mdislog_data_temp.dbf
mfaslogusr_data_temp.dbf
mfsbizusr_data_temp.dbf
mvideobiz_data_temp.dbf
mvideolog_data_temp.dbf
ASMCMD> pwd
+data/mapp/datafile
ASMCMD> rm -rf *
ASMCMD>
5.恢复数据文件
run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
restore database ;
switch datafile all;
release channel c1;
release channel c2;
release channel c3;
}
RMAN> run {
allocate channel c1 device type disk;
allocate channel c2 device type disk;
restore database ;
release channel c1;
release channel c2;
}2> 3> 4> 5> 6> 7>
released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=541 instance=MAPP1 device type=DISK
allocated channel: c2
channel c2: SID=551 instance=MAPP1 device type=DISK
Starting restore at 02-NOV-14
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00001 to +DATA/mapp/datafile/system.263.816641087
channel c1: restoring datafile 00002 to +DATA/mapp/datafile/sysaux.264.816641087
channel c1: restoring datafile 00003 to +DATA/mapp/datafile/undotbs1.265.816641087
channel c1: restoring datafile 00004 to +DATA/mapp/datafile/users.266.816641087
channel c1: restoring datafile 00005 to +DATA/mapp/datafile/undotbs2.268.816641245
channel c1: restoring datafile 00006 to +DATA/mapp/datafile/mportal_biz.281.817728747
channel c1: restoring datafile 00007 to +DATA/mapp/datafile/mportal_session.280.817728747
channel c1: restoring datafile 00008 to +DATA/mapp/datafile/mportal_log.279.817728795
channel c1: restoring datafile 00009 to +DATA/mapp/datafile/mcms_biz.271.818077931
channel c1: restoring datafile 00010 to +DATA/mapp/datafile/mcms_log.270.818077931
channel c1: restoring datafile 00011 to +DATA/mapp/datafile/mers_biz.286.818160675
channel c1: restoring datafile 00012 to +DATA/mapp/datafile/mers_log.287.818160675
channel c1: restoring datafile 00013 to +DATA/mapp/datafile/mexp_biz.290.819021993
channel c1: restoring datafile 00014 to +DATA/mapp/datafile/mexp_log.291.819021995
channel c1: restoring datafile 00015 to +DATA/mapp/datafile/mcontact_biz.294.819732975
channel c1: restoring datafile 00016 to +DATA/mapp/datafile/mcontact_log.295.819732975
channel c1: restoring datafile 00017 to +DATA/mapp/datafile/mims_biz.298.820941901
channel c1: restoring datafile 00018 to +DATA/mapp/datafile/mims_log.299.820941901
channel c1: restoring datafile 00019 to +DATA/mapp/datafile/mdis_biz.302.827507433
channel c1: restoring datafile 00020 to +DATA/mapp/datafile/mdis_log.304.827507435
channel c1: restoring datafile 00021 to +DATA/mapp/datafile/mdisbiz_data.dbf
channel c1: restoring datafile 00022 to +DATA/mapp/datafile/mvideobiz_data.dbf
channel c1: restoring datafile 00023 to +DATA/mapp/datafile/mcontactbiz_data.dbf
channel c1: restoring datafile 00024 to +DATA/mapp/datafile/mcontactlog_data.dbf
channel c1: restoring datafile 00025 to +DATA/mapp/datafile/mvideolog_data.dbf
channel c1: restoring datafile 00026 to +DATA/mapp/datafile/mdislog_data.dbf
channel c1: restoring datafile 00027 to +DATA/mapp/datafile/exploration_.dbf
channel c1: restoring datafile 00028 to +DATA/mapp/datafile/mfsbizusr_data.dbf
channel c1: restoring datafile 00029 to +DATA/mapp/datafile/mfaslogusr_data.dbf
channel c1: restoring datafile 00030 to +DATA/mapp/datafile/mconbiz_data.324.841947991
channel c1: restoring datafile 00031 to +DATA/mapp/datafile/mconlog_data.325.841948303
channel c1: restoring datafile 00032 to +DATA/mapp/datafile/mvideoly_data.329.842546591
channel c1: restoring datafile 00033 to +DATA/mapp/datafile/mtextts_data.340.849536235
channel c1: restoring datafile 00034 to +DATA/mapp/datafile/mtracebiz_data.364.854814197
channel c1: restoring datafile 00035 to +DATA/mapp/datafile/mtracelog_data.366.854814217
channel c1: restoring datafile 00036 to +DATA/mapp/datafile/data_pmm.368.856030585
channel c1: reading from backup piece /u01/backup_2014_10_27/FULL_MAPP_20141027_1758.bak
channel c1: reading from backup piece /u01/backup_2014_10_27/FULL_MAPP_20141027_1758.bak
....
channel c1: piece handle=/u01/backup_2014_10_27/FULL_MAPP_20141027_1758.bak tag=TAG20141027T002510
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:21:45
Finished restore at 02-NOV-14
released channel: c1
released channel: c2
RMAN>
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
disconnect
2 3 ;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE
*
ERROR at line 1:
ORA-01665: control file is not a standby control file
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY; --进行下转换
Database altered.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 4.0353E+10 bytes
Fixed Size 2237048 bytes
Variable Size 7381978504 bytes
Database Buffers 3.2749E+10 bytes
Redo Buffers 219447296 bytes
Database mounted.
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
SQL>
主库进行事务.
SQL> create table tmp_lk as select * from dba_objects where rownum=1;
Table created.
SQL> insert into tmp_lk select * from tmp_lk;
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL> select count(*) from tmp_lk;
COUNT(*)
----------
1
SQL> select count(*) from tmp_lk
2 ;
COUNT(*)
----------
2
SQL>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29477587/viewspace-1356917/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29477587/viewspace-1356917/