日期:2014-05-16  浏览次数:20383 次

ORACLE10G RMAN 命令
RMAN 命令



连接到目标数据库(不用恢复目录数据库)
rman target / nocatalog

显示rman配置
RMAN> show all;


====================
报告目标数据库的物理结构
RMAN> report schema;

报告陈旧备份
RMAN> report obsolete;

报告不可恢复的数据文件
RMAN> report unrecoverable;

列出备份信息
RMAN> list backup;

RMAN> list backup of database;

RMAN> list backup of tablespace table_name;

RMAN> list backup of controlfile;

RMAN> list backup of spfile;

RMAN> list backupset id;

========================
校验备份信息:
RMAN> crosscheck backup;

RMAN> crosscheck backup of database;

RMAN> crosscheck backup of tablespace system;

RMAN> crosscheck backup of controlfile;

RMAN> crosscheck backup of spfile;


========================
删除备份

Use the ALLOCATE CHANNEL FOR MAINTENANCE command to manually allocate a channel in preparation for issuing a CHANGE, DELETE, or CROSSCHECK command. You can use the RELEASE CHANNEL command to unallocate the channel.

ALLOCATE CHANNEL FOR MAINTENANCE device type (disk,sbt ...)


RMAN> delete obsolete; -- 删除陈旧备份

RMAN> delete expired backup;

RMAN> delete backupset id;

RMAN> delete backup; -- 删除所有备份


--------------------------------------------------------------------------------


--------------------------------------------------------------------------------

1 列出对应物  RMAN>list incarnation;

2 列出备份

2.1概述可用的备份    RMAN>list backup summary;
B 表示 backup
F 表示 FULL
A 表示 archive log
0 1 表示 incremental backup
S 说明备份状态 (A AVAILABLE   X EXPIRED )

2.2按备份类型列出备份  RMAN>list backup by file;
按照 数据文件备份,归档日志备份,控制文件备份,服务器参数文件备份 列出

2.3列出详细备份     RMAN>list backup;

2.4列出过期备份     RMAN>list expired backup;

2.5列出表空间和数据文件备份
list backup of tablespace 和list backup of datafile 输出和list backup 相似
如:list backup of tablespace user_tbs;
list backup of datafile 3;

2.6列出归档日志备份   RMAN>list archivelog all;      简要信息
RMAN>list backup of archivelog all; 详细信息

2.7列出控制文件和服务器参数文件
RMAN>list backup of controfile;
RMAN>list backup of spfile;

=====================================================
=====================================================
RMAN 的 report命令

1. 报告最近没有被备份的数据文件
RMAN>report need backup days=3;

2. 报告备份冗余或恢复窗口
RMAN>report need backup redundancy=2;
RMAN>report need backup recovery window of 2 days;

3. 报告数据文件的不可恢复操作
RMAN>report unrecoverable;

4. 报告数据库模式
RMAN>report schema;

5. 报告丢弃的备份
如果使用了保存策略,备份会标记为丢弃状态  RMAN>report obsolete; 删除丢弃状态备份RMAN>delete obsolete;

=====================================================
=====================================================
RMAN的crosscheck 命令

1 备份集有两种状态A(Available,RMAN认为该项存在于备份介质上)X(Expired,备份存在于控制文件或恢复目录中,但是并没有物理存在于备份介质上)

2 crosscheck 的目的是检查RMAN 的目录以及物理文件,如果物理文件不存在于介质上,将标记为Expired。如果物理文件存在,将维持Available。如果原先标记为Expired的备份集再次存在于备份介质上(如恢复了损坏的磁盘驱动器后),crosscheck将把状态重新从Expired标记回Available。

3 crosscheck 输出分两部分。第一部分列出确定存在于备份介质上的所有备份集片,第二部分列出不存在于备份介质上的备份集片,并将其标记为Expired。当设置备份保 存策略后,一个备份过期,crosscheck之后标记为丢弃的备份状态依旧为availabel,要删除丢弃备份delete obsolete。

4 示例:
crosscheck backup
crosscheck backup of datafile 1;
crosscheck backup of tablespace users;
crosscheck backup of controfile;
crosscheck backup of controlfile;
crosscheck backup tag='SAT_BACKUP';
crosscheck backup completed after 'sysdate - 2'
crosscheck backup completed between 'sysdate - 5' and 'sysdate -2 '