常用RMAN备份命令和查看备份命令

oracle11g, rman备份的路径应该是这样的优先级
备份语句中指定的format > rman 中设置的configure channel device type disk format '/oracle/orclarch/%U_%d’的路径 > 闪回恢复区>$ORACLE_HOME/dbs

–rman时间设置
vi .bash_profile
export NLS_LANG=american_america.zhs16gbk
export NLS_DATE_FORMAT=‘yyyy-mm-dd hh24:mi:ss’

rman备份命令

  1. backup database; 备份整个数据库
    backup database include current controlfile; 备份整个数据库还包括现在的controlfile
    backup database plus archivelog all; 备份整个数据库还包括全部的archivelog
    backup as compressed backupset full database; 压缩备份(原来1G的备份,压缩后可以达到270M)
    backup database plus archivelog all delete input; 备份归档文件后删除一路归档
    backup database plus archivelog all delete all input; 备份归档文件后删除所有路径下的归档

    backup as compressed backupset full database include current controlfile plus archivelog delete all input;
    (全库备份包括控制文件归档日志,备份后删除归档)

  2. backup tablespace tablespacename; 备份指定的表空间

  3. backup datafile 5; 备份指定的数据文件

  4. backup spfile; 备份初始化参数文件

  5. backup current controlfile; 备份现在的controlfile

  6. backup archivelog all; 备份所有的archivelog

查看数据库的备份信息

list backupset summary; 列出备份集的概要信息

list backup of database; 列出所有全库备份

list backup of tablespace tablespacename; 列出指定表空间备份

list backup of datafile 5;
list backup of datafile ‘/u01/app/oracle/oradata/hyyk/system01.dbf’; 列出指定数据文件的备份

list backup of controlfile; 列出conftrolfile的备份

list backup of archivelog all ; 列出archivelog的备份

–列出所有无效备份
–list expired backup;

–报告所有的schema
report schema

crosscheck命令
–检查所有归档文件
crosscheck archivelog all;

–检查所有备份集
crosscheck backup;

删除命令
–删除所有备份集
delete backup;
例:list backup of database 找到备份集的tag
delete backup tag xxxxx

–指定备份片大小
run{
allocate channel c1 device type disk maxpiecesize=10m format ‘/home/oracle/bak/bak_%U’;
backup tablespace system;}

–指定备份集大小,实际指定了备份片大小,和上面区别是如果单个文件过大,则报错。
backup database maxsetsize=100m

–rman通道
1、手工分配通道
run{
allocate channel c1 device type disk format ‘/home/oracle/bak/c1_%U’;
backup tablespace users;}

2、自动分配通道
configure device type disk parallelism n;
configure default device type to disk;
configure channel device type disk format ‘xxxx/%U’;
configure channel n device type disk format ‘xxxx/%U’;

你可能感兴趣的:(Oracle备份恢复专题)