oracle rman备份及策略设置

 

RMAN备份:(数据文件 参数文件控制文件 归档日志文件)

rman备份配置过程:

创建目录:

mkdir p /arch/backup/rman

chmod 770 /arch/backup/rman

创建对象:

create tablespace rman_data datafile ' /oradata/tts/rman_data.dbf'  size 1024 m autoextend on next 1m maxsize unlimited;

create temporary tablespace rman_tmp tempfile ' /oradata/tts/rman_tmp.dbf' size 100m autoextend on next 32m maxsize 2048m;

create user rman identified by rman default tablespace rman_data temporary tablespace rman_tmp;

grant connect,resource,recovery_catalog_owner to rman;

连接catalog,注册数据库:

rman catalog rman/rman

create catalog tablespace rman_data;

register database;

report schema;

--基于冗余数量的设置

configure retention policy to redundancy 2;

--基于恢复窗口的设置

configure retention policy to recovery window of 7 days;

--设置自动备份控制文件为打开

CONFIGURE CONTROLFILE AUTOBACKUP ON;

全库(0级)备份脚本:

$ORACLE_HOME/bin/rman catalog rman/rman

connect  target sys/oracle

run {

allocate channel ch1 device type disk;

allocate channel ch2 device type disk;

allocate channel ch3 device type disk;

backup full database format '/arch/backup/rman/db_%U_%d.bak' tag="full" spfile include current controlfile;

sql 'alter system archive log current';

change archivelog all crosscheck;

backup archivelog all format '/arch/backup/rman/arch_%t_%s.bak'  tag="archivelog" delete all input;

crosscheck backup;

crosscheck archivelog all;

delete noprompt expired backup;

delete noprompt obsolete;

resync catalog;

release channel ch1;

release channel ch2;

release channel ch3;

}

备份RMAN数据库:

export ORACLE_SID=tts

export NLS_LANG=american_america.ZHS16GBK

today=`date +20%y-%m-%d`

exp userid=rman/rman buffer=6553600 owner=rman file=/arch/backup/rman/rman$today.dmp log=/arch/backup/rman$today.log

逻辑导出备份:

$ more exp.sh

export ORACLE_SID=tts

export NLS_LANG=american_america.ZHS16GBK

today=`date +20%y-%m-%d`

exp userid=system/oracle full=yes buffer=6553600 file=/arch/backup/full$today.dmp  log=/arch/backup/full$today.log 

定时任务:

在文件/etc/crontab最后添加如下几行:(最好使用绝对路径)

1 23 * * * su - oracle -c rman.sh>>rman.log

1 22 * * * su - oracle -c exp.sh>>exp.log

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21256317/viewspace-1062347/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/21256317/viewspace-1062347/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值