ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle备份常用命令

oracle备份常用命令

原创 Linux操作系统 作者:kevinhong1986 时间:2012-05-09 08:53:27 0 删除 编辑

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相关的
list backup of database(查看数据库的全库备份,全部细节都包括)
list backup of tablespace users (查看users表空间的备份)
list backup of datafile 5;(5是表空间对应的文件id)
list backup of controlfile(看出控制文信息的备份)
list backup of datafile '+DATADG/cboms/datafile/users.264.735423243';(根据具体的数据文件的具体位置,查看备份)
list expired backup;(无效的备份)
list expired archivelog all;(查看无效的archive log 日志)
list backup of database summary(这个是对概况性的,对数据库有个直观,全面的了解)
list backup of database summary
list backup of archivelog all summary
list backup of tablespace users summary
list backup of datafile 5 summary

crosscheck archivelog all;验证DB的归档日志时候缺失

crosscheck backup;验证数据库备份集的是否缺失

delete expired archivelog all;命令删除所有过期的归档日志

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/26912144/viewspace-723099/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 归档日志文件
请登录后发表评论 登录
全部评论

注册时间:2012-04-23

  • 博文量
    16
  • 访问量
    21193