当前位置:Gxlcms > 数据库问题 > Oracle 12c RMAN备份文档

Oracle 12c RMAN备份文档

时间:2021-07-01 10:21:17 帮助过:4人阅读

-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

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

  1. <span style="color: #0000ff">sudo</span> <span style="color: #0000ff">mkdir -p</span> /<span style="color: #000000">rman_backup/bak_data /<span style="color: #000000">rman_backup/scripts</span>
  2. </span><br>[sa@cis ~]$ sudo chgrp -R dba /rman_backup/<br>[sa@cis ~]$ sudo chown -R oracle /rman_backup/<br>

rman参数配置

  1. CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF <span style="color: #800080">7</span> DAYS ;

全备脚本 BackupFull.sh

  1. # script .:BackupFull.<span style="color: #0000ff">sh</span><span style="color: #000000">
  2. # creater:wangshengzhuang
  3. # </span><span style="color: #0000ff">date</span>:<span style="color: #800080">2016</span>/<span style="color: #800080">01</span>/<span style="color: #800080">05</span><span style="color: #000000">
  4. # desc: backup full database datafile </span><span style="color: #0000ff">in</span><span style="color: #000000"> archive with rman
  5. # connect database
  6. export ORACLE_BASE</span>=/home/oratest/app/<span style="color: #000000">oratest
  7. export ORACLE_HOME</span>=/home/oratest/app/oratest/product/<span style="color: #800080">12.1</span>.<span style="color: #800080">0</span>/<span style="color: #000000">dbhome_1
  8. export ORACLE_SID</span>=<span style="color: #000000">CISTEST
  9. export PATH</span>=$ORACLE_HOME/<span style="color: #000000">bin:$PATH
  10. rman target</span>/ <<<span style="color: #000000"> EOF
  11. Run{
  12. Allocate channel c1 type disk;
  13. Backup incremental level </span><span style="color: #800080">0</span> tag <span style="color: #800000">‘</span><span style="color: #800000">db0</span><span style="color: #800000">‘</span> format <span style="color: #800000">‘</span><span style="color: #800000">/rman_backup/bak_data/db0_%d_%T_%s</span><span style="color: #800000">‘</span><span style="color: #000000"> database
  14. include current controlfile
  15. plus archivelog filesperset </span><span style="color: #800080">20</span> format <span style="color: #800000">‘</span><span style="color: #800000">/rman_backup/bak_data/arc0_%d_%T_%s</span><span style="color: #800000">‘</span><span style="color: #000000"> ;
  16. Delete noprompt obsolete;
  17. Release channel c1;
  18. }
  19. EOF
  20. #</span>

增量备份BackupIncr1.sh

  1. # script .:BackupFull.<span style="color: #0000ff">sh</span><span style="color: #000000">
  2. # creater:wangshengzhuang
  3. # </span><span style="color: #0000ff">date</span>:<span style="color: #800080">2016</span>/<span style="color: #800080">01</span>/<span style="color: #800080">05</span><span style="color: #000000">
  4. # desc: backup incremental database datafile </span><span style="color: #0000ff">in</span><span style="color: #000000"> archive with rman
  5. # connect database
  6. export ORACLE_BASE</span>=/home/oratest/app/<span style="color: #000000">oratest
  7. export ORACLE_HOME</span>=/home/oratest/app/oratest/product/<span style="color: #800080">12.1</span>.<span style="color: #800080">0</span>/<span style="color: #000000">dbhome_1
  8. export ORACLE_SID</span>=<span style="color: #000000">CISTEST
  9. export PATH</span>=$ORACLE_HOME/<span style="color: #000000">bin:$PATH
  10. rman target</span>/ <<<span style="color: #000000"> EOF
  11. Run{
  12. Allocate channel c1 type disk;
  13. Backup incremental level </span><span style="color: #800080">1</span> tag <span style="color: #800000">‘</span><span style="color: #800000">db1</span><span style="color: #800000">‘</span> format <span style="color: #800000">‘</span><span style="color: #800000">/rman_backup/bak_data/db1_%d_%T_%s</span><span style="color: #800000">‘</span><span style="color: #000000"> database
  14. include current controlfile
  15. plus archivelog filesperset </span><span style="color: #800080">20</span> format <span style="color: #800000">‘</span><span style="color: #800000">/rman_backup/bak_data/arc1_%d_%T_%s</span><span style="color: #800000">‘</span><span style="color: #000000"> ;
  16. Delete noprompt obsolete;
  17. Release channel c1;
  18. }
  19. EOF
  20. #</span>

配置定时调度

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

  1. [oratest@cistest scripts]$ crontab -<span style="color: #000000">e
  2. </span><span style="color: #800080">0</span> <span style="color: #800080">1</span> * * <span style="color: #800080">0</span> /rman_backup/scripts/BackupFull.<span style="color: #0000ff">sh</span> >>/rman_backup/<span style="color: #000000">BackupFull.log
  3. </span><span style="color: #800080">0</span> <span style="color: #800080">1</span> * * <span style="color: #800080">3</span> /rman_backup/scripts/BackupFull.<span style="color: #0000ff">sh</span> >>/rman_backup/<span style="color: #000000">BackupFull.log
  4. </span><span style="color: #800080">0</span> <span style="color: #800080">1</span> * * <span style="color: #800080">1</span>-<span style="color: #800080">2</span> /rman_backup/scripts/BackupIncr1.<span style="color: #0000ff">sh</span> >>/rman_backup/<span style="color: #000000">BackupIncr.log
  5. </span><span style="color: #800080">0</span> <span style="color: #800080">1</span> * * <span style="color: #800080">4</span>-<span style="color: #800080">6</span> /rman_backup/scripts/BackupIncr1.<span style="color: #0000ff">sh</span> >>/rman_backup/BackupIncr.log

reload调度

  1. [sa@cistest cistest]$ <span style="color: #0000ff">sudo</span> /sbin/<span style="color: #000000">service crond reload
  2. Redirecting to </span>/bin/systemctl reload crond.service

Oracle 12c RMAN备份文档

标签:

人气教程排行