ORACLE自動備份shell指令碼

zangqianglei發表於2015-05-06

 #!/bin/bash

    source /home/oracle/.bash_profile

    export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss';

    $ORACLE_HOME/bin/rman target / msglog=/backup/log/baklog_`date '+%Y%m%d%H%M%S'`.log 《EOF

    run{

    allocate channel c1 type disk;

    backup as compressed backupset incremental level 0 tag 'lv0' database format '/backup/%d-Incr-0-%I-%T-S%s-P%p.rbak';

    sql 'alter system archive log current';

    backup archivelog all format '/backup/%d-Archlog-%I-%T-S%s-P%p.rbak';

    delete noprompt expired backupset of archivelog all;

    release channel c1;

    }

    quit;

    EOF

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25954236/viewspace-1625639/,如需轉載,請註明出處,否則將追究法律責任。

相關文章