0% found this document useful (0 votes)
862 views5 pages

Recover Oracle Database Upon Losing All Control Fi

This is experimental case study about recovering oracle database upon losing all control files. This experimental is conducted on Windows XP Professional with Oracle database 10.2.0 in archivelog mode Source: www.oraclepoint.com

Uploaded by

patrick_wangrui
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
862 views5 pages

Recover Oracle Database Upon Losing All Control Fi

This is experimental case study about recovering oracle database upon losing all control files. This experimental is conducted on Windows XP Professional with Oracle database 10.2.0 in archivelog mode Source: www.oraclepoint.com

Uploaded by

patrick_wangrui
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Recover Oracle Database upon losing all Control Files

R.Wang

Oct 19, 07

(Firstly, published at OraclePoint.com )

Preface: This is experimental case study about recovering oracle database upon losing all
control files. This experimental is conducted on Windows XP Professional
with Oracle database 10.2.0 in archivelog mode

Steps of Experiment
1. Backup control file
SQL> alter database backup controlfile to 'C:\oracle\product\10.2.0\oradata\orcl\control_back.ctl';

Database altered.

2. Add new tablespace


SQL> create tablespace rec_test_1 datafile 'C:\oracle\product\10.2.0\oradata\orcl\rec_test_1.dbf' size 3M;

Tablespace created.

SQL> create table t_test_1 (n number) tablespace rec_test_1;

Table created.

SQL> insert into t_test_1 values(1);

1 row created.

SQL> commit;

Commit complete.

3. Do complete database shutdown and then database open


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 289406976 bytes
Fixed Size 1248576 bytes
Variable Size 121635520 bytes
Database Buffers 159383552 bytes
Redo Buffers 7139328 bytes
Database mounted.
Database opened.

4. Do incomplete shutdown (needs recovery)


SQL> shutdown abort;
ORACLE instance shut down.

5. Delete all control files (simulate media error)


Delete all of the control files of database I’m working on.

6. Find time point upon which you want to recover

In alert log file (alert_orcl.log in my case), we noticed that following entries.


Fri Oct 19 12:33:35 2007
alter database backup controlfile to 'C:\oracle\product\10.2.0\oradata\orcl\control_back.ctl'
Fri Oct 19 12:33:36 2007
Completed: alter database backup controlfile to 'C:\oracle\product\10.2.0\oradata\orcl\control_back.ctl'
Fri Oct 19 12:34:16 2007
create tablespace rec_test_1 datafile 'C:\oracle\product\10.2.0\oradata\orcl\rec_test_1.dbf' size 3M
Fri Oct 19 12:34:16 2007
Completed: create tablespace rec_test_1 datafile 'C:\oracle\product\10.2.0\oradata\orcl\rec_test_1.dbf' size
3M
Fri Oct 19 12:35:20 2007

In this case, we’d like to recover the tablespace newly created. So, we pick the
time point “Fri Oct 19 12:35:20 2007”as showed in color red.

7. Check the latest written redo log file


SQL> startup mount
ORACLE instance started.

Total System Global Area 289406976 bytes


Fixed Size 1248576 bytes
Variable Size 121635520 bytes
Database Buffers 159383552 bytes
Redo Buffers 7139328 bytes
Database mounted.

SQL> select group#, thread#, sequence#, bytes, members,archived, status from v$log;

GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARCHIV STATUS


---------- ---------- ---------- ---------- ---------- ------ ----------------------
1 1 1 52428800 1 NO CURRENT
3 1 0 52428800 1 YES UNUSED
2 1 0 52428800 1 YES UNUSED

SQL> select group#, status, type, substr(member, 1,48) from v$logfile;

GROUP# STATUS TYPE SUBSTR(MEMBER,1,48)


---------- -------------- -------------- --------------------------------------------------------------------------------------
3 ONLINE C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG
2 ONLINE C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG
1 ONLINE C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG

So, the logfile C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG


is the one we need to use to recover database.

8. Recover database upon the time point found above


SQL> recover database using backup controlfile until time '2007-10-19 12:35:20';
ORA-00279: change 1129633 generated at 10/19/2007 12:31:52 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2007_10_19\O1
_MF_1_20_%U_.ARC
ORA-00280: change 1129633 for thread 1 is in sequence #20

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}


C:\oracle\product\10.2.0\oradata\orcl\redo01.log
ORA-00283: recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to control file by media recovery
ORA-01110: data file 7: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REC_TEST_1.DBF'

ORA-01112: media recovery not started

Due to backup control file was created before adding new tablespace, the
control file doesn’t contain information of newly created tablespace rec_test_1.

Comparably, archived redo logfile contains the name of this tablespace. That’s
the reason that error ORA-01244 and ORA-01110 were raised.

9. Alter name of datafile which is not shown in backup control

At this circumstance, the only thing we need to do is to change the name of


“data file 7”to datafile of newly created tablespace t_test_1. This action will have
control file recognize the datafile of tablespace t_test_1.
SQL> alter database create datafile 7 as
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REC_TEST_1.DBF';

Database altered.
10. Retry the recovery without identifying time point as of step 8
SQL> recover database using backup controlfile;
ORA-00279: change 1129880 generated at 10/19/2007 12:34:16 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2007_
10_19\O1_MF_1_20_%U_.ARC
ORA-00280: change 1129880 for thread 1 is in sequence #20

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}


C:\oracle\product\10.2.0\oradata\orcl\redo01.log
Log applied.
Media recovery complete.

After that, “Log applied”and “Media recovery complete”show that media


recovery is done successfully.

11. Open database with resetlogs option


SQL> alter database open resetlogs;

Database altered.

SQL> select * from t_test_1;

N
----------
1

Query on table t_test_1 (in tablespace rec_test_1) is successful. That means


database is recovered without losing tablespace rec_test_1.

Note: 1. If the redo log file is not identified properly, the following error will occur.
SQL> recover database using backup controlfile until time '2007-10-19 12:35:20';
ORA-00279: change 1129633 generated at 10/19/2007 12:31:52 needed for thread 1
ORA-00289: suggestion :
C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL\ARCHIVELOG\2007_10
_19\O1_MF_1_20_%U_.ARC
ORA-00280: change 1129633 for thread 1 is in sequence #20

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}


C:\oracle\product\10.2.0\oradata\orcl\redo03.log ---- in this case, should be redo01.log
ORA-00328: archived log ends at change 1129632, need later change 1129633
ORA-00334: archived log: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG'

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF'
2. It’s impossible to recover database at this circumstance if the database is in
noarchivelog mode.

Ahout the Author:


R. Wang currently works as Oracle DBA in Canada. He is responsible for
database performance tuning and high availability. With over 10 years
experience in architecting and building oracle systems, Rui is an evangelist
for oracle technology and products. Rui is OCP and received master degree in
computer science from Simon Fraser University in Canada.
Visit Rui’s blog at http://www.oraclepoint.com/oralife

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy