Can any one send me perfact script of Online Oracle DB Backup. I want that script to backup all files like, Redo logs, Datafiles, Control file and parameter file.
Actually i have seen a good script in Backup & Recovery book by Oracle Press but i am at client side and don't have right now.
/**********************************************************************
Run this script through SQLPLUS and it will prompt you for 2 values
1: HOT_BACK_DIR : defines the directory to which the hot backup is written
2: SCRIPT_FILE : Hot Backup Script for your environment
****************************** DO NOT DELETE*********************/
define HOT_BACK_DIR = &1
define SCRIPT_FILE = &2
truncate TABLE wr_hot_stage;
INSERT INTO wr_hot_stage
SELECT tablespace_name, '1' counter, '' file_id, sysdate bkup_date,
'alter tablespace '|| tablespace_name||' begin backup;' datum
FROM dba_tablespaces;
INSERT INTO wr_hot_stage
SELECT tablespace_name, '2' counter, file_id, sysdate bkup_date,
'host ocopy80 '||file_name||' &HOT_BACK_DIR' || '\' ||
substr((rtrim(file_name,'.DBF')),instr(file_name,'\',-1,1)+1)||'.BAK' datum
FROM dba_data_files;
INSERT INTO wr_hot_stage
SELECT tablespace_name, '3' counter, '' file_id, sysdate bkup_date,
'alter tablespace '|| tablespace_name||' end backup;' datum
FROM dba_tablespaces;
/**** Set up the parameters for the spool file */
SET feedback off heading off
SET pagesize 0 linesize 150
SET verify off termout on echo off
SPOOL &SCRIPT_FILE
SELECT datum FROM wr_hot_stage
ORDER BY tablespace_name, counter;
SELECT 'alter system switch logfile; ' FROM dual;
SELECT 'alter database backup controlfile to trace; ' FROM dual;
SELECT 'alter database backup controlfile to ''&HOT_BACK_DIR\control.bak''; ' FROM dual;
SELECT 'parfile to ''&HOT_BACK_DIR\parfile.bak''; ' FROM dual;
SELECT 'exit' FROM dual;
SPOOL off
Bookmarks