oracle 12c新特性:Rman表恢復之直接匯入系統

流浪的野狼發表於2014-12-25

Rman表恢復之直接匯入系統:

RMAN> recover table pdb.pdb of pluggable database pdba until time '2014-12-15 09:39:31' auxiliary destination '/soft/auxi' datapump destination '/soft/pdump';------缺少了notableimport引數。

 

Starting recover at 2014/12/15 10:13:54

using channel ORA_DISK_1

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

Tablespace UNDOTBS2

 

Creating automatic instance, with SID='bimr'

 

initialization parameters used for automatic instance:

db_name=CDB

db_unique_name=bimr_pitr_pdba_CDB

compatible=12.1.0.2.0

db_block_size=8192

db_files=200

diagnostic_dest=/oracle/app/db

_system_trig_enabled=FALSE

sga_target=2480M

processes=200

db_create_file_dest=/soft/auxi

log_archive_dest_1='location=/soft/auxi'

enable_pluggable_database=true

_clone_one_pdb_recovery=true

#No auxiliary parameter file used

 

 

starting up automatic instance CDB

 

Oracle instance started

 

Total System Global Area    2600468480 bytes

 

Fixed Size                     2927768 bytes

Variable Size                570426216 bytes

Database Buffers            2013265920 bytes

Redo Buffers                  13848576 bytes

Automatic instance created

 

contents of Memory Script:

{

# set requested point in time

set until  time "2014-12-15 09:39:31";

# 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';

}

executing Memory Script

 

executing command: SET until clause

 

Starting restore at 2014/12/15 10:14:20

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=165 device type=DISK

 

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: restoring control file

channel ORA_AUX_DISK_1: reading from backup piece +OCR_DATA/CDB/AUTOBACKUP/2014_12_15/s_866366807.334.866366809

channel ORA_AUX_DISK_1: piece handle=+OCR_DATA/CDB/AUTOBACKUP/2014_12_15/s_866366807.334.866366809 tag=TAG20141215T092647

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08

output file name=/soft/auxi/CDB/controlfile/o1_mf_b8wk05k2_.ctl

Finished restore at 2014/12/15 10:14:30

 

sql statement: alter database mount clone database

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

# set requested point in time

set until  time "2014-12-15 09:39:31";

# set destinations for recovery set and auxiliary set datafiles

set newname for clone datafile  1 to new;

set newname for clone datafile  4 to new;

set newname for clone datafile  8 to new;

set newname for clone datafile  3 to new;

set newname for clone datafile  9 to new;

set newname for clone datafile  10 to new;

set newname for clone tempfile  1 to new;

set newname for clone tempfile  3 to new;

# switch all tempfiles

switch clone tempfile all;

# restore the tablespaces in the recovery set and the auxiliary set

restore clone datafile  1, 4, 8, 3, 9, 10;

 

switch clone datafile all;

}

executing Memory Script

 

executing command: SET until clause

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

renamed tempfile 1 to /soft/auxi/CDB/datafile/o1_mf_temp_%u_.tmp in control file

renamed tempfile 3 to /soft/auxi/CDB/datafile/o1_mf_temp_%u_.tmp in control file

 

Starting restore at 2014/12/15 10:14:41

using channel ORA_AUX_DISK_1

 

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_AUX_DISK_1: restoring datafile 00001 to /soft/auxi/CDB/datafile/o1_mf_system_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00004 to /soft/auxi/CDB/datafile/o1_mf_undotbs1_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00008 to /soft/auxi/CDB/datafile/o1_mf_undotbs2_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00003 to /soft/auxi/CDB/datafile/o1_mf_sysaux_%u_.dbf

channel ORA_AUX_DISK_1: reading from backup piece /soft/backup/05pq7cl8_1_1

channel ORA_AUX_DISK_1: piece handle=/soft/backup/05pq7cl8_1_1 tag=TAG20141215T091520

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_AUX_DISK_1: restoring datafile 00009 to /soft/auxi/CDB/datafile/o1_mf_system_%u_.dbf

channel ORA_AUX_DISK_1: restoring datafile 00010 to /soft/auxi/CDB/datafile/o1_mf_sysaux_%u_.dbf

channel ORA_AUX_DISK_1: reading from backup piece /soft/backup/09pq7d9t_1_1

channel ORA_AUX_DISK_1: piece handle=/soft/backup/09pq7d9t_1_1 tag=TAG20141215T092621

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16

Finished restore at 2014/12/15 10:15:35

 

datafile 1 switched to datafile copy

input datafile copy RECID=13 STAMP=866369736 file name=/soft/auxi/CDB/datafile/o1_mf_system_b8wk0m1c_.dbf

datafile 4 switched to datafile copy

input datafile copy RECID=14 STAMP=866369736 file name=/soft/auxi/CDB/datafile/o1_mf_undotbs1_b8wk0m1f_.dbf

datafile 8 switched to datafile copy

input datafile copy RECID=15 STAMP=866369736 file name=/soft/auxi/CDB/datafile/o1_mf_undotbs2_b8wk0m1l_.dbf

datafile 3 switched to datafile copy

input datafile copy RECID=16 STAMP=866369736 file name=/soft/auxi/CDB/datafile/o1_mf_sysaux_b8wk0m0z_.dbf

datafile 9 switched to datafile copy

input datafile copy RECID=17 STAMP=866369736 file name=/soft/auxi/CDB/datafile/o1_mf_system_b8wk1r2g_.dbf

datafile 10 switched to datafile copy

input datafile copy RECID=18 STAMP=866369736 file name=/soft/auxi/CDB/datafile/o1_mf_sysaux_b8wk1r21_.dbf

 

contents of Memory Script:

{

# set requested point in time

set until  time "2014-12-15 09:39:31";

# online the datafiles restored or switched

sql clone "alter database datafile  1 online";

sql clone "alter database datafile  4 online";

sql clone "alter database datafile  8 online";

sql clone "alter database datafile  3 online";

sql clone 'PDBA' "alter database datafile

 9 online";

sql clone 'PDBA' "alter database datafile

 10 online";

# recover and open database read only

recover clone database tablespace  "SYSTEM", "UNDOTBS1", "UNDOTBS2", "SYSAUX", "PDBA":"SYSTEM", "PDBA":"SYSAUX";

sql clone 'alter database open read only';

}

executing Memory Script

 

executing command: SET until clause

 

sql statement: alter database datafile  1 online

 

sql statement: alter database datafile  4 online

 

sql statement: alter database datafile  8 online

 

sql statement: alter database datafile  3 online

 

sql statement: alter database datafile  9 online

 

sql statement: alter database datafile  10 online

 

Starting recover at 2014/12/15 10:15:38

using channel ORA_AUX_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 47 is already on disk as file +OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_1_seq_47.333.866367837

archived log for thread 2 with sequence 16 is already on disk as file +OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_2_seq_16.330.866367839

archived log file name=+OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_1_seq_47.333.866367837 thread=1 sequence=47

archived log file name=+OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_2_seq_16.330.866367839 thread=2 sequence=16

media recovery complete, elapsed time: 00:00:03

Finished recover at 2014/12/15 10:15:45

 

sql statement: alter database open read only

 

contents of Memory Script:

{

sql clone 'alter pluggable database  PDBA open read only';

}

executing Memory Script

 

sql statement: alter pluggable database  PDBA open read only

 

contents of Memory Script:

{

   sql clone "create spfile from memory";

   shutdown clone immediate;

   startup clone nomount;

   sql clone "alter system set  control_files =

  ''/soft/auxi/CDB/controlfile/o1_mf_b8wk05k2_.ctl'' comment=

 ''RMAN set'' scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

# mount database

sql clone 'alter database mount clone database';

}

executing Memory Script

 

sql statement: create spfile from memory

 

database closed

database dismounted

Oracle instance shut down

 

connected to auxiliary database (not started)

Oracle instance started

 

Total System Global Area    2600468480 bytes

 

Fixed Size                     2927768 bytes

Variable Size                587203432 bytes

Database Buffers            1996488704 bytes

Redo Buffers                  13848576 bytes

 

sql statement: alter system set  control_files =   ''/soft/auxi/CDB/controlfile/o1_mf_b8wk05k2_.ctl'' comment= ''RMAN set'' scope=spfile

 

Oracle instance shut down

 

connected to auxiliary database (not started)

Oracle instance started

 

Total System Global Area    2600468480 bytes

 

Fixed Size                     2927768 bytes

Variable Size                587203432 bytes

Database Buffers            1996488704 bytes

Redo Buffers                  13848576 bytes

 

sql statement: alter database mount clone database

 

contents of Memory Script:

{

# set requested point in time

set until  time "2014-12-15 09:39:31";

# set destinations for recovery set and auxiliary set datafiles

set newname for datafile  11 to new;

# restore the tablespaces in the recovery set and the auxiliary set

restore clone datafile  11;

 

switch clone datafile all;

}

executing Memory Script

 

executing command: SET until clause

 

executing command: SET NEWNAME

 

Starting restore at 2014/12/15 10:17:06

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=181 device type=DISK

 

channel ORA_AUX_DISK_1: starting datafile backup set restore

channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_AUX_DISK_1: restoring datafile 00011 to /soft/auxi/BIMR_PITR_PDBA_CDB/datafile/o1_mf_users_%u_.dbf

channel ORA_AUX_DISK_1: reading from backup piece /soft/backup/09pq7d9t_1_1

channel ORA_AUX_DISK_1: piece handle=/soft/backup/09pq7d9t_1_1 tag=TAG20141215T092621

channel ORA_AUX_DISK_1: restored backup piece 1

channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02

Finished restore at 2014/12/15 10:17:09

 

datafile 11 switched to datafile copy

input datafile copy RECID=20 STAMP=866369829 file name=/soft/auxi/BIMR_PITR_PDBA_CDB/datafile/o1_mf_users_b8wk5467_.dbf

 

contents of Memory Script:

{

# set requested point in time

set until  time "2014-12-15 09:39:31";

# online the datafiles restored or switched

sql clone 'PDBA' "alter database datafile

 11 online";

# recover and open resetlogs

recover clone database tablespace  "PDBA":"USERS", "SYSTEM", "UNDOTBS1", "UNDOTBS2", "SYSAUX", "PDBA":"SYSTEM", "PDBA":"SYSAUX" delete archivelog;

alter clone database open resetlogs;

}

executing Memory Script

 

executing command: SET until clause

 

sql statement: alter database datafile  11 online

 

Starting recover at 2014/12/15 10:17:09

using channel ORA_AUX_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 47 is already on disk as file +OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_1_seq_47.333.866367837

archived log for thread 2 with sequence 16 is already on disk as file +OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_2_seq_16.330.866367839

archived log file name=+OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_1_seq_47.333.866367837 thread=1 sequence=47

archived log file name=+OCR_DATA/CDB/ARCHIVELOG/2014_12_15/thread_2_seq_16.330.866367839 thread=2 sequence=16

media recovery complete, elapsed time: 00:00:01

Finished recover at 2014/12/15 10:17:13

 

database opened

 

contents of Memory Script:

{

sql clone 'alter pluggable database  PDBA open';

}

executing Memory Script

 

sql statement: alter pluggable database  PDBA open

 

contents of Memory Script:

{

# create directory for datapump import

sql 'PDBA' "create or replace directory

TSPITR_DIROBJ_DPDIR as ''

/soft/pdump''";

# create directory for datapump export

sql clone 'PDBA' "create or replace directory

TSPITR_DIROBJ_DPDIR as ''

/soft/pdump''";

}

executing Memory Script

 

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/soft/pdump''

 

sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/soft/pdump''

 

Performing export of tables...

   EXPDP> Starting "SYS"."TSPITR_EXP_bimr_Autw": 

   EXPDP> Estimate in progress using BLOCKS method...

   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

   EXPDP> Total estimation using BLOCKS method: 64 KB

   EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE

   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

   EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

   EXPDP> ORA-39127: unexpected error from call to export_string :=SYS.DBMS_TRANSFORM_EXIMP.INSTANCE_INFO_EXP('AQ$_ORDERS_QUEUETABLE_S','IX',1,1,'12.01.00.02.00',newblock)

ORA-00376: file 12 cannot be read at this time

ORA-01110: data file 12: '+OCR_DATA/CDB/FD9BD2B44413096FE043B6A9E80ABC28/DATAFILE/example.298.866127575'

ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197

ORA-06512: at line 1

ORA-06512: at "SYS.DBMS_METADATA", line 10261

ORA-39127: unexpected error from call to export_string :=SYS.DBMS_TRANSFORM_EXIMP.INSTANCE_INFO_EXP('AQ$_STREAMS_QUEUE_TABLE_S','IX',1,1,'12.01.00.02.00',newblock)

ORA-00376: file 12 cannot be read at this time

ORA-01110: data file 12: '+OCR_DATA/CDB/FD9BD2B44413096FE043B6A9E80ABC28/DATAFILE/example.298.866127575'

ORA-06512: at "SYS.DBMS_TRANSFORM_EXIMP", line 197

ORA-06512: at line 1

ORA-06512: at "SYS.DBMS_METADATA", line 10261

   EXPDP> . . exported "PDB"."PDB"                                 5.554 KB       6 rows

   EXPDP> Master table "SYS"."TSPITR_EXP_bimr_Autw" successfully loaded/unloaded

   EXPDP> ******************************************************************************

   EXPDP> Dump file set for SYS.TSPITR_EXP_bimr_Autw is:

   EXPDP>   /soft/pdump/tspitr_bimr_30850.dmp

   EXPDP> Job "SYS"."TSPITR_EXP_bimr_Autw" completed with 2 error(s) at Mon Dec 15 10:18:44 2014 elapsed 0 00:00:32

Export completed

 

 

contents of Memory Script:

{

# shutdown clone before import

shutdown clone abort

}

executing Memory Script

 

Oracle instance shut down

 

Performing import of tables...

   IMPDP> Master table "SYS"."TSPITR_IMP_bimr_blxt" successfully loaded/unloaded

   IMPDP> Starting "SYS"."TSPITR_IMP_bimr_blxt": 

   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE

   IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

   IMPDP> . . imported "PDB"."PDB"                                 5.554 KB       6 rows

   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

   IMPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER

   IMPDP> Job "SYS"."TSPITR_IMP_bimr_blxt" successfully completed at Mon Dec 15 10:20:20 2014 elapsed 0 00:00:25

Import completed

 

 

Removing automatic instance

Automatic instance removed

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_temp_b8wk2tjf_.tmp deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_temp_b8wk2mxm_.tmp deleted

auxiliary instance file /soft/auxi/BIMR_PITR_PDBA_CDB/onlinelog/o1_mf_4_b8wk5bsl_.log deleted

auxiliary instance file /soft/auxi/BIMR_PITR_PDBA_CDB/onlinelog/o1_mf_3_b8wk5bj0_.log deleted

auxiliary instance file /soft/auxi/BIMR_PITR_PDBA_CDB/onlinelog/o1_mf_2_b8wk5b54_.log deleted

auxiliary instance file /soft/auxi/BIMR_PITR_PDBA_CDB/onlinelog/o1_mf_1_b8wk59rf_.log deleted

auxiliary instance file /soft/auxi/BIMR_PITR_PDBA_CDB/datafile/o1_mf_users_b8wk5467_.dbf deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_sysaux_b8wk1r21_.dbf deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_system_b8wk1r2g_.dbf deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_sysaux_b8wk0m0z_.dbf deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_undotbs2_b8wk0m1l_.dbf deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_undotbs1_b8wk0m1f_.dbf deleted

auxiliary instance file /soft/auxi/CDB/datafile/o1_mf_system_b8wk0m1c_.dbf deleted

auxiliary instance file /soft/auxi/CDB/controlfile/o1_mf_b8wk05k2_.ctl deleted

auxiliary instance file tspitr_bimr_30850.dmp deleted

Finished recover at 2014/12/15 10:20:38

 

SQL> select * from pdb;

 

    ID TDATE

---------- -------------------

     4 2014/12/15 09:36:16

     5 2014/12/15 09:36:21

     6 2014/12/15 09:36:25

     1 2014/12/15 09:14:20

     2 2014/12/15 09:14:25

     3 2014/12/15 09:14:29

 

6 rows selected.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28612416/viewspace-1379967/,如需轉載,請註明出處,否則將追究法律責任。

相關文章