meanwhile users can continue to query and use all the others objects in the database and you can restore it while the database is open.
Moreover because your database is running in ARCHIVELOG mode any committed transactions don't need to be inserted again.
Let's simulate a loss of the EXAMPLE tablespace, in my case formed by only one datafile:
[oracle@localhost ~]$ ll /home/oracle/app/oracle/oradata/orcl/example01.dbf* -rw-rw---- 1 oracle oracle 85991424 Jul 26 06:34 /home/oracle/app/oracle/oradata/orcl/example01.dbf [oracle@localhost ~]$ mv /home/oracle/app/oracle/oradata/orcl/example01.dbf /home/oracle/app/oracle/oradata/orcl/example01.dbf.bckThe database is still open and I query for the very first time an object located on the EXAMPLE tablespace. I receive an error stating the instance was not able to open the example01.dbf (data)file
SQL> select count(*) from ix.ORDERS_QUEUETABLE; select count(*) from ix.ORDERS_QUEUETABLE * ERROR at line 1: ORA-01116: error in opening database file 5 ORA-01110: data file 5: '/home/oracle/app/oracle/oradata/orcl/example01.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3If you look at the alert log the same error and a trace file are generated
... Thu Jul 26 06:49:51 2012 Errors in file /home/oracle/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_m000_6858.trc: ORA-01116: error in opening database file 5 ORA-01110: data file 5: '/home/oracle/app/oracle/oradata/orcl/example01.dbf' ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 Thu Jul 26 06:49:53 2012 Checker run found 1 new persistent data failures ...As you can see the objects located on EXAMPLE tablespace are no more available. So it's time to recover our tablespace: I'd like to remind you that all the following steps are executed while the database is OPEN as you can see even from the screen log of rman console (connected to target database: ORCL (DBID=1229390655)):
[oracle@localhost ~]$ rman target / Recovery Manager: Release 11.2.0.2.0 - Production on Tue Sep 25 23:09:23 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1229390655)First thing to do is to put the lost tablespace OFFLINE.
RMAN> sql 'alter tablespace example offline immediate'; sql statement: alter tablespace example offline immediateSecond step is to issue the restore command providing the name of your lost tablespace
RMAN> restore tablespace example; Starting restore at 26-07-2012 06:54:15 using channel ORA_DISK_1 channel ORA_DISK_1: restoring datafile 00005 input datafile copy RECID=22 STAMP=789633285 file name=/home/oracle/app/oracle/flash_recovery_area/ORCL/datafile/o1_mf_example_812kvfk3_.dbf destination for restore of datafile 00005: /home/oracle/app/oracle/oradata/orcl/example01.dbf channel ORA_DISK_1: copied datafile copy of datafile 00005 output file name=/home/oracle/app/oracle/oradata/orcl/example01.dbf RECID=0 STAMP=0 Finished restore at 26-07-2012 06:54:19After your tablespace was restored from your backup pieces it's time to execute the recover command.
RMAN> recover tablespace example; Starting recover at 26-07-2012 06:54:27 using channel ORA_DISK_1 starting media recovery media recovery complete, elapsed time: 00:00:02 Finished recover at 26-07-2012 06:54:29The tablespace is now recovered and you can put it again online and available for your users.
RMAN> sql 'alter tablespace example online'; sql statement: alter tablespace example onlineAn extract of the alert log taken during the restore and recover process...
... Thu Jul 26 06:53:38 2012 alter tablespace example offline immediate Completed: alter tablespace example offline immediate Thu Jul 26 06:54:16 2012 Checker run found 2 new persistent data failures Thu Jul 26 06:54:18 2012 Restore of datafile copy /home/oracle/app/oracle/flash_recovery_area/ORCL/datafile/o1_mf_example_812kvfk3_.dbf complete to datafile 5 /home/oracle/app/oracle/oradata/orcl/example01.dbf checkpoint is 13657207 Thu Jul 26 06:54:28 2012 alter database recover datafile list clear Completed: alter database recover datafile list clear alter database recover if needed tablespace EXAMPLE Media Recovery Start Serial Media Recovery started Recovery of Online Redo Log: Thread 1 Group 1 Seq 1 Reading mem 0 Mem# 0: /home/oracle/app/oracle/oradata/orcl/redo01.log Media Recovery Complete (orcl) Completed: alter database recover if needed tablespace EXAMPLE Thu Jul 26 06:54:40 2012 alter tablespace example online Completed: alter tablespace example online ...That's all.
11 comments:
I think thіs is оne of the such a lоt vital infoгmatiοn for mе.
And і'm happy reading your article. However should remark on few normal issues, The web site style is ideal, the articles is really excellent : D. Good job, cheers
Here is my web site; BlackChipPoker Bonus
Thanks for sharing such a fastidious idea, post is fastidious,
thats why i have read it entirely
Look into my homepage :: diets that work
I've been browsing online more than 4 hours today, yet I never found any interesting article like yours. It's prettу worth enough
fοr me. In my view, іf all ωebsite ownerѕ and bloggeгѕ mаde goοԁ cоntent as yоu dіd, the wеb wіll be
much more useful than еver bеfore.
Look into my ωеb blog: BlackChipPoker Bonus
Thanks for finally writing about > "How to recover from a loss of a non-system tablespace" < Loved it!
My page vestal
I think this is among the most important info for me.
And i'm glad reading your article. But want to remark on some general things, The web site style is great, the articles is really great : D. Good job, cheers
My webpage - wizkidtutorials.com
Hi, i think that i saw you visited my web site so i came to “return the favor”.
I am attempting to find things to improve my web site!
I suppose its ok to use some of your ideas!!
Stop by my homepage :: real home business
What a stuff of un-ambiguitу and preѕerveness of prеcious
κnowledge about unрredicted emotions.
Also vіsit my web blog does anal bleaching cream workfilm sodomie
Gгeetings! This is my fiгst commеnt hеre so I just wanted to give a quick shοut
οut anԁ tell you I genuinely enjoy гeading your posts.
Can yоu suggest any othег blogs/websiteѕ/forums that go over the same subјects?
Thanks!
Feel frеe to ѕurf to my homepage plan cul Laval: belleasiatique 30ans
ӏ'm gone to inform my little brother, that he should also pay a quick visit this webpage on regular basis to take updated from most up-to-date news update.
My site :: http://sodo.biz
obviouslу liκe yοur ωeb-sitе but yοu haνe
tо сheck thе ѕpelling on several of your posts.
Sеvеrаl οf thеm are rife with ѕpеlling issues
аnd I in fіndіng it veгy troublеsomе to
tell the reality then аgаin I'll surely come back again.
Visit my page - filmsodomie.biz
I am sure this рaгаgraph
has touched all thе internet users, its гeally really good pieсe of writіng on building up nеw blοg.
mу web-site - filmsodomie.biz
Post a Comment