1、连接到目标数据库(不用恢复目录数据库):
Rman nocatalog target sys/change_on_isntall@testdb
Rman catalog rman_user/rman_user@ora9rc target sys/change_on_install@testdb
2、SHOW 命令:
显示rman配置: RMAN> show all;
3、REPORT命令:
1、RMAN> report schema 报告目标数据库的物理结构;
2、RMAN>report need backup days=3; 报告最近3天没有被备份的数据文件;
3、RMAN> report need backup days 3 tablespace users; 在USERS表空间上3天未备份的数据文件;
4、RMAN> report need backup incremental 3;
报告恢复数据文件需要的增量备份个数超过3次的数据文件;
5、RMAN> report need backup redundancy 2 database; 报告备份文件低于2份的所有数据文件;
RMAN>report need backup redundancy=2;
6、RMAN> report need backup recovery window of 6 days;
报告文件报表的恢复需要超过6天的归档日志的数据文件;
7、RMAN> report unrecoverable; 报告数据库所有不可恢复的数据文件;
8、RMAN> report obsolete redunndancy 2; 报告备份次数超过2次的陈旧备份;
9、RMAN>report obsolete; 报告丢弃的备份;
4、LIST命令:列出备份信息
1、列出数据文件备份集
RMAN>list backup 列出详细备份;
RMAN>list expired backup 列出过期备份;
RMAN> list backup of database; 列出所有数据文件的备份集;
RMAN> list backup of tablespace user01; 列出特定表空间的所有数据文件备份集;
2、RMAN> list backup of controlfile 列出控制文件备份集;
3、RMAN> list backup of archivelog all 列出归档日志备份集详细信息;
RMAN>list archivelog all; 列出归档日志备份集简要信息
4、RMAN> list backup of spfile 列出SPFILE备份集;
5、RMAN> list copy of datafile 5 列出数据文件映像副本;
6、RMAN> list copy of controlfile 列出控制文件映像副本;
7、RMAN> list copy of archivelog all 列出归档日志映像副本;
8、RMAN> list incarnation of database 列出对应物 / 列出数据库副本;
9、RMAN>list backup summary; 概述可用的备份;
B 表示 backup
F 表示 FULL
A 表示 archive log
0 1 表示 incremental backup
S 说明备份状态 (A AVAILABLE X EXPIRED )
10、RMAN>list backup by file 按备份类型列出备份;
按照 数据文件备份,归档日志备份,控制文件备份,服务器参数文件备份 列出
5、CROSSCHECK命令:校验备份信息
1、RMAN> crosscheck backup 核对所有备份集;
2、RMAN> crosscheck backup of database 核对所有数据文件的备份集;
3、RMAN> crosscheck backup of tablespace users 核对特定表空间的备份集;
4、RMAN> crosscheck backup of datafile 4 核对特定数据文件的备份集;
5、RMAN> crosscheck backup of controlfile 核对控制文件的备份集;
6、RMAN> crosscheck backup of spfile 核对SPFILE的备份集;
7、RMAN> crosscheck backup of archivelog sequence 3 核对归档日志的备份集;
8、RMAN> crosscheck copy 核对所有映像副本;
9、RMAN> crosscheck copy of database 核对所有数据文件的映像副本;
10、RMAN> crosscheck copy of tablespace users 核对特定表空间的映像副本;
11、RMAN> crosscheck copy of datafile 6 核对特定数据文件的映像副本;
12、RMAN> crosscheck copy of archivelog sequence 4 核对归档日志的映像副本;
13、RMAN> crosscheck copy of controlfile 核对控制文件的映像副本;
14、RMAN> crosscheck backup tag='SAT_BACKUP';
15、RMAN> crosscheck backup completed after 'sysdate - 2'
16、RMAN> crosscheck backup completed between 'sysdate - 5' and 'sysdate -2 '
17、RMAN> crosscheck backup device type sBT;
18、RMAN> crosscheck archivelog all;
19、RMAN> crosscheck archivelog like '%ARC00012.001'
20、RMAN> crosscheck archivelog from sequence 12;
21、RMAN> crosscheck archivelog until sequence 522;
6、DELETE:删除备份
1、RMAN> delete obsolete; 删除陈旧备份;
2、RMAN> delete expired backup; 删除EXPIRED备份
3、RMAN> delete expired copy; 删除EXPIRED副本;
4、RMAN> delete backupset 19; 删除特定备份集;
5、RMAN> delete backuppiece ''d:\backup\DEMO_19.bak'' 删除特定备份片;
6、RMAN> delete backup 删除所有备份集;
7、RMAN> delete datafilecopy ''d:\backup\DEMO_19.bak'' 删除特定映像副本;
8、RMAN> delete copy 删除所有映像副本;
9、RMAN> delete archivelog all delete input;
RMAN> delete backupset 22 format = ''d:\backup\%u.bak'' delete input
在备份后删除输入对象;
10、RMAN> delete backupset id;
7、CHANGE命令: 改变备份集的状态
1、RMAN> change backupset 22 unavailable 改变备份集状态;
2、RMAN> change datafilecopy ''d:\backup\demo_37.bak'' unavailable 改变映像副本状态;
3、RMAN> change backupset 156 keep forever logs 使备份集156永久保留;
4、RMAN> change backupset 198 keep until ''sysdate+60'' logs 使备份集198保留60天;
5、RMAN> change backupset 156 nokeep 免除备份集156的保留期限;
6、change backupset 117,118 delete;
7、change backuppiece 1304 delete;
8、change archivelog until logseq =544 delete;
8、CONFIGURE命令
1 显示当前的配置信息
1.01 RMAN> show all;
1.02 查询RMAN设置中非默认值:
SQL> select name,value from v$rman_configuration;
2. 常用的configure选项
2.01 保存策略 (retention policy)
configure retention policy to recovery window of 3 days;
configure retention policy to redundancy 3;
configure retention policy clear;
2.02 备份优化 backup optimization
configure backup optimization on;
configure backup optimization off;
configure backup optimization clear;
2.03 默认设备 default device type
configure default device type to disk;
configure default device type to stb;
configure default device type clear;
2.04 控制文件 controlfile
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to '/cfs01/backup/conf/conf_%F';
configure controlfile autobackup clear;
configrue controlfile autobackup format for device type disk clear;
configrue snapshot controlfile name to '/cfs01/backup/snapcf/scontrofile.snp';
configrue snapshot controlfile name clear;
2.05 并行数(通道数) device type disk|stb parallelism n;
configure device type disk|stb parallelism 2;
configure device type disk|stb clear;
configure channel device type disk format 'e/:rmanback_%U';
configure channel device type disk maxpiecesize 100m
configure channel device type disk rate 1200K
configure channel 1 device type disk format 'e/:rmanback_%U';
configure channel 1 device type disk maxpiecesize 100m
2.06 生成备份副本 datafile|archivelog backup copies
configure datafile backup copies for device type disk|stb to 3;
configure archivelog backup copies for device type disk|stb to 3;
configure datafile|archivelog backup copies for device type disk|stb clear
backup device type disk database
format '/disk1/backup/%U', '/disk2/backup/%U', '/disk3/backup/%U';
2.07 排除选项 exclude
configure exclude for tablespace 'users';
configrue exclude clear;
2.08 备份集大小 maxsetsize
configure maxsetsize to 1G|1000M|1000000K|unlimited;
configure maxsetsize clear;
2.09 其它选项 auxiliary
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oracle/auxfiles/aux_1.f';
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oracle/auxfiles/aux_2.f';
CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oracle/auxfiles/aux_3.f';
CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oracle/auxfiles/aux_4.f';
CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12330444/viewspace-250353/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12330444/viewspace-250353/