RMAN恢復(rman只備份資料庫,但不備份歸檔,歸檔透過簡單的rsync或scp來傳送到異地備份)
只為研究研究一下
備份
[oracle@GGS ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 19 10:54:48 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1290862477)
RMAN> backup incremental level 0 device type disk format '/oracle/%U' database ;
Starting backup at 19-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf
input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf
input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: starting piece 1 at 19-JAN-12
channel ORA_DISK_1: finished piece 1 at 19-JAN-12
piece handle=/oracle/0bn159m2_1_1 tag=TAG20120119T110433 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:14
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 19-JAN-12
channel ORA_DISK_1: finished piece 1 at 19-JAN-12
piece handle=/oracle/0cn159od_1_1 tag=TAG20120119T110433 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 19-JAN-12
RMAN> sql 'alter system archive log current';
sql statement: alter system archive log current
RMAN> quit
Recovery Manager complete.
[oracle@GGS ~]$
恢復(刪除資料檔案,控制檔案,spfile)
[oracle@GGS ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 19 11:11:42 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> restore spfile from '/oracle/0cn159od_1_1';-------------需要啟動例項才能從備份片中恢復spfile
Starting restore at 19-JAN-12
using target database control file instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/19/2012 11:13:47
RMAN-12010: automatic channel allocation initialization failed
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
RMAN> startup force nomount -------------啟動oracle預設的例項,看其sga與原來spfile的記憶體分配是不一樣的
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/db_1/dbs/initorcl.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 2094736 bytes
Variable Size 67111280 bytes
Database Buffers 83886080 bytes
Redo Buffers 6291456 bytes
RMAN> restore spfile from '/oracle/0cn159od_1_1';
Starting restore at 19-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK
channel ORA_DISK_1: autobackup found: /oracle/0cn159od_1_1
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 19-JAN-12
RMAN> startup force nomount
Oracle instance started
Total System Global Area 109051904 bytes
Fixed Size 2094352 bytes
Variable Size 67111664 bytes
Database Buffers 33554432 bytes
Redo Buffers 6291456 bytes
RMAN> restore controlfile from '/oracle/0cn159od_1_1'
2> ;
Starting restore at 19-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:06
output filename=/oracle/oradata/orcl/control01.ctl
output filename=/oracle/oradata/orcl/control02.ctl
output filename=/oracle/oradata/orcl/control03.ctl
Finished restore at 19-JAN-12
RMAN> sql ' alter database mount';
sql statement: alter database mount
released channel: ORA_DISK_1
RMAN> restore database;
Starting restore at 19-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/orcl/system01.dbf
restoring datafile 00002 to /oracle/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/0bn159m2_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/0bn159m2_1_1 tag=TAG20120119T110433
channel ORA_DISK_1: restore complete, elapsed time: 00:02:10
Finished restore at 19-JAN-12
-----------------------------恢復,把歸檔傳送到原來的歸檔目錄上(即spfile指定的路徑)--------------------------------
RMAN> list backup of archivelog all;-----------rman只記錄了以前的歸檔記錄
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7 19.00K DISK 00:00:01 27-OCT-11
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20111027T092236
Piece Name: /oracle/db_1/dbs/07mq4vqs_1_1
List of Archived Logs in backup set 7
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 36 248331 27-OCT-11 248395 27-OCT-11
---------------------------------------透過SQLPLUS來檢視歸檔的序號-----------------------
[oracle@GGS ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 19 11:25:50 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
idle> recover database;----------透過備份的控制檔案來恢復,並且是不一致性恢復
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
idle> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/oradata/archivelog
Oldest online log sequence 38
Next log sequence to archive 40
Current log sequence 40
idle> recover database until sequence 41;
ORA-00277: illegal option to the UNTIL recovery flag SEQUENCE
idle> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
------------------------------回到rman中做恢復--------------------------------------
RMAN> recover database until sequence 41 ----------------取Current log sequence+1
2> ;
Starting recover at 19-JAN-12
using channel ORA_DISK_1
starting media recovery
archive log filename=/oracle/oradata/archivelog/1_40_763081741.dbf thread=1 sequence=40
media recovery complete, elapsed time: 00:00:02
Finished recover at 19-JAN-12
RMAN>
RMAN> sql 'alter database open';-------必須要resetlogs
sql statement: alter database open
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 01/19/2012 11:46:34
RMAN-11003: failure during parse/execution of SQL statement: alter database open
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
RMAN> sql 'alter database open NORESETLOGS';----不能使用noresetlog
sql statement: alter database open NORESETLOGS
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 01/19/2012 11:48:16
RMAN-11003: failure during parse/execution of SQL statement: alter database open NORESETLOGS
ORA-01588: must use RESETLOGS option for database open
RMAN> sql 'alter database open RESETLOGS';
sql statement: alter database open RESETLOGS
RMAN>
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/786540/viewspace-1057246/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- dg丟失歸檔,使用rman增量備份恢復
- RMAN備份異機恢復
- rman開啟備份優化對備份歸檔的影響優化
- RMAN備份整庫和歸檔日誌的方法
- Oracle設定多個歸檔路徑生成多份歸檔日誌,Rman備份時也只備份其中的一份歸檔日誌Oracle
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- rman 增量備份恢復
- RMAN備份恢復技巧
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- 12 使用RMAN備份和恢復檔案
- rman備份異機恢復(原創)
- ORACLE DG從庫 Rman備份恢復Oracle
- 透過RMAN備份standby database成功恢復還原Database
- RMAN備份恢復典型案例——資料檔案存在壞快
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- 使用RMAN備份資料庫資料庫
- RMAN備份恢復效能優化優化
- RMAN備份與恢復測試
- RMAN備份恢復典型案例——異機恢復未知DBID
- ORACLE NBU調取oracle rman指令碼備份歸檔不自動刪除歸檔Oracle指令碼
- 利用RMAN備份重建資料庫資料庫
- 【備份】RMAN中對控制檔案的幾種備份方法
- Oracle 備份恢復篇之RMAN catalogOracle
- oracle 如何不備份已經備份的歸檔Oracle
- 【RMAN】RMAN備份至ASMASM
- Oracle使用備份檔案集恢復歸檔日誌Oracle
- RMAN備份概述
- 【RMAN】RMAN的備份保留策略
- oracle rman備份歸檔日誌需要先切換日誌嗎Oracle
- RMAN的備份原理
- ManagerDB 備份檔案管理與異地備份
- 備份與恢復:polardb資料庫備份與恢復資料庫
- 使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap
- RMAN備份恢復典型案例——ORA-00245
- 從備份片中恢復某個指定得歸檔或者資料檔案
- RMAN備份進度
- rman 備份指令碼指令碼
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- 【RMAN】在多租戶環境下的RMAN備份及恢復