Tablespace point in time recovery (TSPITR) in v.8.1.7 without stopping database Checked on Linux 8.1.7 database Problem: you deleted or truncated table with data and now you have to recover it from schema TOOLMAN deleted table TOOLMAN_USED_SPACES Have to restore/recover this table Exists: rman files / arch files ======================================= I. Setting clone auxiliary database sys/aux (db name: aux) ======================================= *** Session from where we start clone database *** (oracle, d0old, $ORACLE_SID is aux) 1) create directory where AUX database will reside /usr/dbs2/oradata/aux/ 2) create init.ora file : initaux.ora (see below content of this file) db_name = d0onhis compatible = 8.1.0 remote_login_passwordfile = exclusive lock_name_space = aux db_domain = fnal.gov service_names = aux.world, aux.fnal.gov NLS_DATE_FORMAT='MON DD YYYY HH24:MI:SS' # db_file_name_convert: will use "set newname for datafile .." in recover_tbs # log_file_name_convert: to convert redo*.log files db_file_name_convert = ("/usr/dbs1/oradata/d0onhis/","/usr/dbs2/oradata/aux/") log_file_name_convert = ("/usr/dbs1/oradata/d0onhis/","/usr/dbs2/oradata/aux/") background_dump_dest = /usr/dbs2/oradata/aux/ core_dump_dest = /usr/dbs2/oradata/aux/ user_dump_dest = /usr/dbs2/oradata/aux/ log_archive_start = FALSE control_files = (/usr/dbs2/oradata/aux/control_aux_01.ctl) ########## db_block_size = 16384 db_files = 1000 b_file_multiblock_read_count = 15 db_block_buffers = 7500 shared_pool_size = 500000000 shared_pool_reserved_size = 50000000 log_checkpoint_interval = 10000 processes = 100 dml_locks = 200 log_buffer = 640000 max_dump_file_size = 10240 # limit trace file size to 5 Meg each global_names = TRUE job_queue_processes = 1 open_cursors = 2500 if mapping is needed ft several datafiles, in V.9 there is db_file_name_convert = ("path old 1","path new 1","path old 2","path new 2", and so on) In 8.1.7 it didn't work 3) create soft link to this file in $ORACLE_HOME/dbs directory 4) create password file for AUX database: in $ORACLE_HOME/dbs run orapwd file=orapwaux password=aux 5) setenv ORACLE_SID aux 6) modify tnsnames.ora and listener.ora files in $ORACLE_HOME/network/admin/ ..... ------- listener.ora (SID_DESC = (GLOBAL_DBNAME=aux.fnal.gov) (ORACLE_HOME=/usr/ora/oracle/v8_1_7) (SID_NAME=aux) ) ------- tnsnames.ora aux = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = ) (PROTOCOL = TCP) (Host = d0old.fnal.gov) (Port = 1521) ) ) (CONNECT_DATA = (SID = aux) (GLOBAL_NAME = aux.fnal.gov) ) ) aux.fnal.gov = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = ) (PROTOCOL = TCP) (Host = d0old.fnal.gov) (Port = 1521) ) ) (CONNECT_DATA = (SID = aux) (GLOBAL_NAME = aux.fnal.gov) ) ) 7) startup AUX database in NOMOUNT mode: svrmgrl -> connect internal --> startup momount .. ======================================= II. Run rman ======================================= *** Session from where we run rman *** (oracle, d0old, $ORACLE_SID is d0onhis) d0old->rman target rman_target/backup nocatalog Recovery Manager: Release 8.1.7.0.1 - Production RMAN-06005: connected to target database: D0ONHIS (DBID=1276580915) RMAN-06009: using target database controlfile instead of recovery catalog RMAN> connect clone sys/aux@aux; RMAN-06020: connected to auxiliary database RMAN> @recover_tbs_toolman # Content of recover_tbs_toolman script: # run { # allocate clone channel c1 type disk; # set newname for datafile 1 to '/usr/dbs2/oradata/aux/system01.dbf'; # set newname for datafile 2 to '/usr/dbs2/oradata/aux/rollbk01.dbf'; # set newname for datafile 55 to '/usr/dbs2/oradata/aux/toolman01.dbf'; # recover tablespace toolman until time 'Jul 20 2004 11:30:00'; # } and the see rman_output.log file .. NB. to find datafile # do the following for system, rollback tablespaces: > select file_id,file_name from dba_data_files where file_name like '%roll%'; and put .. into set newname .. Content of rman_output.log file: ......... About to export Tablespace Point-in-time Recovery objects... EXP-00008: ORACLE error 3217 encountered ORA-03217: invalid option for alter of TEMPORARY TABLESPACE ORA-06512: at "SYS.DBMS_PITR", line 600 ORA-06512: at line 1 EXP-00000: Export terminated unsuccessfully <<<--- BUG in ORACLE 8.1.7, oracle says that it fixed in version 9 --->>> But .. we can do manually the rest .. III. Export table from toolman schema in AUX database do the following: - from aux database > exp sys/aux@aux as sysdba > and export table toolman.toolman_used_spaces ......... - from targer database (d0onhis) SVRMGR> recover datafile '/usr/dbs1/oradata/d0onhis/toolman01.dbf'; SVRMGR> alter tablespace toolman online; - and then on target machine run IMP to import that table > imp .. and this worked !!