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
作者微信:
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
作者微信:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-2138061/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何利用Rman對Oracle資料庫進行備份Oracle資料庫
- 如何透過rman的增量備份恢復dataguard中standby端的資料
- 【備份恢復】丟失所有控制檔案,利用RMAN進行恢復操作
- Oracle資料庫備份與恢復之RMANOracle資料庫
- rman備份恢復-rman恢復資料檔案測試
- rman備份-(1) 利用備份級恢復資料檔案和控制檔案
- oracle rman備份驗證和備份/恢復進度監控Oracle
- oracle RMAN 備份恢復總結Oracle
- oracle RMAN 備份恢復總結Oracle
- oracle rman備份恢復的例子Oracle
- Oracle資料庫備份與恢復之RMAN2Oracle資料庫
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- 透過RMAN備份standby database成功恢復還原Database
- 獲取rman備份/恢復執行進度資訊
- 監控資料備份恢復完成進度(EXPDP/IMPDP/RMAN)
- 【備份恢復】Oracle 資料備份與恢復微實踐Oracle
- 【備份恢復】RMAN catalog 恢復目錄資料庫資料庫
- ORACLE DG從庫 Rman備份恢復Oracle
- 循序漸進oracle第7章:備份與恢復之RMAN的簡單備份與恢復Oracle
- mongdb遭遇勒索,用備份進行資料恢復資料恢復
- standby全庫rman備份檔案恢復到異機
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- rman資料庫全庫備份與恢復資料庫
- 非RMAN熱備份資料庫和恢復資料庫
- rman資料備份恢復學習筆記筆記
- RMAN備份恢復原理
- Oracle的RMAN備份恢復,先從進入RMAN開始總結Oracle
- 【備份恢復】從備份恢復資料庫資料庫
- RMAN備份恢復——RAC環境資料庫的備份(zt)資料庫
- RMAN備份恢復--RAC環境資料庫的備份(十)資料庫
- RMAN備份恢復——RAC環境資料庫的備份(一)資料庫
- rman備份恢復-rman入門
- 利用rman全備恢復刪除的資料庫資料庫
- 使用NetBackup進行oracle備份和恢復Oracle
- Oracle備份恢復五(資料泵)Oracle
- Oracle 備份恢復篇之RMAN catalogOracle
- oracle 10g RMAN備份及恢復Oracle 10g
- Oracle塊損壞恢復(有rman備份)Oracle