oracle 自動冷備份指令碼(轉)

polestar123發表於2009-07-09

說明:

冷備份,就是關閉db,物理copy資料檔案、日誌檔案、控制檔案、歸檔檔案。

rem ***** COLDBACKUP ORACLE DATABASE ON WINDOWS NT *****

set ShutDownFile=C:ShutDown.SQL
echo connect internal/oracle > %ShutDownFile%
echo shutdown immediate >> %ShutDownFile%
echo startup >> %ShutDownFile%
echo shutdown normal >> %ShutDownFile%
echo exit >> %ShutDownFile%

rem ***** SHUTDOWN THE DATABASE *******
set oracle_sid=dbprim
svrmgrl @%ShutDownFile%

net stop OracleStart%oracle_sid%
net stop OracleService%oracle_sid%

rem ***** SET BACKUP FILES DIRECTORY *****
e:
md oradb
cd oradb
md backups
cd backups

rem *****cold backup for "dbprim" database on 2009-3-17 10:56:40 ... *****

rem ***** COPY FILES *****
rem Redo logs

copy C:ORACLE-DATAREDO03.LOG
copy C:ORACLE-DATAREDO02.LOG
copy C:ORACLE-DATAREDO01.LOG

rem Datafile

copy C:ORACLE-DATADBPRIMSYSTEM01.DBF
copy C:ORACLE-DATADBPRIMUNDOTBS01.DBF
copy C:ORACLE-DATADBPRIMSYSAUX01.DBF
copy C:ORACLE-DATADBPRIMUSERS01.DBF
copy C:ORACLE-DATADBPRIMEXAMPLE01.DBF
copy C:ORACLE-DATADBPRIMORATBS.DBF

6 rows selected

rem Control files

copy C:ORACLE-DATADBPRIMCONTROL01.CTL
copy C:ORACLE-DATADBPRIMCONTROL02.CTL
copy C:ORACLE-DATADBPRIMCONTROL03.CTL

rem *********START UP DATABASE AND SERVICES********
net start OracleService%oracle_sid%
net start OracleStart%oracle_sid%

set StartFile=C:start.SQL
echo connect internal/oracle > %StartFile%
echo startup >> %StartFile%
echo exit >> %StartFile%

set oracle_sid=dbprim
svrmgrl @%StartFile%

del /Q %ShutDownFile%
del /Q %StartFile%
exit

[@more@]

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

相關文章