Showing posts with label Summary of Commands for Oracle 11g Hot (Online) Backup. Show all posts
Showing posts with label Summary of Commands for Oracle 11g Hot (Online) Backup. Show all posts

Friday, September 25, 2009

11g Oracle Hot Backup (Online Backup)

Manual Hot (online) Backup
-----------------------------

1.
mkdir for hot backup and make sure it exists with correct write permissions.
$ pwd -> /u01/oracle/orabackup/orcl1/hot

2.
sqlplus sys as sysdba

SQL> Select log_mode
From v$database;

o/p -> ARCHIVELOG

3.
SQL> Select tablespace_name, file_name
From DBA_DATA_FILES;

4.
SQL> Select group#, sequence#, status
From v$log;

o/p -> Status as CURRENT, ACTIVE, INACTIVE

5.
SQL> alter database begin backup;

6.
Copy all datafiles (Result from step 3 above)

e.g.$ cp /u01/app/oracle/oradata/orcl1/*.dbf /u01/oracle/orabackup/orcl1/hot/*.*
or
SQL> host cp /u01/app/oracle/oradata/orcl1/*.dbf /u01/oracle/orabackup/orcl1/hot/*.*

7.
SQL> Select group#, sequence#, status
From v$log;

o/p -> Status as CURRENT, ACTIVE, INACTIVE

The Sequence that was active in step 4 and upto the sequence that is active from step 7 are needed to restore the backup.

8.
SQL> alter database end backup;

9.
SQL> alter system switch logfile;

If needed run
SQL> alter system archive log all;

10.
Check the archive log dir to make sure log-file sequences that was active in step 4(through)
log-file sequences that was active in step 7 were created.

SQL > show parameterlog_archive_format

SQL > show parameterlog_archive_dest_1

SQL > host ls /u01/oracle/arch/orcl1
(In this e.g. /u01/oracle/arch/orcl1 is archive log dir)

11.
SQL > host cp /u01/oracle/arch/orcl1/arc*.* /u01/oracle/orabackup/orcl1/hot/*.*

12.
SQL > host ls /u01/oracle/orabackup/orcl1/hot/*.*
Ensure the files (data files and Redo log sequence) are copied

13.
SQL> alter database backup controlfile to '/u01/oracle/orabackup/orcl1/hot/control1.bak';

14.
optional -> If needed remove the archive-log files that were backed-up

----------------------------------------------------------

- Suresh