在 centos6.5 中对 oracle 使用 rman 脚本进行备份(nocatalog 方式)

  就我理解,catalog 方式应该是创建了一个叫 rman 的表空间来存放将来要备份的信息,然后就可以备份数据文件和控制文件,但到时候怎么用这些数据文件和控制文件就能把数据库恢复成原来的样子就得看创建的 rman 里面的信息了。所以这种备份方式 rman 表空间必不可少,也不能删除,删了就意味着无法恢复数据库了。
  而 nocatalog 方式就是把 rman 表空间的需要存放的恢复信息给转移到控制文件上,也就是说控制文件取代了 catalog 的作用。这样的话每次备份的时候都得把控制文件进行备份,在要恢复之前先把 controlfile 恢复了才可以进行接下来的恢复数据库操作
  但就总体上而言我是觉得 nocatalog 的方式比较简单(因为我没有像 catalog 方式一样遇到过那么多问题。。。)

  下面给出 nocatalog 方式的 rman 备份脚本:
(里面的一些目录参照我之前的 在 centos6.5 中对 oracle 使用 rman 脚本进行备份(catalog 方式)

vim rman_backup_nocata.sh

#!/bin/bash 
#this is rman auto full backup script 
export ORACLE_SID=xe
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_BASE=/u01/app/oracle
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK" # 中文系统使用这个
export NLS_LANG="AMERICAN_AMERICA.WE8MSWIN1252" # 英文系统使用这个
backtime=`date +"20%y%m%d%H%M%S"`

BACK_BASE=$ORACLE_BASE/backup
BACK_DIR=$BACK_BASE/dbback/full
LOG_DIR=$BACK_BASE/log
BACK_FILE=$BACK_DIR/$backtime
LOG_FILE=$LOG_DIR/full_backup_$backtime.log

$ORACLE_HOME/bin/rman target sys/yl123456@xe nocatalog log=$LOG_FILE <<EOF
    configure backup optimization on;
    configure controlfile autobackup on;
    configure controlfile autobackup format for device type disk to '${BACK_FILE}_%F.ctl';  # 这里面是指定备份 controlfile 和 spfile 后存放的路径
    allocate channel c1 device type disk;
    allocate channel c2 device type disk;
    backup as compressed backupset incremental level 0 database format='$BACK_FILE-%d_%T_%s.bak';  # 备份数据文件
    sql "alter system archive log current";
    backup as compressed backupset format='$BACK_FILE-%d_%T_%s.arc' archivelog all delete input;
    release channel c1;
    release channel c2;
} 
EOF

猜你喜欢

转载自blog.csdn.net/yld10/article/details/80465543
今日推荐