@mrjoltcola
are you sure he can just restore datafile 24 until sysdate - 1;
Main Topics
Browse All TopicsOracle 11g V11.1.0.6 on Windows Server 2003. Database was fine until a power failure. Now I need to recover a damaged data file, or perhaps restore it from a backup.
The datasets were created on the hard drive using the database control (Enterprise Manager). But I can't login to Enterprise manager since the crash.
The database mounts, but won't open-- these errors are listed
ORA-01172: recovery of thread 1 stuck at block 290365 of file 24
ORA-01151: use media recovery to recover block, restore backup if needed
RMAN validate database didn't find any errors, but I know which file is file 24. Now what do I do?
Thank you.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
No, actually I'm not sure, since I'm don't know how old the last backup was. Good point, I actually thought of that last night after I posted but was too lazy to come back to my PC and correct.
dakota5, it-rex's point is that depending on when you run the restore and when was the last time datafile 24 was modified, "restore datafile 24 until sysdate - 1" might not work, especially since you may have been down for more than 1 day, so you may need to go back further to force RMAN to restore the datafile from the last good backup. Its not too a bad thing if you go back further than needed, as long as you have archivelogs, then "recover" step will apply and bring the datafile to consistency.
Check and see when the last backup was taken, just to know where you stand.
RMAN> list backup;
Thanks it-rex.
My lack of experience with Oracle is obvious.
We load 2 gb of data once a year. I think that archivelogs is turned off, though I don't know how to confirm this.
I had better restore a backup from 11/08 after the last set of data was loaded, and just restart this current data load. I've restored the backup sets to disk from tape (where they are archived).
I've attached the results from RMAN>list backup. The last backup from 28-nov-2008 is what I'd like to get back.
I only know how to do this with the database control, not rman.
Would you be able to give me the command for this? The 11g documentation does not show (or I can't find it) the command line use of RMAN.
Many thanks to both of you.
Are you sure you want to go that route first? Make sure, first.
Did you try offlining the tablespace or datafile as I suggested? It is possible to get your database open if the tablespace is not SYSTEM or UNDO.
Secondly, now is a good time to consider turning on archiving. Especially since you only load data once a year, it won't hurt and will guarantee full restore capability, plus you can take backups without closing the database.
To see the log mode:
SQL> select log_mode from v$databaase;
select log_mode from v$database;
LOG_MODE
_______________
NOARCHIVELOG
SQL>
I don't know what the archivelogs are doing in the backups. I do remember selecting them as a separat backup through the DB control.
If I do
RMAN> database recover;
it tells me the files already exist. Isn't there a way of telling RMAN to overwrite the existing files?
I changed the extensions on all the existing datafiles.
I then ran
rman> restore database preview;
see attached file--
at the beginning
datafile 37 will be created automatically during restore operation
at the endMedia recovery start SCN is 57622990
Recovery must be done beyond SCN 71985865 to clear datafile fuzziness
Finished restore at 20-AUG-2009 20:54:15
Does this mean it won't work?
Did you read my previous comments regarding offlining the tablespace? You've never responded to the suggestions.
Why restore the whole database for one datafile that contains only indexes?
If you don't have archivelogs (due to disabling archiving) then you cannot "recover" forward past the point of the last archivelog.
Sorry about that. I had tried it and it did not work.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 619380736 bytes
Fixed Size 1334884 bytes
Variable Size 587202972 bytes
Database Buffers 25165824 bytes
Redo Buffers 5677056 bytes
Database mounted.
SQL> alter database datafile 24 offline;
alter database datafile 24 offline
*
ERROR at line 1:
ORA-01145: offline immediate disallowed unless media recovery enabled
SQL>
I don't need to recover forward past the point of my last full backup (11/08).
If I ignore the warning about fuzziness, can I restore, and force Oracle to accept the restored database as "OK".
It will take much less time to do this and start this year' data load again (which just runs as a background process.) In the past, I've dropped and rebuilt the indexes. It takes forever (much longer than adding one year's data). I really want to get back to where I was.
Did I have to rename (or delete) the existing files, or is there an option in restore for overwriting them?
The reason the offline attempt failed is due to running in NOARCHIVELOG mode.
At this point, the only option you have is a full restore from the last backup. Restore will overwrite existing files, this is why I suggested you backup prior to doing the restore.
RMAN> restore database;
RMAN> recover database noredo;
RMAN> alter database open resetlogs;
Datafile 37 is a new datafile I created for a new partition since 11/08. RMAN will not overwrite this. See below. I'll just rename it, then run restore again.
RMAN> restore database;
Starting restore at 20-AUG-2009 23:16:55
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
creating datafile file number=37 name=H:\ORADATA\CALDATA\CA
RMAN-00571: ==========================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ==========================
RMAN-03002: failure of restore command at 08/20/2009 23:16:57
ORA-01119: error in creating database file 'H:\ORADATA\CALDATA\CAL_07
ORA-27038: created file already exists
OSD-04010: <create> option specified, file already exists
RMAN-06956: create datafile failed; retry after removing H:\ORADATA\CALDATA\CAL
07.DBF from OS
The restore appeared to finish with no errors.
Recover also worked.
RMAN> recover database noredo;
Starting recover at 21-AUG-2009 08:19:41
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=152 device type=DISK
Finished recover at 21-AUG-2009 08:19:44
But then--
RMAN> alter database open resetlogs;
RMAN-00571: ==========================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ==========================
RMAN-03002: failure of alter db command at 08/21/2009 08:20:31
ORA-01139: RESETLOGS option only valid after an incomplete database recovery
I tried
RMAN> alter database open;
RMAN-00571: ==========================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ==========================
RMAN-03002: failure of alter db command at 08/21/2009 08:21:24
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: 'E:\ORADATA\EPI10E\SYSTEM0
tried
recover datafile 1;
but got errors (see attached file)
The backup was a consistent full backup with Ckp SCN 57622990. I want to push Oracle back to that checkpoint. How do I do this?
Again, I apologize for this being so protracted an effort.
It appears that at the time you took the backup, you were in ARCHIVELOG mode and this is a hot backup, not a consistent backup. So sometime later someone turned off archiving. Only use the NOREDO option with a consistent backup, so instead use recover database "until sequence" or "until SCN" for more granularity. You cannot do plain "recover database" because you turned off your archiving at some point and have a gap.
If you list your archive logs you should see what you can apply. The backups indicate that you had sequences 30334 and 30335 (scn 57625835). You need to investigate how many archive logs you have and apply them. Look in the log_archive_dest location or review the alert log to find when you turned off archiving.
Then try recover database until scn or sequence and leave off the NOREDO option.
RMAN> recover database until scn 57625894;
You may try further advancing SCNs until you can open the database with RESETLOGS.
OK. It worked!
To avoid bothering experts like you in the future, for periodic (1-2x per year) data loads with minor changes in between, what would you do? (loading from comma delimited files using third party software)
Turn off ARCHIVELOG for the data loading, then turn it back on? Do backups only with it on? But then I'll get gaps, just like this time.
I'd be happy to ask this as a separate question, if you would respond to it.
By the way, if sequence 30336 was not in the backup, and the earliest file in the flash_recovery_area was O1_MF_1_30561_4MHLHMRW_.AR
Where did 30336 come from?
Thanks so much.
I've attached the RMAN session for my and other's future reference.
Sequence 30335 was the last one in the backup.
RMAN> recover database until sequence 30335; this gave an error saying datafile1 needed more recovery.
then
RMAN> recover database until sequence 30336;
completed with no error, even though there was no sequence 30336 in the backup or in the flash_recovery_area.
Unclear where sequence 30336 came from.
Glad to help.
>>To avoid bothering experts like you in the future
If you bothered me I would not be answering your question, as I am volunteering my time. :) I usually monitor all Oracle questions and specifically Backup and Recovery ones. FYI in the near future an Oracle Backup and Recovery zone is in the works. But I'm not the only DBA here, so if I don't see it, someone else will jump in. You can always post a question and then email me to call my attention to it.
>>Unclear where sequence 30336 came from
From your list of backups, I saw that 30335 was the last archive log that was backed up. Recover until recovers up to but not including the scn or sequence you specify, so you have to specify 1 more than what you may have available.
I recommend, based on your apparent needs, that you setup a cold RMAN backup instead. That way you can stay in NOARCHIVELOG mode, but you need to take the DB down to mount state to take the cold backup.
Running in archivelog mode does give you advantages, so what you suggested is exactly a valid option as well.
1) Run in archivelog mode
2) Before data load restart DB in noarchivelog mode
3) Do load
4) Take DB down, take cold backup, re-enable archiving
The other option to consider is looking at your loads. If you use direct path / append / nologging hints you can reduce the amount of redo generated and probably be able to leave archiving enabled, but with nologging, it is critical you still take a full backup after the load as any operation performed with nologging is not recoverable in a recovery scenario and would need to be repeated. Due to the various issues with NOARCHIVELOG mode, I don't do it, and I plan for the log space in my initial design. If you do run in that mode, at least schedule a monthly or weekly full backup, instead of 6 months. :)
Business Accounts
Answer for Membership
by: mrjoltcolaPosted on 2009-08-19 at 21:32:13ID: 25139378
First, take a cold backup of your database (including control files, redo logs, everything) in case you get the restore / recovery wrong, then you can backtrack.
Then, what I recommend is startup mount, then take datafile 24 offline, and try to start.
SQL> startup mount;
SQL> alter database datafile 24 offline;
SQL> alter database open;
After that you will need to restore / recover datafile 24 or the whole tablespace.
rman target /
RMAN> restore datafile 24 until sysdate - 1;
RMAN> recover datafile 24;
Then bring the datafile back online.