hot backup steps

Download Hot Backup Steps

If you can't read please download the document

Upload: kolleru

Post on 30-Sep-2015

5 views

Category:

Documents


0 download

DESCRIPTION

hi

TRANSCRIPT

login as: [email protected]'s password:Last login: Mon Oct 26 19:49:49 2009 from 192.168.0.14[dba1@oraserver ~]$ sqlplus '/as sysdba'SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 1 09:44:18 2009Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to an idle instance.SQL> STARTUPORACLE instance started.Total System Global Area 142606336 bytesFixed Size 1218172 bytesVariable Size 88082820 bytesDatabase Buffers 50331648 bytesRedo Buffers 2973696 bytesDatabase mounted.Database opened.SQL> SELECT NAME FROM V$DATABASE;NAME---------PROD1SQL> ARCHIVE LOG LISTDatabase log mode Archive ModeAutomatic archival EnabledArchive destination /ora1/oradata/PROD/archOldest online log sequence 8Next log sequence to archive 9Current log sequence 9SQL> ![dba1@oraserver ~]$ cd /ora1/oradata/PROD/[dba1@oraserver PROD]$ lsarch control1.ctl rman udumpbdump prod10gr2_block_change.fil sysaux01.dbf undotbs01.dbfcbkp redo1a.log system01.dbf users01.dbfcdump redo2a.log temp01.dbf users02.dbf[dba1@oraserver PROD]$ cd arch/[dba1@oraserver arch]$ ls1_700139386_10.arc 1_700139386_1.arc 1_700233891_1.arc 1_700236140_3.arc1_700139386_11.arc 1_700139386_20.arc 1_700233891_2.arc 1_700236140_4.arc1_700139386_12.arc 1_700139386_2.arc 1_700233891_3.arc 1_700236140_5.arc1_700139386_13.arc 1_700139386_3.arc 1_700233891_4.arc 1_700236140_6.arc1_700139386_14.arc 1_700139386_4.arc 1_700233891_5.arc 1_700236140_7.arc1_700139386_15.arc 1_700139386_5.arc 1_700233891_6.arc 1_700236140_8.arc1_700139386_16.arc 1_700139386_6.arc 1_700233891_7.arc 1_700236140_9.arc1_700139386_17.arc 1_700139386_7.arc 1_700236140_10.arc1_700139386_18.arc 1_700139386_8.arc 1_700236140_1.arc1_700139386_19.arc 1_700139386_9.arc 1_700236140_2.arc[dba1@oraserver ~]$ cd /ora1/oradata/PROD/[dba1@oraserver PROD]$ lsarch control1.ctl rman udumpbdump prod10gr2_block_change.fil sysaux01.dbf undotbs01.dbfcbkp redo1a.log system01.dbf users01.dbfcdump redo2a.log temp01.dbf users02.dbf[dba1@oraserver PROD]$ mkdir hbkp[dba1@oraserver PROD]$ cd /ora2/oradata/PROD/[dba1@oraserver PROD]$ mkdir hbkp[dba1@oraserver PROD]$ exitexitSQL> spool hbkp.sqlSQL> select 'host cp -v '||name||' /ora1/oradata/PROD/hbkp' from v$datafile;'HOSTCP-V'||NAME||'/ORA1/ORADATA/PROD/HBKP'--------------------------------------------------------------------------------host cp -v /ora1/oradata/PROD/system01.dbf /ora1/oradata/PROD/hbkphost cp -v /ora1/oradata/PROD/undotbs01.dbf /ora1/oradata/PROD/hbkphost cp -v /ora1/oradata/PROD/sysaux01.dbf /ora1/oradata/PROD/hbkphost cp -v /ora1/oradata/PROD/users01.dbf /ora1/oradata/PROD/hbkphost cp -v /ora1/oradata/PROD/users02.dbf /ora1/oradata/PROD/hbkpSQL> spool offSQL> ed hbkp.sql -- edit the file and remove extra lines and retain only query outputSQL> spool begin_backup.sqlSQL> select 'alter tablespace '||tablespace_name||' begin backup;' from dba_tablespaces where contents!='TEMPORARY';'ALTERTABLESPACE'||TABLESPACE_NAME||'BEGINBACKUP;'-------------------------------------------------------------alter tablespace SYSTEM begin backup;alter tablespace UNDOTBS begin backup;alter tablespace SYSAUX begin backup;alter tablespace USERS begin backup;SQL> spool offSQL> ed begin_backup.sql -- edit the file and remove extra lines and retain only query outputSQL> spool end_backup.sqlSQL> select 'alter tablespace '||tablespace_name||' end backup;' from dba_tablespaces where contents!='TEMPORARY'SQL> /'ALTERTABLESPACE'||TABLESPACE_NAME||'ENDBACKUP;'-----------------------------------------------------------alter tablespace SYSTEM end backup;alter tablespace UNDOTBS end backup;alter tablespace SYSAUX end backup;alter tablespace USERS end backup;SQL> spool offSQL> ed end_backup.sql -- edit the file and remove extra lines and retain only query outputSQL> select * from v$backup; -- shows the scn of the last hot backup. FILE# STATUS CHANGE# TIME---------- ------------------ ---------- --------- 1 INACTIVE 1193200 01-NOV-09 2 INACTIVE 1193222 01-NOV-09 3 INACTIVE 1193183 01-NOV-09 4 INACTIVE 1193230 01-NOV-09 5 INACTIVE 1193132 01-NOV-09SQL> @begin_backup.sqlTablespace altered.Tablespace altered.Tablespace altered.Tablespace altered.SQL> select * from v$backup; FILE# STATUS CHANGE# TIME---------- ------------------ ---------- --------- 1 ACTIVE 2193269 01-NOV-09 2 ACTIVE 2193276 01-NOV-09 3 ACTIVE 2193283 01-NOV-09 4 ACTIVE 2193290 01-NOV-09 5 ACTIVE 2193290 01-NOV-09SQL> @hbkp.sql`/ora1/oradata/PROD/system01.dbf' -> `/ora1/oradata/PROD/hbkp/system01.dbf'`/ora1/oradata/PROD/undotbs01.dbf' -> `/ora1/oradata/PROD/hbkp/undotbs01.dbf'`/ora1/oradata/PROD/sysaux01.dbf' -> `/ora1/oradata/PROD/hbkp/sysaux01.dbf'`/ora1/oradata/PROD/users01.dbf' -> `/ora1/oradata/PROD/hbkp/users01.dbf'`/ora1/oradata/PROD/users02.dbf' -> `/ora1/oradata/PROD/hbkp/users02.dbf'SQL> @end_backup.sqlTablespace altered.Tablespace altered.Tablespace altered.Tablespace altered.SQL> select * from v$backup; FILE# STATUS CHANGE# TIME---------- ------------------ ---------- --------- 1 NOT ACTIVE 2193269 01-NOV-09 2 NOT ACTIVE 2193276 01-NOV-09 3 NOT ACTIVE 2193283 01-NOV-09 4 NOT ACTIVE 2193290 01-NOV-09 5 NOT ACTIVE 2193290 01-NOV-09SQL> alter database backup controlfile to '/ora1/oradata/PROD/hbkp/control.ctl';Database altered.SQL> alter system archive log current;System altered.SQL> select * from v$backup; FILE# STATUS CHANGE# TIME---------- ------------------ ---------- --------- 1 NOT ACTIVE 2193269 01-NOV-09 2 NOT ACTIVE 2193276 01-NOV-09 3 NOT ACTIVE 2193283 01-NOV-09 4 NOT ACTIVE 2193290 01-NOV-09 5 NOT ACTIVE 2193290 01-NOV-09SQL>