ORACLE利用STANDBY端RMAN备份进行数据恢复
这里记录一下流程,有我和同事问心进行测试
dataguard主库和物理备库主要是controlfile文件有区别,用restore可以查看含有primary,standby关键字
RMAN> restore ;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found ";": expecting one of: "archivelog, channel, check, controlfile, database, datafile, device, force, from, high, preview, primary, skip readonly, spfile, standby, tablespace, to restore point, until restore point, until, validate, ("
RMAN-01007: at line 1 column 9 file: standard input
RMAN> restore primary;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found ";": expecting one of: "controlfile"
RMAN-01007: at line 1 column 16 file: standard input
利用物理备库rman备份文件恢复过程:
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1043886080 bytes
Fixed Size 2259840 bytes
Variable Size 775947392 bytes
Database Buffers 260046848 bytes
Redo Buffers 5632000 bytes
[oracle@std]$ rman target/
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Sep 26 15:09:14 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: DG (not mounted)
RMAN> restore primary controlfile from '/u01/app/oracle/product/11.2.0/dbhome1/dbs/c-1832575162-20160926-01';
Starting restore at 26-SEP-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/dg/control01.ctl
output file name=/u01/app/oracle/oradata/dg/control02.ctl
Finished restore at 26-SEP-16
RMAN> sql 'alter database mount';
sql statement: alter database mount
released channel: ORA_DISK_1
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
------------------------------------------------------------ ------------------------------------------------
MOUNTED PRIMARY
RMAN> restore database;
Starting restore at 26-SEP-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=10 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/dg/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/dg/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/dg/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/dg/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/dg/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/dg/lieb01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome1/dbs/19rgpgsu_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome1/dbs/19rgpgsu_1_1 tag=TAG20160926T145629
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:56
Finished restore at 26-SEP-16
RMAN> recover database;
Starting recover at 26-SEP-16
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 0 is already on disk as file /u01/app/oracle/oradata/dg/redo03.log
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=19
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome1/dbs/18rgpgss_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome1/dbs/18rgpgss_1_1 tag=TAG20160926T145628
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/oracle/archivelog/DG/1_19_922121441.dbf thread=1 sequence=19
channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=20
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome1/dbs/1argph09_1_1
channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome1/dbs/1argph09_1_1 tag=TAG20160926T145817
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/home/oracle/archivelog/DG/1_20_922121441.dbf thread=1 sequence=20
unable to find archived log
archived log thread=1 sequence=21
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/26/2016 15:20:49
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 21 and starting SCN of 1402274
SQL> alter database open resetlogs;
Database altered.
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
正文到此结束