SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /oracle/app/oracle/product/11.2.0/dbs/arch Oldest online log sequence 32 Next log sequence to archive 34 Current log sequence 34 SQL>
二、设置rman的备份参数
原来默认:
RMAN> show all; RMAN configuration parameters for database with db_unique_name TEST103 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/app/oracle/product/11.2.0/dbs/snapcf_test103.f'; # default RMAN>
现在更改部分参数:
1、设置控制文件为自动备份
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
2、设置控制文件备份路径和备份格式
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/ctl_%d_%F';
%d:Oracle数据库名称
%F:基于"DBID+时间"确定的唯一名称
3、设置数据文件备份路径和备份格式
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/data_%d__%U';
%U:默认是%u_%p_%c的简写形式,利用它可以为每一个备份片段(即磁盘文件)生成一个唯一名称,这是最常用的命名方式。
三、创建rman备份脚本
全库备份
rman_backup_all.sh
[oracle@gacoratest001 backup_sh]$ cat rman_backup_all.sh run { allocate channel a1 device type disk format '/backup/data_%d__%U'; allocate channel a2 device type disk format '/backup/data_%d__%U'; backup database plus archivelog delete all input; backup current controlfile ; release channel a1; release channel a2; } crosscheck archivelog all; delete noprompt expired archivelog all; delete noprompt archivelog all completed before 'sysdate - 7'; crosscheck backupset; delete noprompt expired backupset; delete noprompt backupset completed before 'sysdate - 7';
测试一下全备是否成功
[oracle@gacoratest001 ~]$ rman target / cmdfile='/backup_sh/rman_backup_all.sh'
四、创建调用rman备份的定时任务的脚本
[root@gacoratest001 backup_sh]# cat job_rman_backup_all.sh #!/bin/bash export ORACLE_HOME=/oracle/app/oracle/product/11.2.0 export ORACLE_SID=test103 su - oracle -c 'rman target / cmdfile=/backup_sh/rman_backup_all.sh' [root@gacoratest001 backup_sh]# pwd /backup_sh
五、创建定时任务(根据自己需求调整)
[root@gacoratest001 backup]# crontab -l 10 2 * * * sh /backup_sh/job_rman_backup_all.sh >> /backup/rman_crontab_all.log 2>&1
免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们QQ:712375056,同时欢迎投稿传递力量。
Copyright © 2009-2022 56dr.com. All Rights Reserved. 特网科技 特网云 版权所有 特网科技 粤ICP备16109289号
域名注册服务机构:阿里云计算有限公司(万网) 域名服务机构:烟台帝思普网络科技有限公司(DNSPod) CDN服务:阿里云计算有限公司 百度云 中国互联网举报中心 增值电信业务经营许可证B2
建议您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流浏览器浏览本网站