Cold Database backup script

foreverlee發表於2005-03-09
--Set SQL*Plus variables to manipulate output
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
[@more@]--Set SQL*Plus variables to manipulate output
set feedback off heading off verify off trimspool off
set pagesize 0 linesize 200
--Set SQL*Plus user variables used in this script
define dir = '/backup/cold_backup'
define fil = /tmp/closed_backup_temp.sql'
prompt Spool to &fil ......
--Create a command file with file backup commands
spool &fil
 select 'host cp '||name||' &dir ' from v$datafile order by 1;
 select 'host cp '||member||' &dir ' from v$logfile order by 1;
 select 'host cp '||name||' &dir ' from v$controlfile order by 1;
 select 'host cp '||name||' &dir ' from v$tempfile order by 1;
spool off
--Shutdown the database cleanly
shudown immediate;
--Run the copy file commands using the os command
@fil
--Start the database
startup

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

相關文章