Beruflich Dokumente
Kultur Dokumente
Procedure Category
Troubleshooting
Procedure Trigger
- Instance Crash During Hot Backup; loss of datafile, non-system rollback segments, and online redo logs; finding
timestamp when a table was dropped.
Procedural Steps
CONTENTS
1
Global IT Standard Operating Procedures
5 NOT ACTIVE 0
5 rows selected.
SVRMGR> select * from v$backup; -- Note that file 3 is in hot backup mode
FILE# STATUS CHANGE# TIME
---------- ------------------ ---------- ---------
1 NOT ACTIVE 0
2 NOT ACTIVE 0
3 ACTIVE 33285 28-APR-98
4 NOT ACTIVE 0
5 NOT ACTIVE 0
5 rows selected.
SVRMGR> select * from v$backup; -- “Hot backup” fuzzy bit reset for file 3
FILE# STATUS CHANGE# TIME
---------- ------------------ ---------- ---------
1 NOT ACTIVE 0
2 NOT ACTIVE 0
3 NOT ACTIVE 33285 28-APR-98
4 NOT ACTIVE 0
5 NOT ACTIVE 0
5 rows selected.
2
Global IT Standard Operating Procedures
SVRMGR>
3
Global IT Standard Operating Procedures
SVRMGR> startup
ORACLE instance started.
Total System Global Area 43233440 bytes
Fixed Size 73888 bytes
Variable Size 41431040 bytes
Database Buffers 1638400 bytes
Redo Buffers 90112 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/dbaclass1/teach2/DATA/DISK1/junk99.dbf'
4
Global IT Standard Operating Procedures
SVRMGR> set transaction use rollback segment r01; -- r01 used for next txn
Statement processed.
SVRMGR> insert into test01 values (3); -- Note this row is not committed
1 row processed.
SVRMGR> shutdown abort -- Note one uncommitted row when instance crashed
ORACLE instance shut down.
SVRMGR> rem Removing datafile comprising rbs tablespace...
SVRMGR> host
$ rm $HOME/data/rbs01.dbf -- All database files in rbs tablespace removed
$ exit
5
Global IT Standard Operating Procedures
6
Global IT Standard Operating Procedures
SVRMGR> host
$ cp $HOME/backup/rbs01.dbf $HOME/data -- Restoring backup rbs01.dbf
$ exit
SVRMGR> select * from test01; -- recovery worked (uncommitted txn not found)
COL1
----------
1
2
2 rows selected.
SVRMGR> alter rollback segment r01 online; -- Must bring rollback segs online
Statement processed.
7
Global IT Standard Operating Procedures
SVRMGR> shutdown abort -- Crashing instance and removing all online redo logs…
ORACLE instance shut down.
SVRMGR> host
$ rm *.rdo
$ exit
SVRMGR> host
$ cp ../backup/*.dbf . -- Restoring all datafiles (but not old redo logs)
$ exit
8
Global IT Standard Operating Procedures
9
Global IT Standard Operating Procedures
10
Global IT Standard Operating Procedures
SVRMGR> alter database open; -- Fails since we’re using an old controlfile
alter database open
*
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/dbaclass7/dba15/data/system01.dbf'
ORA-01207: file is more recent than control file - old control file
SVRMGR> recover database -- Wrong syntax used when using a backup controlfile
ORA-00283: Recovery session canceled due to errors
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/dbaclass7/dba15/data/system01.dbf'
ORA-01207: file is more recent than control file - old control file
11
Global IT Standard Operating Procedures
Note: The scenario below shows how we can use LogMiner to identify the exact time that a table was dropped. The
timestamp can then be used for doing a point-in-time recovery.
Check Metalink Note 93370.1 for additional details regarding this process. Since LogMiner can only be run against
Oracle8 and Oracle8i redo logs, this scenario does not apply to Oracle7 databases.
12
Global IT Standard Operating Procedures
SQL> show parameter utl_file_dir –- Location where we will build the dictionary file
NAME TYPE VALUE
----------------------------------- ------- --------------------------
utl_file_dir string /dbaclass2/teach7
SQL> !date –- Here’s the time that we started our LogMiner analysis…
Wed May 2 08:56:04 PDT 2001
13
Global IT Standard Operating Procedures
> dictfilename=>'/dbaclass2/teach7/logdict');
SQL> create table logmnr_tbl –- An interim table to store LogMiner analysis results…
2 as select * from v$logmnr_contents
3 where operation='DELETE'
4 and seg_name in ('COL$','OBJ$','TAB$');
Table created.
SQL> select substr(seg_name,1,15) "SEG", -- Same SCN shows up for OBJ$,TAB$, and COL$
2 substr(operation,1,10) "OP",
3 scn,count(*)
4 from logmnr_tbl
5 where operation != 'INTERNAL'
6 group by seg_name,operation,scn
7 order by scn;
SQL> select sql_redo from logmnr_tbl –- Note that ‘TESTTBL’ shows up for this SCN!
2 where scn=147015
3 and seg_name='OBJ$';
SQL_REDO
-----------------------------------------------------------------------
delete from SYS.OBJ$ where OBJ# = 4891 and DATAOBJ# = 4891 and OWNER# = 52 and NAME = 'TESTTBL'
and NAMESPACE = 1 and SUBNAME IS NULL and TYPE# = 2 and CTIME =TO_DATE('01-MAY-2001
12:04:25', 'DD-MON-YYYY HH24:MI:SS') and MTIME = TO_DATE('01-MAY-2001 12:04:25', 'DD-MON-
YYYY HH24:MI:SS') and STIME = TO_DATE('01-MAY-2001 12:04:25', 'DD-MON-YYYY HH24:MI:SS') and
STATUS = 1 and REMOTEOWNER IS NULL and LINKNAME IS NULL and FLAGS = 0 and ROWID =
'AAAAASAABAAAEYYAAn';
SQL> select distinct –- Here it is: the time that TESTTBL was dropped (1:13pm)!
2 to_char(timestamp,'DD-MON-YYYY HH24:MI:SS') "TIME"
3 from logmnr_tbl
4 where scn=147015;
TIME
--------------------
01-MAY-2001 13:13:16
14
Global IT Standard Operating Procedures
SQL> startup mount –- We’re ready to do the PITR using our timestamp from LogMiner
ORACLE instance started.
Database altered.
SQL> desc kurt.testtbl –- Victory! TESTTBL and its 5600 rows are back!
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
15
Global IT Standard Operating Procedures
COUNT(*)
----------
5600
16