oraclerman备份脚本

日常习惯使用netbackup进行数据库备份,但是经常环境中无netbackup,因此的自己写个脚本,脚本很简单,主要是写费时间,因此贴出来以备后用:

创新互联建站主营迭部网站建设的网络公司,主营网站建设方案,成都app软件开发公司,迭部h5小程序开发搭建,迭部网站营销推广欢迎迭部等地区企业咨询

全备:

cat arch_rman_backup.sh:


source /home/oracle/.bash_profile
rman target / log=/u01/app/script/arch_rman.log<run
{
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
sql 'alter system archive log current';
#backup database format '/backup/db_%d_%T_%U';
sql 'alter system archive log current';
backup archivelog all format '/backup/arch_%U_%d_%T_%t' delete all input;
backup current controlfile format '/backup/ctl_%U_%d_%T_%t';
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
#delete noprompt backup of database completed before 'sysdate -7';
#delete noprompt archivelog all;
#delete noprompt backup of archivelog all completed before 'sysdate -7';
release channel ch2;
release channel ch3;
}
EOF

归档日志备份:

$cat arch_rman_backup.sh


source /home/oracle/.bash_profile
rman target / log=/u01/app/script/arch_rman.log<run
{
allocate channel ch2 device type disk;
allocate channel ch3 device type disk;
sql 'alter system archive log current';
#backup database format '/backup/db_%d_%T_%U';
sql 'alter system archive log current';
backup archivelog all format '/backup/arch_%U_%d_%T_%t' delete all input;
backup current controlfile format '/backup/ctl_%U_%d_%T_%t';
crosscheck backup;
crosscheck archivelog all;
delete noprompt expired backup;
delete noprompt obsolete;
#delete noprompt backup of database completed before 'sysdate -7';
#delete noprompt archivelog all;
#delete noprompt backup of archivelog all completed before 'sysdate -7';
release channel ch2;
release channel ch3;
}
EOF

添加执行权限:

chmod +x /u01/app/script/arch_rman_backup.sh

chmod +x /u01/app/script/full_rman_backup.sh

设置备份保留策略:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

添加定时任务:

0 */2 * * *   /u01/app/script/arch_rman_backup.sh
30 1 * * 0   /u01/app/script/full_rman_backup.sh


网站题目:oraclerman备份脚本
网站链接:http://bzwzjz.com/article/jpphsi.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 梓潼网站设计 成都网站设计 成都模版网站建设 网站建设公司 手机网站制作 定制网站设计 企业网站设计 成都h5网站建设 成都网站建设 成都网站建设 企业网站设计 成都企业网站建设公司 高端网站设计 成都网站建设 成都企业网站制作 成都网站设计 定制网站建设 成都网站制作 网站建设方案 网站建设 自适应网站建设 重庆外贸网站建设