Question

Recover tablespace or restore from disk backup set using RMAN

Asked by: dakota5

Oracle 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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-08-19 at 20:06:51ID24666998
Tags

Oracle

,

RMAN

,

recover tablespace

Topics

Oracle Database

,

Oracle 10.x

,

Oracle 11.x Database

Participating Experts
2
Points
500
Comments
17

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Rman catalog
    I'm using 8i and want to create the rman catalog for 8i. What is the sql name to create the catalog. I thought it was catrman.sql, but it's not in $ORACLE_HOME/rdbms/admin. Any ideas?
  2. RMAN
    I have created a database to be my repository, I named it MyRepos. The following are the steps I used: c:\set oracle_sid=MyRepos c:\sqlplus /nolog c:\connect sys as sysdba sql>create user me identified by me; "user created" sql>grant recovery_catalog_owner to ...
  3. catalog a rman backup
    I made a backup using rman rman rman> run { ... format... backup (database include current controlfile) ... I couldn't use it because I completely destroyed the database and i wasn't using a catalog. It did produce two files. I now have a catalog on a different database. ...
  4. tablespace point in time recovery using rman
    Hello Oracle DBAs, Iam using rman for backup and recovery process. im facing problem with in time recovery..like Iam trying to make use of RMAN's TSPINR ..while trying to create AUXILIARY Database. As given in doc. I created a password file and init.ora but stilll I could ...
  5. Oracle ASM and RMAN
    On Oracle 10g Does any one have any intentions using the new Oracle feature for managing disks: ASM? Most large Oracle shops are using SNAP mirror or any other storage/hardware backup solutions. Since the only control over the disks is in Oracle hands, RMAN looks as the only...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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.

 

by: it-rexPosted on 2009-08-20 at 10:01:50ID: 25144785

@mrjoltcola
are you sure he can just restore datafile 24 until sysdate - 1;

 

by: mrjoltcolaPosted on 2009-08-20 at 10:16:53ID: 25144914

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.

 

by: dakota5Posted on 2009-08-20 at 14:14:27ID: 25147209

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.

 

by: mrjoltcolaPosted on 2009-08-20 at 14:23:46ID: 25147285

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;

 

by: mrjoltcolaPosted on 2009-08-20 at 14:27:47ID: 25147312

Wait! Your RMAN outout shows that you were running in archive log mode at the time of the backup, as there is an archive log backupset. So you should have the ability to do a full recovery.

See what you have:

rman target /
RMAN> list archivelog all;

 

by: dakota5Posted on 2009-08-20 at 17:44:15ID: 25148282

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?

 

by: dakota5Posted on 2009-08-20 at 18:30:49ID: 25148460

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?

 

by: mrjoltcolaPosted on 2009-08-20 at 18:52:25ID: 25148551

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.

 

by: dakota5Posted on 2009-08-20 at 19:10:18ID: 25148629

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?

 

by: mrjoltcolaPosted on 2009-08-20 at 19:56:58ID: 25148830

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;

 

by: dakota5Posted on 2009-08-20 at 20:28:04ID: 25148936

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\CAL_07.DBF
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.DBF'
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

 

by: dakota5Posted on 2009-08-21 at 05:36:23ID: 25151123

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\SYSTEM01.DBF'

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.

 

by: mrjoltcolaPosted on 2009-08-21 at 05:58:16ID: 25151304

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.

 

by: dakota5Posted on 2009-08-21 at 07:17:38ID: 25152023

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_.ARC
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.

 

by: mrjoltcolaPosted on 2009-08-21 at 07:54:19ID: 25152439

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. :)

 

by: mrjoltcolaPosted on 2009-08-21 at 08:44:52ID: 25152987

If you are all set, please don't forget to score and close the question. Thanks!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...