RMAN是Oracle数据库备份管理中必须用到的管理工具。它的操作方式有很多种,我整理了一些常用的操作命令,汇总起来,以方便工作。

(miki西游 @mikixiyou 文档,原文链接: http://mikixiyou.iteye.com/blog/1560754 )

1 、备份数据库操作命令

简洁版

backup database plus archivelog format '/backup/rman/xx_%U.%T';

正规版

run {

allocate channel t1 type disk;

backup database format '/backup/rman/xx_%U.%T';

backup archivelog all delete input format '/backup/rman/xx_%U.%T';

sql 'alter system archive log current';

backup current controlfile format '/backup/rman/xx_%U.%T';

release channel t1;

}

加强版

run

{

delete noprompt obsolete;

allocate channel ch01 type disk rate 40M;

backup database filesperset 3 format '/backup/servdb_rman/db_%U.%T';

sql 'alter system archive log current';

backup archivelog like '+%' filesperset 20 format '/backup/servdb_rman/archivelog_%U.%T';

delete noprompt archivelog until time 'sysdate -1';

backup current controlfile format '/backup/servdb_rman/ctl_%U.%T' ;

release channel ch01;

}

2 、归档日志单独备份操作命令

不删除归档日志文件

run {

allocate channel t1 type disk;

backup archivelog all format '/backup/servdb_rman/archivelog_%U.%T';

release channel t1;

}

删除归档日志文件

run {

allocate channel t1 type disk;

backup archivelog all delete input format '/backup/servdb_rman/archivelog_%U.%T';

release channel t1;

}

不备份已经备份过一次的归档日志文件

run {

allocate channel t1 type disk;

backup archivelog all not backed up 1 times format '/backup/servdb_rman/archivelog_%U.%T';

release channel t1;

}

3 、还原和恢复数据库操作命令

完全恢复

startup nomount;

run {

allocate channel  t1 type disk;

restore controlfile;

restore archivelog all;

alter database mount;

restore database;

recover database;

release channel t1;

}

sql 'alter database open resetlogs';

不完全恢复,至某个时间点

startup nomount;

run {

set until time ="to_date('2012-06-14 00:00:00','yyyy-mm-dd hh24:mi:ss')";

allocate channel  t1 type disk;

restore controlfile;

restore archivelog all;

alter database mount;

restore database;

recover database;

release channel t1;

}

sql 'alter database open resetlogs';

RAC 环境中还原某几个归档日志文件

run

{

allocate channel t1 type disk;

restore archivelog from logseq  5023 thread 1 until logseq  5036 thread 1;

releaase channel t1;

}

单实例环境中还原某几个归档日志文件

run

{

allocate channel t1 type disk;

restore archivelog from logseq  5023 until logseq  5036;

releaase channel t1;

}

4 、注册备份集到 CATALOG 操作命令

catalog start with '/backup/xxx.xxx';

5 、其他管理命令

list backupset;

list backup of database;

list backup of archivelog all;

report obsolete;

report obsolete redundancy = 2;

delete obsolete;

restore database validate;

report unrecoverable;

report schema;

crosscheck backup;

delete expired backup;

rman target sys/*****@ora10 catalog rman/rman@dbarep

allocate channel for maintenance device type disk;

delete obsolete redundancy = 4 device type disk;

delete obsolete redundancy = 2 device type disk;

delete noprompt archivelog until time "sysdate-5"

最新文章

  1. Hilbert-Huang Transform(希尔伯特-黄变换)
  2. 【相当实用】如何让TortoiseSVN导出新增或修改过的文件
  3. hdfs中block的使用情况,副本所在情况等等
  4. github的使用步骤及体会
  5. 再说virtual
  6. angularjs简述
  7. 【转载】解决 Subversion 的 “svn: Can't convert string from 'UTF-8' to native encoding” 错误
  8. explode 和 implode
  9. python:笔记for循环中的else
  10. 阻止事件冒泡(stopPropagation和cancelBubble)和阻止默认行为(preventDefault和returnValue)
  11. HW6.24
  12. JLink软件升级到4.92之后,Jlink不能用了
  13. todoing
  14. iOS: 消息通信中的Notification&KVO
  15. 查看Linux的所有线程
  16. web.xml详细选项配置
  17. 利用foo函数的Bof漏洞攻击:构造攻击字符串
  18. Azure HDInsight 上的 Spark 群集配合自定义的Python来分析网站日志
  19. tomcat8 web工程启动,登陆页面失败问题解决
  20. 【hdu4285】 circuits

热门文章

  1. dbForge Studio for MySQL V8.0 Enterprise
  2. nodejs的某些api~(三)net模块
  3. Electron入门笔记(二)-快速建立hello world
  4. react-native中的navigator
  5. Java 数组+循环升级篇
  6. PHP冒泡排序算法
  7. 浏览器报XMLHttpRequest cannot loadxxxxxx
  8. String 类中的几个练习--获取指定字符串中,大写字母、小写字母、数字的个数||获取一个字符串中,另一个字符串出现的次数
  9. Maven 命令参数 整理
  10. 剑指Offer_编程题_3