189 8069 5689

oraclerman备份脚本-创新互联

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

在绥滨等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站建设、成都网站设计 网站设计制作定制网站设计,公司网站建设,企业网站建设,品牌网站建设,网络营销推广,成都外贸网站制作,绥滨网站建设费用合理。

全备:

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

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页名称:oraclerman备份脚本-创新互联
文章链接:http://cdxtjz.cn/article/dhdjge.html

其他资讯