oracle備份常用命令

oracle_db發表於2012-04-21
1.list backup;列出資料庫中所有的備份資訊。
2.list backup of controlfile;列出所有備份的控制檔案。
3.list backup of datafile ' 或者 list backup of datafile 對應資料檔案的ID號。資料檔案全路徑.dbf';列出指定的備份的資料檔案。
4.list backup of archivelog all;列出所有備份的歸檔檔案。
5.list copy of tablespace '表空間名';列出指定表空間的備份資訊。
6.list expired backup;列出無效備份。
7.delete obsolete;刪除過期備份。
8.delete expired backup;刪除無效備份。
9.delete expired copy;刪除expired副本。
10.delete backupset 備份集編號;刪除指定備份集。
11.delete backup;刪除所有備份集。
12.delete copy;刪除所有映像副本。
13.report need backup;檢視所需要的備份檔案
14.report need backup tablespace 表空間名;檢視指定表空間是否需要備份。
15.crosscheck archivelog all;檢查歸檔檔案是否 有效
16.crosscheck backup;檢查所有備份集。
RMAN> crosscheck backup;

using channel ORA_DISK_1
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/flash_recovery_area/DBTEST/backupset/2012_04_21/o1_mf_nnndf_TAG20120421T153359_7s4rq7v6_.bkp recid=22 stamp=781198439
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/flash_recovery_area/DBTEST/backupset/2012_04_21/o1_mf_ncnnf_TAG20120421T153359_7s4rsm9k_.bkp recid=23 stamp=781198515
Crosschecked 2 objects


RMAN> 
17.修改備份狀態用CHANGE,如修改表空間

RMAN> backup tablespace users format '/backup/rmanbackup/userscp';

Starting backup at 21-APR-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=/u01/oradata/dbtest/users01.dbf
channel ORA_DISK_1: starting piece 1 at 21-APR-12
channel ORA_DISK_1: finished piece 1 at 21-APR-12
piece handle=/backup/rmanbackup/userscp tag=TAG20120421T155115 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 21-APR-12

RMAN> list backup of tablespace users;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
24      Full    2.02M      DISK        00:00:00     21-APR-12      
        BP Key: 28   Status: AVAILABLE  Compressed: NO  Tag: TAG20120421T155115
        Piece Name: /backup/rmanbackup/userscp
  List of Datafiles in backup set 24
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 1388204    21-APR-12 /u01/oradata/dbtest/users01.dbf

RMAN> change backup of tablespace users unavailable;

changed backup piece unavailable
backup piece handle=/backup/rmanbackup/userscp recid=28 stamp=781199475
Changed 1 objects to UNAVAILABLE status


RMAN> list backup of tablespace users;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
24      Full    2.02M      DISK        00:00:00     21-APR-12      
        BP Key: 28   Status: UNAVAILABLE  Compressed: NO  Tag: TAG20120421T155115
        Piece Name: /backup/rmanbackup/userscp
  List of Datafiles in backup set 24
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 1388204    21-APR-12 /u01/oradata/dbtest/users01.dbf

RMAN> 
如果沒有指定表空間位置,來改變狀態,不會成功。如:

RMAN> change backupset 22 unavailable;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of unavailable command on ORA_DISK_1 channel at 04/21/2012 15:46:29
ORA-19813: cannot have unavailable file /u01/flash_recovery_area/DBTEST/backupset/2012_04_21/o1_mf_annnn_TAG20120421T154318_7s4s8px3_.bkp in DB_RECOVERY_FILE_DEST

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15720542/viewspace-721885/,如需轉載,請註明出處,否則將追究法律責任。

相關文章