Skip to Main Content
  • Questions
  • Recover tablespace on anothe host or database

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Kirill.

Asked: September 07, 2016 - 10:24 am UTC

Last updated: September 08, 2016 - 12:56 pm UTC

Version: 11.2.0.2.0

Viewed 10K+ times! This question is

You Asked

Hello, friends!

I can't find any info to solve my issue.
We need to restore some old data from table. Full database is too large and we don't have much space for restore full database. That's why we need to restore only tablespace or (ideally) table where this old data is.
Is it possible?

and Connor said...

It's called Tablespace Point In Time Reocvery.

It's well documented in the backup manual

http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmtspit.htm


Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

for example

Kirill Pashkov, September 07, 2016 - 12:54 pm UTC

Thanks for answer, Connor!

i.e.
i must recover: system, sysaux, undo tablespaces, controlfile. Archivelogs and tablespace that i need. From backup for the last time. As it described in Executing TSPITR with Your Own Auxiliary Instance
Am i right?

Connor McDonald
September 08, 2016 - 5:38 am UTC

That is correct. Basically you are creating "just enough" of a database to be able to extract out your lost table. Then you datapump the table to a file and then drop this "temporary" database.

In 12c, the process can be done entirely in RMAN, but in earlier versions, there's more manual steps as you've seen from the documentation

another host

Kirill Pashkov, September 08, 2016 - 7:26 am UTC

Thanks, Connor!

And what you can tell about restoring that tablespase at another host?

Here i try to recover TS using Executing TSPITR with Your Own Auxiliary Instance but get the error:

$ rman target / auxiliary sys/oracle@vorar

Recovery Manager: Release 11.2.0.2.0 - Production on Thu Sep 8 11:52:56 2016

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: VORA (DBID=89952244)
connected to auxiliary database: VORA (not mounted)

RMAN> list backup;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    2.95G      DISK        00:01:12     07-SEP-16      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20160907T133912
        Piece Name: /oracle/rman_07rf7981_1_1.bus
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 23035829   02-SEP-16 /oradata/vora/data_files/system01.dbf
  2       Full 23035829   02-SEP-16 /oradata/vora/data_files/sysaux01.dbf
  3       Full 23035829   02-SEP-16 /oradata/vora/data_files/undotbs01.dbf
  4       Full 23035829   02-SEP-16 /oradata/vora/data_files/users01.dbf
  5       Full 23035829   02-SEP-16 /oradata/vora/data_files/OIT_01.dbf
  <b>6       Full 23035829   02-SEP-16 /oradata/vora/data_files/OIT_ARCH.dbf</b>

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    13.86M     DISK        00:00:02     07-SEP-16      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20160907T133912
        Piece Name: /oracle/rman_08rf79ac_1_1.bus
  SPFILE Included: Modification time: 07-SEP-16
  SPFILE db_unique_name: VORA
  <u>Control File Included: Ckp SCN: 23558019     Ckp time: 07-SEP-16</u>

RMAN> run {
2> set newname for tablespace OIT_ARCH to '/oradata/vorar/data_files/%b';
3> set newname for datafile '/oradata/vora/data_files/system01.dbf' to '/oradata/vorar/data_files/system01.dbf';
4> set newname for datafile '/oradata/vora/data_files/sysaux01.dbf' to '/oradata/vorar/data_files/sysaux01.dbf';

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01006: error signaled during parse
RMAN-02003: unrecognized character: 

MAN> run {
 set newname for tablespace OIT_ARCH to '/oradata/vorar/data_files/%b';
 set newname for datafile '/oradata/vora/data_files/system01.dbf' to '/oradata/vorar/data_files/system01.dbf';
 set newname for datafile '/oradata/vora/data_files/sysaux01.dbf' t2> 3> 4> o '/oradata/vorar/data_files/sysaux01.dbf';
 set newname for datafile '/oradata/vora/data_files/undotbs01.dbf' to '/oradata/vorar/data_files/undotbs01.dbf';
 ALLOCATE AUXILIARY CHANNEL c1 DEVICE TYPE DISK;
 RECOVER TABLESPACE OIT_ARCH UNTIL TIME 'sysdate-15> 6> 7> ';
}8> 

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

allocated channel: c1
channel c1: SID=9 device type=DISK

Starting recover at 08-SEP-16
RMAN-05026: WARNING: presuming following set of tablespaces applies to specified point-in-time

List of tablespaces expected to have UNDO segments
Tablespace SYSTEM
Tablespace UNDOTBS1
Running TRANSPORT_SET_CHECK on recovery set tablespaces
TRANSPORT_SET_CHECK completed successfully

contents of Memory Script:
{
# set requested point in time
set until  time "sysdate-1";
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log 
sql 'alter system archive log current';
# avoid unnecessary autobackups for structural changes during TSPITR
sql 'begin dbms_backup_restore.AutoBackupFlag(FALSE); end;';
}
executing Memory Script

executing command: SET until clause

Starting restore at 08-SEP-16

channel c1: restoring control file
ORA-19625: error identifying file /oradata/vora/cf/controlstb.ctl
ORA-27037: unable to obtain file status
HPUX-ia64 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is control file  (/oradata/vora/cf/controlstb.ctl)
ORA-19601: output file is control file  (/oradata/vorar/cf/control01.ctl)

failover to previous backup

channel c1: restoring control file
ORA-19625: error identifying file /oracle/product/11.2.0/dbs/controldtb.ctl
ORA-27037: unable to obtain file status
HPUX-ia64 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is control file  (/oracle/product/11.2.0/dbs/controldtb.ctl)
ORA-19601: output file is control file  (/oradata/vorar/cf/control01.ctl)

failover to previous backup

channel c1: restoring control file
ORA-19625: error identifying file /oracle/product/11.2.0/dbs/snapcf_vora.f
ORA-27037: unable to obtain file status
HPUX-ia64 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is control file  (/oracle/product/11.2.0/dbs/snapcf_vora.f)
ORA-19601: output file is control file  (/oradata/vorar/cf/control01.ctl)

failover to previous backup

released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/08/2016 12:01:56
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore -- but in list backup we can see that controlfile is in backup (Control File Included: Ckp SCN: 23558019     Ckp time: 07-SEP-16)





Connor McDonald
September 08, 2016 - 12:56 pm UTC

You need a backup of the controlfile for the right *time*. It might be that RMAN cannot find an appropriate one. You can see if RMAN can find one using:

run {
        set until time "<the time you need>";
        restore controlfile preview;
      }

More to Explore

Backup/Recovery

Check out the complete guide to all of the Backup & Recovery techniques in the Oracle Database.