Oracle冷備份(一致備份)指令碼

mengzhaoliang發表於2008-03-09
'系統:linux redhat 3
closed_backup.sql指令碼存放在/u01/backup/目錄下

指令碼內容:
      1 Remark set sql*plus variables to manipulate output
      2 set feedback off heading off verify off trimspool off
      3 set pagesize 0 linesize 200
      4 Remark set sql*plus user variables used in this script
      5 define dir ='/u01/backup'
      6 define fil='/u01/backup/closed_backup_commands.sql'
      7 prompt *** Spooling to &fil
      8 Remark create a command file with file backup commands
      9 spool &fil
     10 select 'host cp '|| name ||' &dir' from v$datafile order by 1;
     11 select 'host cp '|| member ||' &dir' from v$logfile order by 1;
     12 select 'host cp '|| name ||' &dir' from v$controlfile order by 1;
     13 select 'host cp '|| name ||' &dir' from v$tempfile order by 1;
     14 spool off;
     15 Remark Shutdown the database cleanly
     16 shutdown immediate;
     17 Remark Run the copy file commands from the operation system
     18 @&fil
     19 Remark start the database again
     20 startup;
     21


用oracle中的sys  or  system 使用者在sqlplus中執行
>@/u01/backup/closed_backup.sql

即可.

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

相關文章