我是靠谱客的博主 忧郁墨镜,最近开发中收集的这篇文章主要介绍rman 自动备份脚本( aix、centos),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述


AIX RMAN备份脚本

1、查看并配置定时脚本crontab

[root@ifconfig /]#crontab -l


#oracle_backup
#0 1 * * 0 su - oracle -c /oraback/scripts/orcl_full_backup.sh
#0 1 * * 1,2,3,4,5,6 su -oracle -c /oraback/scripts/orcl_lv2_backup.sh
#0 1 * * 4 su - oracle -c /oraback/scripts/orcl_lv1_backup.sh
#0 5 * * * su - oracle -c /oraback/scripts/del_bak.sh
5 0 * * * sh /oraback/scripts/orcl_full_backup.sh
[root@ifconfig /]#

[root@ifconfig /]#

2、rman备份脚本

[root@ifconfig /]#more /oraback/scripts/orcl_full_backup.sh

#!/bin/sh
#incremental level 0 backup script
#export ORACLE_HOME=/u01/oracle/11g
#export ORACLE_SID=ziq
#export PATH=$PATH:$ORACLE_HOME/bin
LogDate=`date +%Y-%m_%d`
su - oracle -c rman target / <<EOF
spool log to '/oraback/log/orcl_lv0_backup_${LogDate}.log';

run{

    allocate channel d1 type disk;
    backup as compressed backupset full database format '/oraback/orcl/orcl_lv0_bak_%T_%s_%p';
    sql 'alter system archive log current';
    backup archivelog all delete all input format '/oraback/orcl/orcl_lv0_arcbak_%T_%s_%p';
    release channel d1;}

crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;

EOF
[root@ifconfig /]#
[root@ifconfig /]#
[root@ifconfig /]#

[root@ifconfig /]#



CentOS RMAN备份脚本

1、查看并配置定时脚本crontab
[oracle@erpora ~]$ crontab -l
#34 11 * * * sh /oraback2/rmanback/ora_backup_full02.sh

10 0 * * * sh /oraback2/rmanback/ora_backup_full01.sh


2、rman备份脚本

[oracle@erpora ~]$ more /oraback2/rmanback/ora_backup_full01.sh
#!/bin/sh

source /home/oracle/.bash_profile
LogDate=`date +%Y-%m+%d`
/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/rman target / <<EOF
spool log to '/oraback2/log/orcl_full_backup_${LogDate}.log';
crosscheck archivelog all;
delete noprompt expired archivelog all;
run{
    allocate channel d1 type disk;
    allocate channel d2 type disk;
    backup as compressed backupset full database format '/oraback2/rmanback/orcl_full_bak_%T_%s_%p';
    backup current controlfile format '/oraback2/rmanback/orcl_full_bak_%T_%s_%p';
    sql 'alter system archive log current';
    backup archivelog all delete all input format '/oraback2/rmanback/orcl_full_arcbak_%T_%s_%p';
    crosscheck archivelog all;
    crosscheck backup device type disk;
    delete noprompt expired backup device type disk;
    delete noprompt obsolete device type disk;
    delete noprompt expired archivelog all;
    release channel d1;
    release channel d2;
}
EOF
echo "backup complete!"

最后

以上就是忧郁墨镜为你收集整理的rman 自动备份脚本( aix、centos)的全部内容,希望文章能够帮你解决rman 自动备份脚本( aix、centos)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(35)

评论列表共有 0 条评论

立即
投稿
返回
顶部