RMAN中常用的命令(一)

 1、连接到目标数据库(不用恢复目录数据库)

       Rman nocatalog target sys/change_on_isntall@testdb

       Rman catalog rman_user/rman_user@ora9rc target sys/change_on_install@testdb

2SHOW 命令:

       显示rman配置:  RMAN> show all;

3REPORT命令:

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

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

3RMAN> report need backup days 3 tablespace users;    USERS表空间上3天未备份的数据文件;

4RMAN> report need backup incremental 3;

                                                  报告恢复数据文件需要的增量备份个数超过3次的数据文件;

5RMAN> report need backup redundancy 2 database;            报告备份文件低于2份的所有数据文件;

   RMAN>report need backup redundancy=2;

6RMAN> report need backup recovery window of 6 days;

                             报告文件报表的恢复需要超过6天的归档日志的数据文件;

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

8RMAN> report obsolete redunndancy 2;  报告备份次数超过2次的陈旧备份;

9RMAN>report obsolete;                         报告丢弃的备份;

4LIST命令:列出备份信息

1、列出数据文件备份集

   RMAN>list backup          列出详细备份;

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

RMAN> list backup of database;      列出所有数据文件的备份集;

RMAN> list backup of tablespace user01;  列出特定表空间的所有数据文件备份集;

2RMAN> list backup of controlfile      列出控制文件备份集;

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

      RMAN>list archivelog all;       列出归档日志备份集简要信息

4RMAN> list backup of spfile               列出SPFILE备份集;

5RMAN> list copy of datafile 5         列出数据文件映像副本;

6RMAN> list copy of controlfile            列出控制文件映像副本;

7RMAN> list copy of archivelog all     列出归档日志映像副本;

8RMAN> list incarnation of database        列出对应物 / 列出数据库副本;

9RMAN>list backup summary;     概述可用的备份;

           B 表示 backup

           F 表示 FULL

           A 表示 archive log

           0 1 表示 incremental backup

           S 说明备份状态 A AVAILABLE   X EXPIRED )

       10RMAN>list backup by file     按备份类型列出备份;

                     按照 数据文件备份,归档日志备份,控制文件备份,服务器参数文件备份 列出

5CROSSCHECK命令:校验备份信息

1RMAN> crosscheck backup               核对所有备份集;   

2RMAN> crosscheck backup of database       核对所有数据文件的备份集;   

3RMAN> crosscheck backup of tablespace users       核对特定表空间的备份集;   

4RMAN> crosscheck backup of datafile 4     核对特定数据文件的备份集;   

5RMAN> crosscheck backup of controlfile    核对控制文件的备份集;   

6RMAN> crosscheck backup of spfile     核对SPFILE的备份集;   

7RMAN> crosscheck backup of archivelog sequence 3  核对归档日志的备份集;   

8RMAN> crosscheck copy                 核对所有映像副本;   

9RMAN> crosscheck copy of database         核对所有数据文件的映像副本;   

10RMAN> crosscheck copy of tablespace users        核对特定表空间的映像副本;   

11RMAN> crosscheck copy of datafile 6          核对特定数据文件的映像副本;   

12RMAN> crosscheck copy of archivelog sequence 4   核对归档日志的映像副本;   

13RMAN> crosscheck copy of controlfile         核对控制文件的映像副本;  

14RMAN> crosscheck backup tag='SAT_BACKUP';

15RMAN> crosscheck backup completed after 'sysdate - 2'

16RMAN> crosscheck backup completed between 'sysdate - 5' and 'sysdate -2 '

17RMAN> crosscheck backup device type sBT;

18RMAN> crosscheck archivelog all;

19RMAN> crosscheck archivelog like '%ARC00012.001'

20RMAN> crosscheck archivelog from sequence 12;

21RMAN> crosscheck archivelog until sequence 522;

6DELETE:删除备份

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

2RMAN> delete expired backup;  删除EXPIRED备份     

3RMAN> delete expired copy;    删除EXPIRED副本;

4RMAN> delete backupset 19;    删除特定备份集;

5RMAN> delete backuppiece ''d:\backup\DEMO_19.bak''    删除特定备份片;

6RMAN> delete backup       删除所有备份集;

7RMAN> delete datafilecopy ''d:\backup\DEMO_19.bak''   删除特定映像副本;

8RMAN> delete copy     删除所有映像副本;

9RMAN> delete archivelog all delete input;

   RMAN> delete backupset 22 format = ''d:\backup\%u.bak'' delete input

                         在备份后删除输入对象;

10RMAN> delete backupset id;

7CHANGE命令: 改变备份集的状态

1RMAN> change backupset 22 unavailable       改变备份集状态;   

2RMAN> change datafilecopy ''d:\backup\demo_37.bak'' unavailable      改变映像副本状态;

3RMAN> change backupset 156 keep forever logs          使备份集156永久保留;

4RMAN> change backupset 198 keep until ''sysdate+60'' logs        使备份集198保留60;

5RMAN> change backupset 156 nokeep          免除备份集156的保留期限;

6change backupset 117,118 delete;

7change backuppiece 1304 delete;

8change archivelog until logseq =544 delete;

8CONFIGURE命令

    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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值