-
Hi friends,
Can any one of you help me in writing a pl/sql program for taking a tablespace online bakup,copy the datafiles to another folder and ending the tablespace backup.
And one more than can we use the HOST command in PL/SQL, if yes please give me an example.
regards
anandkl
-
It is NOT a good idea to have PL/SQL procedure to do online backup.
-
Tamilselvan is right. I would suggest that you start using RMAN for backups (and recovery).
-
My databases run on NT4, and I would use a script file similar to the following,obviously my script is much larger, but this is what it does.
Hope this helps.
Allie
rem shutpcgg_hot.sql
rem
rem
spool d:\oradba\admin\pcgg\logbook\hot_pcgg.log;
rem
rem
set echo on;
alter database backup controlfile to trace;
alter system switch logfile;
rem ********************************************************
alter tablespace AMAPP begin backup;
host copy/v D:\ORADATA\PCGG\AMAPP.DBF d:\oradba\admin\pcgg\backup\AMAPP.DBF
alter tablespace AMAPP end backup;
rem ********************************************************
alter tablespace AMLARGE begin backup;
host copy/v D:\ORADATA\PCGG\AMLARGE.DBF d:\oradba\admin\pcgg\backup\AMLARGE.DBF
alter tablespace AMLARGE end backup;
rem ********************************************************
alter system switch logfile;
spool off;
exit;
-
I run a script for online backups (in Windows NT and 2000)very similar to the one you posted. I have it set up as a .bat file that is scheduled to run at specific times during the day. Works well for us....
-
I would advise to write PL/SQL procedure to generate script and then use the script to perform your online backups.
If you want to backup single tablespace or complete backup you can code PL/SQL procedure accordingly and make it generate the required scripts.
Call both the execution of PL/SQL procedure and backup script in a SQL script.
-