探索ORACLE之RMAN_04非一致性備份
探索ORACLE之RMAN_04非一致性備份
作者:吳偉龍
在上一篇博文中提到了資料庫的一致性備份,操作非常的簡單。只需要一條很短的命令即可完成,但是如果要建立一正式庫的備份,一般不建議用一致性備份,也不建議用很簡單的名來完成。而是更多的採用指令碼實現非一致性備份,這樣將可透過backup+archive log+redo有效的將資料恢復到最近一次改變的狀態,可以達到資料的丟失最小化。
建立非一致性備份
建立非一致性備份資料庫必須處於歸檔(archive log)模式,因為非一致性備份的資料庫檔案和控制檔案的SCN號可能會不一致。並且可以在資料庫開啟並不影響業務的情況下完成資料的備份工作;那麼這樣的備份將是不一致性的備份,那麼如果要恢復可以透過backup+archive log+redo來恢復到最近一次日誌切換時候的資料,而不是最後一次備份時候的資料。
1.1檢查歸檔狀態:
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 9
Current log sequence 11
SQL>
必須開啟歸檔歸檔
SQL> shutdown immediate -----開啟歸檔必須將資料庫重啟到mount狀態
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 79693416 bytes
Database Buffers 197132288 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> alter database archivelog; ----執行開啟歸檔命令
Database altered.
SQL> alter database open; -----開啟資料庫
Database altered.
SQL> col instance_name format a15
SQL> select instance_name,status from v$instance; ----檢視資料庫狀態
INSTANCE_NAME STATUS
--------------- ------------------------
WWL OPEN
SQL>
SQL> archive log list; ------檢視歸檔狀態,已經是歸檔狀態了
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 9
Next log sequence to archive 11
Current log sequence 11
SQL>
1.2執行備份 (執行備份命令實際上是跟一致性備份是一樣的)
1.2.1 備份資料庫
RMAN> backup database;
Starting backup at 23-MAY-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=145 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/DBData/WWL/system01.dbf
input datafile fno=00003 name=/DBData/WWL/sysaux01.dbf
input datafile fno=00002 name=/DBData/WWL/undotbs01.dbf
input datafile fno=00004 name=/DBData/WWL/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-MAY-12
channel ORA_DISK_1: finished piece 1 at 23-MAY-12
piece handle=/DBBak/bak_WWL_05_23_0anbmtkr_1_1 tag=TAG20120523T121210 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:46
Finished backup at 23-MAY-12
Starting Control File and SPFILE Autobackup at 23-MAY-12
piece handle=/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-00 comment=NONE
Finished Control File and SPFILE Autobackup at 23-MAY-12
RMAN>
1.2.2 備份USER表空間
RMAN> backup tablespace users;
Starting backup at 23-MAY-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/DBData/WWL/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-MAY-12
channel ORA_DISK_1: finished piece 1 at 23-MAY-12
piece handle=/DBBak/bak_WWL_05_23_0cnbn2a3_1_1 tag=TAG20120523T133147 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:04
Finished backup at 23-MAY-12
Starting Control File and SPFILE Autobackup at 23-MAY-12
piece handle=/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-01 comment=NONE
Finished Control File and SPFILE Autobackup at 23-MAY-12
RMAN>
1.2.3 備份資料檔案
RMAN> backup datafile 1,2,3;
Starting backup at 23-MAY-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/DBData/WWL/system01.dbf
input datafile fno=00003 name=/DBData/WWL/sysaux01.dbf
input datafile fno=00002 name=/DBData/WWL/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 23-MAY-12
channel ORA_DISK_1: finished piece 1 at 23-MAY-12
piece handle=/DBBak/bak_WWL_05_23_0enbn2bk_1_1 tag=TAG20120523T133235 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:48
Finished backup at 23-MAY-12
Starting Control File and SPFILE Autobackup at 23-MAY-12
piece handle=/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-02 comment=NONE
Finished Control File and SPFILE Autobackup at 23-MAY-12
RMAN>
1.2.4 備份控制檔案
RMAN> backup current controlfile;
Starting backup at 23-MAY-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 23-MAY-12
channel ORA_DISK_1: finished piece 1 at 23-MAY-12
piece handle=/DBBak/bak_WWL_05_23_0gnbn2je_1_1 tag=TAG20120523T133645 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-MAY-12
Starting Control File and SPFILE Autobackup at 23-MAY-12
piece handle=/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-03 comment=NONE
Finished Control File and SPFILE Autobackup at 23-MAY-12
RMAN>
1.2.5 備份spfile檔案
RMAN> backup spfile;
Starting backup at 23-MAY-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 23-MAY-12
channel ORA_DISK_1: finished piece 1 at 23-MAY-12
piece handle=/DBBak/bak_WWL_05_23_0inbn2l2_1_1 tag=TAG20120523T133737 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 23-MAY-12
Starting Control File and SPFILE Autobackup at 23-MAY-12
piece handle=/DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-04 comment=NONE
Finished Control File and SPFILE Autobackup at 23-MAY-12
RMAN>
1.2.6 檢視我們剛才備份的資訊:
RMAN> list backup;
如下資訊是之前做的備份:
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 522.59M DISK 00:00:59 18-MAY-12
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20120518T185700
Piece Name: /DBBak/bak_WWL_05_18_04nbaffs_1_1
List of Datafiles in backup set 2
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 618100 18-MAY-12 /DBData/WWL/system01.dbf
2 Full 618100 18-MAY-12 /DBData/WWL/undotbs01.dbf
3 Full 618100 18-MAY-12 /DBData/WWL/sysaux01.dbf
4 Full 618100 18-MAY-12 /DBData/WWL/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 6.80M DISK 00:00:02 18-MAY-12
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20120518T185806
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120518-01
Control File Included: Ckp SCN: 618100 Ckp time: 18-MAY-12
SPFILE Included: Modification time: 18-MAY-12
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Full 523.54M DISK 00:01:09 21-MAY-12
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20120521T145403
Piece Name: /DBBak/bak_WWL_05_21_06nbhucb_1_1
List of Datafiles in backup set 4
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 622304 21-MAY-12 /DBData/WWL/system01.dbf
2 Full 622304 21-MAY-12 /DBData/WWL/undotbs01.dbf
3 Full 622304 21-MAY-12 /DBData/WWL/sysaux01.dbf
4 Full 622304 21-MAY-12 /DBData/WWL/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Full 6.80M DISK 00:00:01 21-MAY-12
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20120521T145520
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120521-00
Control File Included: Ckp SCN: 622304 Ckp time: 21-MAY-12
SPFILE Included: Modification time: 21-MAY-12
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Full 368.00K DISK 00:00:00 21-MAY-12
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20120521T151349
Piece Name: /DBBak/bak_WWL_05_21_08nbhvhe_1_1
List of Datafiles in backup set 6
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 622968 21-MAY-12 /DBData/WWL/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7 Full 6.80M DISK 00:00:01 21-MAY-12
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: TAG20120521T151351
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120521-01
Control File Included: Ckp SCN: 622968 Ckp time: 21-MAY-12
SPFILE Included: Modification time: 21-MAY-12
今天的備份資訊如下:
如下是全庫備份資訊:
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 524.66M DISK 00:01:36 23-MAY-12
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: TAG20120523T121210
Piece Name: /DBBak/bak_WWL_05_23_0anbmtkr_1_1
List of Datafiles in backup set 8
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 649219 23-MAY-12 /DBData/WWL/system01.dbf
2 Full 649219 23-MAY-12 /DBData/WWL/undotbs01.dbf
3 Full 649219 23-MAY-12 /DBData/WWL/sysaux01.dbf
4 Full 649219 23-MAY-12 /DBData/WWL/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9 Full 6.80M DISK 00:00:01 23-MAY-12
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20120523T121358
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-00
Control File Included: Ckp SCN: 649233 Ckp time: 23-MAY-12
SPFILE Included: Modification time: 23-MAY-12
如下是備份USER表空間資訊:
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10 Full 432.00K DISK 00:00:01 23-MAY-12
BP Key: 10 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133147
Piece Name: /DBBak/bak_WWL_05_23_0cnbn2a3_1_1
List of Datafiles in backup set 10
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 651081 23-MAY-12 /DBData/WWL/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11 Full 6.80M DISK 00:00:03 23-MAY-12
BP Key: 11 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133151
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-01
Control File Included: Ckp SCN: 651086 Ckp time: 23-MAY-12
SPFILE Included: Modification time: 23-MAY-12
如下是備份資料檔案1,2,3的資訊:
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12 Full 524.61M DISK 00:01:42 23-MAY-12
BP Key: 12 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133235
Piece Name: /DBBak/bak_WWL_05_23_0enbn2bk_1_1
List of Datafiles in backup set 12
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 651104 23-MAY-12 /DBData/WWL/system01.dbf
2 Full 651104 23-MAY-12 /DBData/WWL/undotbs01.dbf
3 Full 651104 23-MAY-12 /DBData/WWL/sysaux01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13 Full 6.80M DISK 00:00:01 23-MAY-12
BP Key: 13 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133424
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-02
Control File Included: Ckp SCN: 651119 Ckp time: 23-MAY-12
SPFILE Included: Modification time: 23-MAY-12
如下備份的是控制檔案資訊:
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
14 Full 6.77M DISK 00:00:01 23-MAY-12
BP Key: 14 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133645
Piece Name: /DBBak/bak_WWL_05_23_0gnbn2je_1_1
Control File Included: Ckp SCN: 651150 Ckp time: 23-MAY-12
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
15 Full 6.80M DISK 00:00:01 23-MAY-12
BP Key: 15 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133648
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-03
Control File Included: Ckp SCN: 651154 Ckp time: 23-MAY-12
SPFILE Included: Modification time: 23-MAY-12
如下是備份spfile檔案的資訊:
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
16 Full 80.00K DISK 00:00:01 23-MAY-12
BP Key: 16 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133737
Piece Name: /DBBak/bak_WWL_05_23_0inbn2l2_1_1
SPFILE Included: Modification time: 23-MAY-12
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
17 Full 6.80M DISK 00:00:02 23-MAY-12
BP Key: 17 Status: AVAILABLE Compressed: NO Tag: TAG20120523T133740
Piece Name: /DBSoft/product/10.2.0/db_1/dbs/c-5520179-20120523-04
Control File Included: Ckp SCN: 651175 Ckp time: 23-MAY-12
SPFILE Included: Modification time: 23-MAY-12
RMAN>
恢復大綜合:
介於Rman恢復的自動性,我們剛才對資料庫的全庫,單表空間,資料檔案控制檔案和引數檔案都做了備份,這些備份的內容是資料庫執行不可缺少的必要元素,通常情況下我們在生產庫中只需要備份這些內容即可。有了這些備份,即使資料庫的的任何資訊丟失,我們都可以得以恢復使得資料庫的正常執行,當然如果我們將archive log 也備份,當然就會更好了,一般情況下這個可以不用備份,備份archive log佔用空間非常大。如果有海量的儲存,當然備份也無妨咯。
Egg:
2.1 刪除資料庫的所有檔案,僅保留redo日誌和archivelog檔案
刪除控制檔案:
[oracle@wwldb WWL]$ pwd
/DBData/oradata/WWL
[oracle@wwldb WWL]$ ls
control02.ctl control03.ctl
[oracle@wwldb WWL]$ rm -rf *.ctl
[oracle@wwldb WWL]$
[oracle@wwldb WWL]$ pwd
/DBSoft/oradata/WWL
[oracle@wwldb WWL]$ ls
control01.ctl
[oracle@wwldb WWL]$ rm -rf control01.ctl
[oracle@wwldb WWL]$
刪除資料檔案:
[oracle@wwldb WWL]$ ls
redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
[oracle@wwldb WWL]$ rm -rf *.dbf
[oracle@wwldb WWL]$ ls
redo01.log redo02.log redo03.log
[oracle@wwldb WWL]$
刪除引數檔案:
[oracle@wwldb dbs]$ cd $ORACLE_HOME/dbs
[oracle@wwldb dbs]$ rm -rf spfileWWL.ora
[oracle@wwldb dbs]$
執行大恢復
1、 現在資料庫是關閉狀態
[oracle@wwldb dbs]$ ps -ef|grep ora
root 2910 2888 0 10:02 ? 00:00:15 hald-addon-storage: polling /dev/hdc
root 28954 3478 0 11:38 pts/1 00:00:00 su - oracle
oracle 28955 28954 0 11:38 pts/1 00:00:00 -bash
root 29361 3438 0 13:41 pts/2 00:00:00 su - oracle
oracle 29362 29361 0 13:41 pts/2 00:00:01 -bash
oracle 29988 29362 0 16:06 pts/2 00:00:00 sqlplus as sysdba
oracle 30102 28955 0 17:03 pts/1 00:00:00 ps -ef
oracle 30103 28955 0 17:03 pts/1 00:00:00 grep ora
[oracle@wwldb dbs]$
2、 要恢復首先要將資料庫啟動到mount狀態才能恢復
[oracle@wwldb dbs]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 23 17:03:42 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/DBSoft/product/10.2.0/db_1/dbs/initWWL.ora'
SQL>
3、 因為資料庫沒有引數檔案,起不來,只能能啟動到nomount狀態
[oracle@wwldb dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 23 17:06:32 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup force nomount;
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/DBSoft/product/10.2.0/db_1/dbs/initWWL.ora'
starting Oracle instance without parameter file for retrival of spfile
Oracle instance started
Total System Global Area 159383552 bytes
Fixed Size 1218244 bytes
Variable Size 58722620 bytes
Database Buffers 92274688 bytes
Redo Buffers 7168000 bytes
RMAN>
4、 開始恢復引數檔案,只有恢復了引數檔案和控制檔案資料庫才能到mount狀態來恢復資料檔案:
RMAN> restore spfile from autobackup;
Starting restore at 23-MAY-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=36 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/23/2012 17:08:42
RMAN-06495: must explicitly specify DBID with SET DBID command
RMAN>
注意:這裡有問題了,spfile無法恢復,必須指定DBID。我記得在每次登入到rman的時候都會顯示一個資料庫的DBID,但是為什麼這裡要我們指定DBID呢???原因很簡單,因為我們登入RMAN的時候,資料庫已經當機了,而且引數檔案,控制檔案,資料檔案都沒有了,它到哪裡去找DBID;所以需要我們手動來指定,問題是現在既然登入的時候不顯示,我們也不知道在哪裡呀,如下:
[oracle@wwldb dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 23 17:06:32 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
沒關係的因為我們的控制檔案做了自動備份,在自動備份的控制檔案裡面已經存在了DBID,我們現在去找找吧,預設就備份在如下位置:
[oracle@wwldb dbs]$ pwd
/DBSoft/product/10.2.0/db_1/dbs
[oracle@wwldb dbs]$ ls
c-5520179-20120518-01 c-5520179-20120523-01 hc_WWL.dat lkWWL
其中5520179 就是DBID了,我們只需要透過指定這個DBID,就可以將spfile恢復並將資料庫啟動到mount狀態。
RMAN> set DBID=5520179
executing command: SET DBID
RMAN> restore spfile from autobackup;
Starting restore at 23-MAY-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=39 devtype=DISK
channel ORA_DISK_1: looking for autobackup on day: 20120523
channel ORA_DISK_1: autobackup found: c-5520179-20120523-04
channel ORA_DISK_1: SPFILE restore from autobackup complete
Finished restore at 23-MAY-12
RMAN>
5、 恢復控制檔案
RMAN> restore controlfile from autobackup;
Starting restore at 23-MAY-12
using channel ORA_DISK_1
channel ORA_DISK_1: looking for autobackup on day: 20120523
channel ORA_DISK_1: autobackup found: c-5520179-20120523-04
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/DBSoft/product/10.2.0/db_1/dbs/cntrlWWL.dbf
Finished restore at 23-MAY-12
RMAN>
重啟資料庫到mount狀態 ---很重要
SQL> startup mount;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218968 bytes
Variable Size 79693416 bytes
Database Buffers 197132288 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@wwldb dbs]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 23 19:04:15 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: WWL (DBID=5520179, not open)
注意:詳細參考如下:
http://blog.csdn.net/wuweilong/article/details/7596056
http://space.itpub.net/?uid-20674423-action-viewspace-itemid-730717
6、 恢復資料庫其它的資料檔案:
RMAN> restore database;
Starting restore at 23-MAY-12
using target database control file instead of recovery catalog
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 00004 to /DBData/WWL/users01.dbf
channel ORA_DISK_1: reading from backup piece /DBBak/bak_WWL_05_23_0cnbn2a3_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/DBBak/bak_WWL_05_23_0cnbn2a3_1_1 tag=TAG20120523T133147
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /DBData/WWL/system01.dbf
restoring datafile 00002 to /DBData/WWL/undotbs01.dbf
restoring datafile 00003 to /DBData/WWL/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /DBBak/bak_WWL_05_23_0enbn2bk_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/DBBak/bak_WWL_05_23_0enbn2bk_1_1 tag=TAG20120523T133235
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 23-MAY-12
RMAN>
RMAN> recover database;
Starting recover at 23-MAY-12
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:05
Finished recover at 23-MAY-12
RMAN> alter database open; ---------我們看到資料庫已經開啟了處於open狀態
database opened
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
WWL OPEN
SQL>
注意:
restore:是將物理的資料檔案從備份集中恢復出到原來的位置
recover:是利用redo日誌,將備份點後的資料庫透過redo日誌重做
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20674423/viewspace-730718/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 探索ORACLE之RMAN_03一致性備份Oracle
- 探索ORACLE之RMAN_05備份策略Oracle
- 整庫(whole)備份-非一致性整庫備份
- 資料庫非一致性備份資料庫
- 備份之全庫一致性備份
- 什麼是備份資料庫?什麼是資料庫一致性備份和非一致性備份?資料庫
- oracle之rman備份Oracle
- Oracle的奇葩設定之非歸檔模式與RMAN備份Oracle模式
- Oracle備份與恢復系列 (二)停機一致性備份Oracle
- oracle資料庫備份之exp增量備份Oracle資料庫
- 揭祕ORACLE備份之--邏輯備份(EXP)Oracle
- 揭祕ORACLE備份之--邏輯備份(EXPDP)Oracle
- 揭祕ORACLE備份之--冷備份(也叫離線備份)Oracle
- 揭祕ORACLE備份之--熱備份(也叫聯機備份)Oracle
- 備份&恢復之四:非歸檔模式下的備份與恢復模式
- 揭祕ORACLE備份之----RMAN之二(備份方式)Oracle
- Oracle 備份恢復之 FlashbackOracle
- Oracle備份之RMAN工具(四)Oracle
- Oracle備份之RMAN工具(三)Oracle
- Oracle備份之RMAN工具(二)Oracle
- Oracle備份之RMAN工具(一)Oracle
- 整庫(whole)備份-一致性整庫備份
- NBU之oracle的備份恢復Oracle
- 揭秘ORACLE備份之----RMAN之五(CATALOG)Oracle
- oracle備份--離線備份Oracle
- oracle 備份Oracle
- oracle備份Oracle
- oracle邏輯備份之--資料泵Oracle
- Oracle 邏輯備份之EXPDP精講Oracle
- ORACLE之常用FAQ:備份與恢復Oracle
- ORACLE 備份與恢復之 思路整理Oracle
- 揭祕ORACLE備份之----RMAN之五(CATALOG)Oracle
- 資料庫一致性備份資料庫
- 備份之控制檔案備份
- Oracle備份恢復之熱備份恢復及異機恢復Oracle
- oracle的熱備份和冷備份Oracle
- rman如何在備庫執行一致性備份
- 揭祕ORACLE備份之----RMAN之四(塊跟蹤)Oracle