RMAN常用配置命令解释
1.RMAN的登陆退出命令: 方法一:$rman nocatalog 直接进入rman,以非 catalog 方式进行备份,也可以不要nocatalogrman〉 connect
方法一:$rman nocatalog 直接进入rman,以非 catalog 方式进行备份,也可以不要nocatalog
rman〉 connect target / 连接到 target database
方法二:rmantarget / rman target / nocatalog
方法三:rmantarget sys/oraclesys@bys 登陆远程数据库 或登陆本机的非操作系统验证库
方法四:rmantarget sys/oraclesys 登陆到默认本机数据库
方法五: rman targetsys/oraclesys@192.168.0.181:1521/orcl
方法六: rmantarget sys/oraclesys@xporacle:1521/orcl
退出:exit
可以在RMAN中执行SHUTDOWN IMMEDIATE,STARTUP MOUNT等SQL命令
执行操作系统 命令需要加 host
执行SQL命令需要加 sql ,不能执行查询语句
2.RMAN内部查询命令
Show all 查看RMAN全局配置
RMAN>show channel;
RMAN> show device type;
RMAN> show default device type;
report schema 查看目标数据库物理结果,能显示出表空间及对应数据文件的信息
列出备份信息:RMAN> list backup;
RMAN> list backup of database;
RMAN> list backup of tablespacetable_name;
RMAN> list backup of controlfile;
RMAN> list backup of spfile;
RMAN> list backupset id; 这里ID指的是备份集的ID号 比如2、3.
校验备份信息:RMAN> crosscheck backup;
RMAN> crosscheck backup of database;
RMAN> crosscheck backup of tablespacesystem;
RMAN> crosscheck backup of controlfile;
RMAN> crosscheck backup of spfile;
RMAN> crosscheck archivelog all;
删除备份在执行删除命令时有两点需要了解:
提示:
注意这里oracle对于obsolete和expired的定义与我们常规理解是相反的。Oracle的定义是这样的,对于手工删除的文件,物理上已经 不存在了的,在执行了crosscheck之后,oracle将其标记为expired,而对于那些超出了备份保留策略的备份集备份片,则标记为 obsolete。
RMAN> report obsolete; 报告陈旧备份
RMAN> delete obsolete; -- 删除陈旧备份
RMAN> delete expired backup;
RMAN> delete expired copy ; 删除EXPIRED副本
RMAN> delete backupset 9;删除备份集编号9的
RMAN> delete backuppiece ¨F:\backup\DEMO_9.bak¨; 删除特定备份片
RMAN> delete backup; -- 删除所有备份
RMAN> delete copy;删除映象副本
RMAN> delete datafilecopy ¨F:\backup\DEMO_9.bak¨删除特定映象副本
同时删除多个指定的备份集,,用逗号隔开
RMAN> delete backupset 62,62,63,64,65,66,67;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ---------------------- ----------
62 62 1 1 AVAILABLE DISK /backup/ctl_c-2041679290-20130618-05
62 62 1 1 AVAILABLE DISK /backup/ctl_c-2041679290-20130618-05
63 63 1 1 AVAILABLE DISK /u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_18/o1_mf_nnndf_TAG20130618T170650_8w08sc14_.bkp
64 64 1 1 AVAILABLE DISK /backup/ctl_c-2041679290-20130618-06
65 65 1 1 AVAILABLE DISK /u01/app/oracle/flash_recovery_area/BYS001/backupset/2013_06_18/o1_mf_nnndf_TAG20130618T171003_8w08zcpq_.bkp
66 66 1 1 AVAILABLE DISK /backup/ctl_c-2041679290-20130618-07
67 67 1 1 AVAILABLE DISK /backup/full/bys001arch_BYS001_818443809_72
Do you really want to delete the aboveobjects (enter YES or NO)?
删除归档日志:RMAN> deletearchivelog all; 删除所有归档
RMAN> delete archivelog until time'sysdate-1' ; 删除当天之前的归档。-7是7天前。
RMAN> delete archivelog all delete input ;
RMAN> delete backupset 22 format = ¨¨d:\backup\%u.bak¨¨ delete input;
备份后删除输入对象
改变备份集的状态
RMAN> change backupset id unavailable;-- available
RMAN> change backupset id keep foreverlogs; 改为长期备份
RMAN> change backupset id keep untiltime 'sysdate+60' logs;
RMAN> change backupset id nokeep;
RMAN> report unrecoverable; 报告不可恢复的数据文件
推荐阅读:
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密
上一篇: 谁能介绍一个能在PHP上用免费报表工具。
下一篇: 配置MySQL服务器