oracle數據庫日志備份
本片是接上次的數據庫在線備份
在上面建立的目錄下建立如下的兩個腳本
文件內容如下
@echo OFF
Rem ===========================================================================
Rem NAME
Rem FUNCTION
Rem NOTES
Rem on closed (cold) database
Rem MODIFIED
Rem ===========================================================================
Rem For Windows
set ORACLE_SID=TSTDB
set ORACLE_CONNECTSTRING=tstdb
set ORACLE_BASE=c:\oracle
set ORACLE_HOME=%ORACLE_BASE%\ora
set ORACLE_DATA=%ORACLE_BASE%\oradata\%ORACLE_SID%
set ORACLE_ADMIN=%ORACLE_BASE%\admin\%ORACLE_SID%
%ORACLE_HOME%\bin\sqlplus /nolog @archive_backup
文件內容如下
Rem =====================================================================================
Rem NAME
Rem FUNCTION
Rem NOTES
Rem on an open or closed database
Rem MODIFIED
Rem =====================================================================================
Rem Set SQL*Plus variables to manipulate output
set feedback off
set pagesize
set heading off
set verify off
set linesize
set trimspool on
Rem Set SQL*Plus user variables used in script
define adm =
define pwd =
Rem for Windows
define dir =
define fil =
define spo =
define cpy =
Rem login database
connect &adm/&pwd as sysdba;
Rem Create a file containing all the file copy commands needed for open physical backup
spool &
prompt spool &;
prompt alter system archive log all;;
SELECT
FROM v$archived_log
WHERE completion_time >= trunc(sysdate)
AND completion_time < trunc(sysdate);
prompt spool off;;
spool off;
Rem Run the copy file commands from the operating system
rem @&
exit;
在運行教本中定義的一些變量
需要修改的變量有
在close_Backup_run
set ORACLE_SID=TSTDB
set ORACLE_CONNECTSTRING=tstdb
set ORACLE_BASE=c:\oracle
set ORACLE_HOME=%ORACLE_BASE%\ora
在close_backup
define adm =
define pwd =
define dir =
define ctl =
在$ORACLE_BASE\admin\admin_script目錄下運行open_Backup_run
在windows系統中添加計劃任務
From:http://tw.wingwit.com/Article/program/Oracle/201311/17887.html