码迷,mamicode.com
首页 > 数据库 > 详细

Oracle 12c RMAN备份文档

时间:2016-01-05 22:26:43      阅读:291      评论:0      收藏:0      [点我收藏+]

标签:

创建备份目录,查看剩余空间

[cistest@cistest ~]$ df -h
df: ‘/home/oratest/.gvfs’: Permission denied
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  450G   27G  423G   6% /
devtmpfs                 5.8G     0  5.8G   0% /dev
tmpfs                    5.8G  2.9G  3.0G  50% /dev/shm
tmpfs                    5.8G   34M  5.8G   1% /run
tmpfs                    5.8G     0  5.8G   0% /sys/fs/cgroup
/dev/sda1                497M  128M  370M  26% /boot

创建目录,并且更改权限为数据库用户

sudo mkdir -p /rman_backup/bak_data  /rman_backup/scripts

[sa@cis ~]$ sudo chgrp -R dba /rman_backup/
[sa@cis ~]$ sudo chown -R oracle /rman_backup/

rman参数配置

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS ;

全备脚本 BackupFull.sh

# script .:BackupFull.sh

# creater:wangshengzhuang

# date:2016/01/05

# desc: backup full database datafile in archive with rman

# connect database



export ORACLE_BASE=/home/oratest/app/oratest

export ORACLE_HOME=/home/oratest/app/oratest/product/12.1.0/dbhome_1

export ORACLE_SID=CISTEST

export PATH=$ORACLE_HOME/bin:$PATH

rman target/ << EOF

Run{
       Allocate channel c1 type disk;

       Backup incremental level 0 tag db0    format  /rman_backup/bak_data/db0_%d_%T_%s database  
       include current controlfile       
       plus archivelog filesperset 20         format  /rman_backup/bak_data/arc0_%d_%T_%s  ;

       Delete noprompt obsolete;
       Release channel c1;
}

EOF
#

增量备份BackupIncr1.sh

# script .:BackupFull.sh

# creater:wangshengzhuang

# date:2016/01/05

# desc: backup incremental database datafile in archive with rman

# connect database



export ORACLE_BASE=/home/oratest/app/oratest

export ORACLE_HOME=/home/oratest/app/oratest/product/12.1.0/dbhome_1

export ORACLE_SID=CISTEST

export PATH=$ORACLE_HOME/bin:$PATH

rman target/ << EOF

Run{
       Allocate channel c1 type disk;

       Backup incremental level 1 tag db1    format  /rman_backup/bak_data/db1_%d_%T_%s database  
       include current controlfile       
       plus archivelog filesperset 20         format  /rman_backup/bak_data/arc1_%d_%T_%s  ;

       Delete noprompt obsolete;
       Release channel c1;
}

EOF
#

配置定时调度

周日和周三凌晨1:00执行0级全库备份,周一、二、四、五六凌晨1:00执行1级增量备份

[oratest@cistest scripts]$ crontab -e
0 1 * * 0 /rman_backup/scripts/BackupFull.sh  >>/rman_backup/BackupFull.log
0 1 * * 3 /rman_backup/scripts/BackupFull.sh  >>/rman_backup/BackupFull.log
0 1 * * 1-2 /rman_backup/scripts/BackupIncr1.sh  >>/rman_backup/BackupIncr.log
0 1 * * 4-6 /rman_backup/scripts/BackupIncr1.sh  >>/rman_backup/BackupIncr.log

reload调度

[sa@cistest cistest]$ sudo /sbin/service crond reload
Redirecting to /bin/systemctl reload  crond.service

Oracle 12c RMAN备份文档

标签:

原文地址:http://www.cnblogs.com/xqzt/p/5103805.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!