ITPub博客

首页 > 应用开发 > Java > automatic cold backup script

automatic cold backup script

原创 Java 作者:playwawa 时间:2004-12-22 10:25:45 0 删除 编辑

很多東西不會的時候很難,會了的時候很簡單.

[@more@]

1.backup.bat檔的內容然後執行.

sqlplus /nolog @d:coldbackupcold_create.sql
sqlplus /nolog @d:coldbackupshutdown.sql
d:coldbackupCOLDg.bat
2. cold_create.sql的內容

connect sys/test as sysdba

set feedback off
set heading off
set pagesize 0
set linesize 128
set verify off
set termout oN
set echo off
set trim on
set trims on
-- &2 is ORACLE_SID
spool COLDg.bat
-- Create Script to backup actual files to a directory
-- where &1 is COLDBACK_PATH
select
'copy '||file_name||' d:coldbackup' ||substr(file_name,instr(rtrim(file_name),'',-1,1)+1,length(rtrim(file_name)))||'.bak' c1
FROM dba_data_files;
select
'copy '||name||' d:coldbackup' ||
substr(name,instr(rtrim(name),'',-1,1)+1,length(rtrim(name)))||'.bak' c1
from v$controlfile;
select
'copy '||member||'d:coldbackup' ||
substr(member,instr(rtrim(member),'',-1,1)+1,length(rtrim(member)))||'.bak' c1
from v$logfile;
select
'copy '||'D:oracleora92database'||'init'||'inittest'||'.ora '||' d:coldbackup' || '' ||'init'||'inittest'||'.ora.bak' c1
from dual;
spool off
exit

3.shutdown.sql的內容

connect sys/test as sysdba
shutdown immediate
exit

4.再執行COLDg.bat

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/202861/viewspace-785117/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    105
  • 访问量
    1173102