I am an IT professional with 7 years of professional experience,I have good proficiency on Oracle technologies, and at last 2 years of my career to study Real Application Clusters,data guard and participate actively on Oracle community
http://forums.oracle.com/forums/search.jspa?q=khurram&objID=f61&dateRange=all&forumID=61&rankBy=9&start=0
If you want to hire me on Contract or to quote on project basis contact me at khurrampc@hotmail.com or call me at +923333568520

Friday, May 16, 2008

ORA-01152: file 1 was not restored from a sufficiently old backup

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select name 
  2    from v$database
  3  /

NAME
---------
PROD

SQL> select status
  2    from v$instance
  3  /

STATUS
------------
MOUNTED

SQL> alter database open
  2  /
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs
  2  /
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\SYSTEM01.DBF'


SQL> recover database using backup controlfile until cancel
ORA-00283: recovery session canceled due to errors
ORA-01111: name for data file 5 is unknown - rename to correct file
ORA-01110: data file 5: 'C:\WINDOWS\SYSTEM32\UNNAMED00005'
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01111: name for data file 5 is unknown - rename to correct file
ORA-01110: data file 5: 'C:\WINDOWS\SYSTEM32\UNNAMED00005'

Check Alert Log file you will get the original name of yours database file
Wed May 14 18:21:53 2008 alter database recover logfile 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\REDO03.LOG' Media Recovery Log C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\REDO03.LOG File #5 added to control file as 'UNNAMED00005'. Originally created as: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF'
SQL> alter database rename file 'C:\WINDOWS\SYSTEM32\UNNAMED00005' to 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' 2 / alter database rename file 'C:\WINDOWS\SYSTEM32\UNNAMED00005' to 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' * ERROR at line 1: ORA-01511: error in renaming log/data files ORA-01141: error renaming data file 5 - new file 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' not found ORA-01111: name for data file 5 is unknown - rename to correct file ORA-01110: data file 5: 'C:\WINDOWS\SYSTEM32\UNNAMED00005' ORA-27041: unable to open file OSD-04002: unable to open file O/S-Error: (OS 2) The system cannot find the file specified.
you physically deleted the mydata.dbf file from 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF'
what you will do you will copy the users01.dbf to mydata.dbf by using os utility and then rename the unnamed00005 to mydata.dbf
SQL> alter database rename file 'C:\WINDOWS\SYSTEM32\UNNAMED00005' to 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' 2 / Database altered.
Its wrong trick to copy user01.dbf to mydata.dbf by os
SQL> recover database using backup controlfile until cancel ORA-00283: recovery session canceled due to errors ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' ORA-01122: database file 5 failed verification check ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' ORA-01251: Unknown File Header Version read for file number 5
Delete the mydata.dbf by os.And try to recover database
SQL> recover database using backup controlfile until cancel ORA-00283: recovery session canceled due to errors ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' ORA-01157: cannot identify/lock data file 5 - see DBWR trace file ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF'
Now you can see file mydata.dbf is missing now right trick is to create mydata.dbf from SQL.
SQL> alter database create datafile 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF' 2 / Database altered. SQL> recover database using backup controlfile until cancel ORA-00279: change 456977 generated at 05/14/2008 17:23:49 needed for thread 1 ORA-00289: suggestion : C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\PROD\ARCHIVELOG\2008_05_16\O1_MF_1_1_%U_.ARC ORA-00280: change 456977 for thread 1 is in sequence #1 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} ORA-00279: change 458022 generated at 05/14/2008 18:01:07 needed for thread 1 ORA-00289: suggestion : C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\PROD\ARCHIVELOG\2008_05_16\O1_MF_1_2_%U_.ARC ORA-00280: change 458022 for thread 1 is in sequence #2 ORA-00278: log file 'C:\ORACLE\PRODUCT\10.1.0\FLASH_RECOVERY_AREA\PROD\ARCHIVELOG\2008_05_14\O1_MF_1_1_42ORNO5P_.ARC' no longer needed for this recovery Specify log: {<RET>=suggested | filename | AUTO | CANCEL} C:\oracle\product\10.1.0\oradata\Prod\REDO01.log Log applied. Media recovery complete. As i applied redo for the REOD01.log file it was current in my case thats why it is giving Media recovery complete. SQL> alter database open resetlogs 2 / Database altered. SQL> select substr(name,1,100) name,status 2 from v$datafile 3 / NAME STATUS ------------------------------------------------------ ------- C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\SYSTEM01.DBF SYSTEM C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\UNDOTBS01.DBF ONLINE C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\SYSAUX01.DBF ONLINE C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\USERS01.DBF ONLINE C:\ORACLE\PRODUCT\10.1.0\ORADATA\PROD\MYDATA.DBF ONLINE SQL>

0 comments:

Followers

About Me

My Photo
Khurram Siddiqui
Karachi, Sindh, Pakistan
View my complete profile