Begin Backup Script

How do you generate the begin backup script?

Questions by shanthiavari

Showing Answers 1 - 1 of 1 Answers

naveen_rc

  • Aug 6th, 2009
 


SQL>set head off
SQL>spool beginbackup.sql
SQL>select 'alter tablespace ' tablespace_name ' begin backup;' from dba_tablespaces;
SQL>spool off



This will create file beginbackup.sql with entry for all tablespaces, remove any unnecessary lines & then execute this script into SQL like



SQL>@beginbackup.sql



(Once you execute this script this will put all tablespaces in to begin backup mode)

Now create backup of your control file in Human Readable format like



alter database backup controlfile to trace as '/some/path';



You can reuse it by removing comment at beginning & replace them with connect / as sysdba
Then Copy all your datafiles, redo logs and control file from your database server to backup location. 
After datafiles are copied don't forget to end backup for all tablespace


Here is the scripts


SQL>set head off
SQL>spool endbackup.sql
SQL>select 'alter tablespace ' tablespace_name ' end backup;' from dba_tablespaces;
SQL>spool off


This will create file endbackup.sql with entry for all tablespaces, remove any unnecessary lines & then execute this script into SQL like



SQL>@endbackup.sql



(Once you execute this script this will put all tablespaces in to end backup mode)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions