zoukankan      html  css  js  c++  java
  • 12c 表恢复

    注意表恢复只能恢复pdb本地用户下的表

    直接恢复表

    RMAN>recover table hxl.tb_objects of pluggable database ORA12CPDB1 until sequence 34 auxiliary destination '/u01/temp/res/'

    恢复表的同时变更表名

    RMAN> recover table hxl.tb_test of pluggable database ORA12CPDB1 until sequence 32 auxiliary destination '/u01/temp/res/' remap table hxl.tb_test:tb_tb_test_restore;

    Starting recover at 2019-12-24 13:34:34
    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 ORA12CPDB1:SYSTEM
    Tablespace UNDOTBS1
    Tablespace ORA12CPDB1:UNDOTBS1

    Creating automatic instance, with SID='iwbC'

    initialization parameters used for automatic instance:
    db_name=ORA12C
    db_unique_name=iwbC_pitr_ORA12CPDB1_ORA12C
    compatible=12.2.0
    db_block_size=8192
    db_files=200
    diagnostic_dest=/u01/app/oracle
    _system_trig_enabled=FALSE
    sga_target=736M
    processes=200
    db_create_file_dest=/u01/temp/res/
    log_archive_dest_1='location=/u01/temp/res/'
    enable_pluggable_database=true
    _clone_one_pdb_recovery=true
    #No auxiliary parameter file used


    starting up automatic instance ORA12C

    Oracle instance started

    Total System Global Area     771751936 bytes

    Fixed Size                     8797536 bytes
    Variable Size                213910176 bytes
    Database Buffers             545259520 bytes
    Redo Buffers                   3784704 bytes
    Automatic instance created

    contents of Memory Script:
    {
    # set requested point in time
    set until  logseq 32 thread 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';
    }
    executing Memory Script

    executing command: SET until clause

    Starting restore at 2019-12-24 13:34:58
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=35 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 /u01/rman_backup/db_fullbackup_ORA12C_77_1_20191224
    channel ORA_AUX_DISK_1: piece handle=/u01/rman_backup/db_fullbackup_ORA12C_77_1_20191224 tag=TAG20191224T130004
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
    output file name=/u01/temp/res/ORA12C/controlfile/o1_mf_h04plqdp_.ctl
    Finished restore at 2019-12-24 13:35:07

    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  logseq 32 thread 1;
    # set destinations for recovery set and auxiliary set datafiles
    set newname for clone datafile  1 to new;
    set newname for clone datafile  9 to new;
    set newname for clone datafile  4 to new;
    set newname for clone datafile  11 to new;
    set newname for clone datafile  3 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, 9, 4, 11, 3, 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 /u01/temp/res/ORA12C/datafile/o1_mf_temp_%u_.tmp in control file
    renamed tempfile 3 to /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_temp_%u_.tmp in control file

    Starting restore at 2019-12-24 13:35:17
    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 /u01/temp/res/ORA12C/datafile/o1_mf_system_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/temp/res/ORA12C/datafile/o1_mf_undotbs1_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/temp/res/ORA12C/datafile/o1_mf_sysaux_%u_.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /u01/rman_backup/db_fullbackup_ORA12C_74_1_20191224
    channel ORA_AUX_DISK_1: piece handle=/u01/rman_backup/db_fullbackup_ORA12C_74_1_20191224 tag=TAG20191224T130004
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:56
    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 /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_system_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00011 to /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_undotbs1_%u_.dbf
    channel ORA_AUX_DISK_1: restoring datafile 00010 to /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_sysaux_%u_.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /u01/rman_backup/db_fullbackup_ORA12C_75_1_20191224
    channel ORA_AUX_DISK_1: piece handle=/u01/rman_backup/db_fullbackup_ORA12C_75_1_20191224 tag=TAG20191224T130004
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
    Finished restore at 2019-12-24 13:36:40

    datafile 1 switched to datafile copy
    input datafile copy RECID=10 STAMP=1027863401 file name=/u01/temp/res/ORA12C/datafile/o1_mf_system_h04pm6gs_.dbf
    datafile 9 switched to datafile copy
    input datafile copy RECID=11 STAMP=1027863401 file name=/u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_system_h04pnz3t_.dbf
    datafile 4 switched to datafile copy
    input datafile copy RECID=12 STAMP=1027863401 file name=/u01/temp/res/ORA12C/datafile/o1_mf_undotbs1_h04pm6jj_.dbf
    datafile 11 switched to datafile copy
    input datafile copy RECID=13 STAMP=1027863401 file name=/u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_undotbs1_h04pnz45_.dbf
    datafile 3 switched to datafile copy
    input datafile copy RECID=14 STAMP=1027863401 file name=/u01/temp/res/ORA12C/datafile/o1_mf_sysaux_h04pm6ft_.dbf
    datafile 10 switched to datafile copy
    input datafile copy RECID=15 STAMP=1027863401 file name=/u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_sysaux_h04pnz1l_.dbf

    contents of Memory Script:
    {
    # set requested point in time
    set until  logseq 32 thread 1;
    # online the datafiles restored or switched
    sql clone "alter database datafile  1 online";
    sql clone 'ORA12CPDB1' "alter database datafile
     9 online";
    sql clone "alter database datafile  4 online";
    sql clone 'ORA12CPDB1' "alter database datafile
     11 online";
    sql clone "alter database datafile  3 online";
    sql clone 'ORA12CPDB1' "alter database datafile
     10 online";
    # recover and open database read only
    recover clone database tablespace  "SYSTEM", "ORA12CPDB1":"SYSTEM", "UNDOTBS1", "ORA12CPDB1":"UNDOTBS1", "SYSAUX", "ORA12CPDB1":"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  9 online

    sql statement: alter database datafile  4 online

    sql statement: alter database datafile  11 online

    sql statement: alter database datafile  3 online

    sql statement: alter database datafile  10 online

    Starting recover at 2019-12-24 13:36:44
    using channel ORA_AUX_DISK_1

    starting media recovery

    archived log for thread 1 with sequence 31 is already on disk as file /u01/app/oracle/archive_log/1_31_1027432868.dbf
    archived log file name=/u01/app/oracle/archive_log/1_31_1027432868.dbf thread=1 sequence=31
    media recovery complete, elapsed time: 00:00:07
    Finished recover at 2019-12-24 13:36:59

    sql statement: alter database open read only

    contents of Memory Script:
    {
    sql clone 'alter pluggable database  ORA12CPDB1 open read only';
    }
    executing Memory Script

    sql statement: alter pluggable database  ORA12CPDB1 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 =
      ''/u01/temp/res/ORA12C/controlfile/o1_mf_h04plqdp_.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     771751936 bytes

    Fixed Size                     8797536 bytes
    Variable Size                213910176 bytes
    Database Buffers             545259520 bytes
    Redo Buffers                   3784704 bytes

    sql statement: alter system set  control_files =   ''/u01/temp/res/ORA12C/controlfile/o1_mf_h04plqdp_.ctl'' comment= ''RMAN set'' scope=spfile

    Oracle instance shut down

    connected to auxiliary database (not started)
    Oracle instance started

    Total System Global Area     771751936 bytes

    Fixed Size                     8797536 bytes
    Variable Size                213910176 bytes
    Database Buffers             545259520 bytes
    Redo Buffers                   3784704 bytes

    sql statement: alter database mount clone database

    contents of Memory Script:
    {
    # set requested point in time
    set until  logseq 32 thread 1;
    # set destinations for recovery set and auxiliary set datafiles
    set newname for datafile  12 to new;
    # restore the tablespaces in the recovery set and the auxiliary set
    restore clone datafile  12;
     
    switch clone datafile all;
    }
    executing Memory Script

    executing command: SET until clause

    executing command: SET NEWNAME

    Starting restore at 2019-12-24 13:38:47
    allocated channel: ORA_AUX_DISK_1
    channel ORA_AUX_DISK_1: SID=34 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 00012 to /u01/temp/res/IWBC_PITR_ORA12CPDB1_ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_users_%u_.dbf
    channel ORA_AUX_DISK_1: reading from backup piece /u01/rman_backup/db_fullbackup_ORA12C_75_1_20191224
    channel ORA_AUX_DISK_1: piece handle=/u01/rman_backup/db_fullbackup_ORA12C_75_1_20191224 tag=TAG20191224T130004
    channel ORA_AUX_DISK_1: restored backup piece 1
    channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
    Finished restore at 2019-12-24 13:38:49

    datafile 12 switched to datafile copy
    input datafile copy RECID=17 STAMP=1027863529 file name=/u01/temp/res/IWBC_PITR_ORA12CPDB1_ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_users_h04psryr_.dbf

    contents of Memory Script:
    {
    # set requested point in time
    set until  logseq 32 thread 1;
    # online the datafiles restored or switched
    sql clone 'ORA12CPDB1' "alter database datafile
     12 online";
    # recover and open resetlogs
    recover clone database tablespace  "ORA12CPDB1":"USERS", "SYSTEM", "ORA12CPDB1":"SYSTEM", "UNDOTBS1", "ORA12CPDB1":"UNDOTBS1", "SYSAUX", "ORA12CPDB1":"SYSAUX" delete archivelog;
    alter clone database open resetlogs;
    }
    executing Memory Script

    executing command: SET until clause

    sql statement: alter database datafile  12 online

    Starting recover at 2019-12-24 13:38:50
    using channel ORA_AUX_DISK_1

    starting media recovery

    archived log for thread 1 with sequence 31 is already on disk as file /u01/app/oracle/archive_log/1_31_1027432868.dbf
    archived log file name=/u01/app/oracle/archive_log/1_31_1027432868.dbf thread=1 sequence=31
    media recovery complete, elapsed time: 00:00:02
    Finished recover at 2019-12-24 13:38:54

    database opened

    contents of Memory Script:
    {
    sql clone 'alter pluggable database  ORA12CPDB1 open';
    }
    executing Memory Script

    sql statement: alter pluggable database  ORA12CPDB1 open

    contents of Memory Script:
    {
    # create directory for datapump import
    sql 'ORA12CPDB1' "create or replace directory
    TSPITR_DIROBJ_DPDIR as ''
    /u01/temp/res/''";
    # create directory for datapump export
    sql clone 'ORA12CPDB1' "create or replace directory
    TSPITR_DIROBJ_DPDIR as ''
    /u01/temp/res/''";
    }
    executing Memory Script

    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/temp/res/''

    sql statement: create or replace directory TSPITR_DIROBJ_DPDIR as ''/u01/temp/res/''

    Performing export of tables...
       EXPDP> Starting "SYS"."TSPITR_EXP_iwbC_wFiF":  
       EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
       EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
       EXPDP> Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
       EXPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
       EXPDP> . . exported "HXL"."TB_TEST"                             5.593 KB      10 rows
       EXPDP> Master table "SYS"."TSPITR_EXP_iwbC_wFiF" successfully loaded/unloaded
       EXPDP> ******************************************************************************
       EXPDP> Dump file set for SYS.TSPITR_EXP_iwbC_wFiF is:
       EXPDP>   /u01/temp/res/tspitr_iwbC_36026.dmp
       EXPDP> Job "SYS"."TSPITR_EXP_iwbC_wFiF" successfully completed at Tue Dec 24 13:42:57 2019 elapsed 0 00:00:51
    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_iwbC_tdrD" successfully loaded/unloaded
       IMPDP> Starting "SYS"."TSPITR_IMP_iwbC_tdrD":  
       IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE
       IMPDP> Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
       IMPDP> . . imported "HXL"."TB_TB_TEST_RESTORE"                  5.593 KB      10 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_iwbC_tdrD" successfully completed at Tue Dec 24 13:43:57 2019 elapsed 0 00:00:28
    Import completed


    Removing automatic instance
    Automatic instance removed
    auxiliary instance file /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_temp_h04pqd4t_.tmp deleted
    auxiliary instance file /u01/temp/res/ORA12C/datafile/o1_mf_temp_h04ppmfx_.tmp deleted
    auxiliary instance file /u01/temp/res/IWBC_PITR_ORA12CPDB1_ORA12C/onlinelog/o1_mf_3_h04pt6n2_.log deleted
    auxiliary instance file /u01/temp/res/IWBC_PITR_ORA12CPDB1_ORA12C/onlinelog/o1_mf_2_h04pszlo_.log deleted
    auxiliary instance file /u01/temp/res/IWBC_PITR_ORA12CPDB1_ORA12C/onlinelog/o1_mf_1_h04pszkd_.log deleted
    auxiliary instance file /u01/temp/res/IWBC_PITR_ORA12CPDB1_ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_users_h04psryr_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_sysaux_h04pnz1l_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/datafile/o1_mf_sysaux_h04pm6ft_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_undotbs1_h04pnz45_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/datafile/o1_mf_undotbs1_h04pm6jj_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/9A000EB0D922315FE055000000000001/datafile/o1_mf_system_h04pnz3t_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/datafile/o1_mf_system_h04pm6gs_.dbf deleted
    auxiliary instance file /u01/temp/res/ORA12C/controlfile/o1_mf_h04plqdp_.ctl deleted
    auxiliary instance file tspitr_iwbC_36026.dmp deleted
    Finished recover at 2019-12-24 13:44:00

  • 相关阅读:
    Android开发学习一:环境搭建
    Python Challenge
    Python Challenge
    Python Challenge
    Centos中的mysql安装以及配置
    linux查询日志内容命令
    搭建elasticsearch过程中遇到的问题
    启动kafka后闪退
    zookeeper环境搭建
    nginx安装
  • 原文地址:https://www.cnblogs.com/hxlasky/p/12091090.html
Copyright © 2011-2022 走看看