Answers

Question and Answer:

  Home  RMAN

⟩ How to generate the begin backup script?

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)

 132 views

More Questions for you: