• restore RMAN in 12c MT(Multitenant ) database flashback table


    *****************************************************************************

    NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner. For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

    ORACLE_SID=ora12mt
    Pfile location, and name: /u03/app/oracle/product/database/12.1.0.2/dbs/initora12mt.ora
    Backup location: /u03/backup
    Database, redolog, and Controlfile new location: /u03/database/oradata/ora12mt

    Source, old backup location: /u04/fra/ora12mt/ORA12MT
    Source database file and redolog log location: path: /u04/database/oradata/ora12mt
     

    *****************************************************************************

    ++ Identify the backups needed for this manual PITR restore / recovery  and copy it to destination server . In our test case we have copied the backups in location "/u03/backup/"    ---FRA

    ++ On the destination server  --异地恢复

            -- set the ORACLE_SID and bring the database to nomount stage

            -- restore the spfile from backup and create pfile from it

           

    $export ORACLE_SID=ora12mt

    $ rman target /

    Recovery Manager: Release 12.1.0.2.0 - Production on Thu Dec 15 09:36:25 2016

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

    connected to target database (not started)

    RMAN> startup nomount force;

    startup failed: ORA-01078: failure in processing system parameters
    LRM-00109: could not open parameter file '/u03/app/oracle/product/database/12.1.0.2/dbs/initora12mt.ora'

    starting Oracle instance without parameter file for retrieval of spfile
    Oracle instance started

    Total System Global Area 1073741824 bytes

    Fixed Size 2932632 bytes
    Variable Size 293601384 bytes
    Database Buffers 771751936 bytes
    Redo Buffers 5455872 bytes

    RMAN> restore spfile from '/u03/backup/o1_mf_s_928681105_d3br9ton_.bkp';------自己查

    Starting restore at 15-DEC-16
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=6 device type=DISK

    channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u03/backup/o1_mf_s_928681105_d3br9ton_.bkp
    channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
    Finished restore at 15-DEC-16

    RMAN>shutdown immediate;

    << connect to SQL*Plus and create pfile from the restored spfile

    SQL> create pfile from spfile;

    File created.

    SQL>

    ++ Modify the pfile parameters like location / memory etc on auxiliary server and bring the database to no-mount stage

    $ sqlplus "/as sysdba"

    SQL*Plus: Release 12.1.0.2.0 Production on Thu Dec 15 09:52:56 2016

    Copyright (c) 1982, 2014, Oracle. All rights reserved.

    Connected to an idle instance.

    SQL> startup nomount pfile='initora12mt.ora';
    ORACLE instance started.

    Total System Global Area 629145600 bytes
    Fixed Size 2927528 bytes
    Variable Size 310379608 bytes
    Database Buffers 310378496 bytes
    Redo Buffers 5459968 bytes
    SQL> exit
    Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

    ++ Restore the controlfile and bring the database to mount stage

    $ rman target /

    Recovery Manager: Release 12.1.0.2.0 - Production on Thu Dec 15 09:53:40 2016

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

    connected to target database: ORA12MT (not mounted)

    RMAN> restore controlfile from '/u03/backup/o1_mf_s_928683729_d3btvsvn_.bkp';

    Starting restore at 15-DEC-16
    using channel ORA_DISK_1

    channel ORA_DISK_1: restoring control file
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    output file name=/u03/database/oradata/ora12mt/control01.dbf
    Finished restore at 15-DEC-16

    RMAN> alter database mount;

    Statement processed
    released channel: ORA_DISK_1

    ++ Catalog the backup pieces, run the crosscheck and delete the expired backup

    RMAN> catalog start with '/u03/backup/' noprompt;

    Starting implicit crosscheck backup at 15-DEC-16
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=242 device type=DISK
    Crosschecked 6 objects
    Finished implicit crosscheck backup at 15-DEC-16

    Starting implicit crosscheck copy at 15-DEC-16
    using channel ORA_DISK_1
    Finished implicit crosscheck copy at 15-DEC-16

    searching for all files in the recovery area
    cataloging files...
    no files cataloged

    searching for all files that match the pattern /u03/backup/

    List of Files Unknown to the Database
    =====================================
    File Name: /u03/backup/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp
    File Name: /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp
    File Name: /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp
    File Name: /u03/backup/o1_mf_s_928683729_d3btvsvn_.bkp
    File Name: /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp
    File Name: /u03/backup/o1_mf_s_928681105_d3br9ton_.bkp
    File Name: /u03/backup/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp
    cataloging files...
    cataloging done

    List of Cataloged Files
    =======================
    File Name: /u03/backup/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp
    File Name: /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp
    File Name: /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp
    File Name: /u03/backup/o1_mf_s_928683729_d3btvsvn_.bkp
    File Name: /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp
    File Name: /u03/backup/o1_mf_s_928681105_d3br9ton_.bkp
    File Name: /u03/backup/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp

    RMAN> crosscheck backup;

    using channel ORA_DISK_1
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp RECID=3 STAMP=928680915
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp RECID=15 STAMP=930650099
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp RECID=4 STAMP=928680918
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp RECID=11 STAMP=930650099
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u04/fra/ora12mt/ORA12MT/37E8C85AD7431EDBE0531602A8C02428/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp RECID=5 STAMP=928681004
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp RECID=10 STAMP=930650099
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u04/fra/ora12mt/ORA12MT/37E8BA3824481B77E0531602A8C080DD/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp RECID=6 STAMP=928681059
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp RECID=13 STAMP=930650099
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp RECID=7 STAMP=928681104
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp RECID=9 STAMP=930650099
    crosschecked backup piece: found to be 'EXPIRED'
    backup piece handle=/u04/fra/ora12mt/ORA12MT/autobackup/2016_11_23/o1_mf_s_928681105_d3br9ton_.bkp RECID=8 STAMP=928681106
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_s_928681105_d3br9ton_.bkp RECID=14 STAMP=930650099
    crosschecked backup piece: found to be 'AVAILABLE'
    backup piece handle=/u03/backup/o1_mf_s_928683729_d3btvsvn_.bkp RECID=12 STAMP=930650099
    Crosschecked 13 objects

    RMAN> delete expired backup ;

    using channel ORA_DISK_1

    List of Backup Pieces
    BP Key BS Key Pc# Cp# Status Device Type Piece Name
    ------- ------- --- --- ----------- ----------- ----------
    3 3 1 1 EXPIRED DISK /u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp
    4 4 1 1 EXPIRED DISK /u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp
    5 5 1 1 EXPIRED DISK /u04/fra/ora12mt/ORA12MT/37E8C85AD7431EDBE0531602A8C02428/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp
    6 6 1 1 EXPIRED DISK /u04/fra/ora12mt/ORA12MT/37E8BA3824481B77E0531602A8C080DD/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp
    7 7 1 1 EXPIRED DISK /u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp
    8 8 1 1 EXPIRED DISK /u04/fra/ora12mt/ORA12MT/autobackup/2016_11_23/o1_mf_s_928681105_d3br9ton_.bkp

    Do you really want to delete the above objects (enter YES or NO)? yes
    deleted backup piece
    backup piece handle=/u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp RECID=3 STAMP=928680915
    deleted backup piece
    backup piece handle=/u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp RECID=4 STAMP=928680918
    deleted backup piece
    backup piece handle=/u04/fra/ora12mt/ORA12MT/37E8C85AD7431EDBE0531602A8C02428/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp RECID=5 STAMP=928681004
    deleted backup piece
    backup piece handle=/u04/fra/ora12mt/ORA12MT/37E8BA3824481B77E0531602A8C080DD/backupset/2016_11_23/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp RECID=6 STAMP=928681059
    deleted backup piece
    backup piece handle=/u04/fra/ora12mt/ORA12MT/backupset/2016_11_23/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp RECID=7 STAMP=928681104
    deleted backup piece
    backup piece handle=/u04/fra/ora12mt/ORA12MT/autobackup/2016_11_23/o1_mf_s_928681105_d3br9ton_.bkp RECID=8 STAMP=928681106
    Deleted 6 EXPIRED objects

    ++ Get the structure of database (needed for prepare script of restore )

    RMAN> report schema;

    using target database control file instead of recovery catalog
    RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
    Report of database schema for database with db_unique_name ORA12MT

    List of Permanent Datafiles
    ===========================
    File Size(MB) Tablespace RB segs Datafile Name
    ---- -------- -------------------- ------- ------------------------
    1 0 SYSTEM *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-SYSTEM_FNO-1_0brcua0p
    3 0 SYSAUX *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-SYSAUX_FNO-3_0crcua0s
    4 0 UNDOTBS1 *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-UNDOTBS1_FNO-4_0frcua1q
    5 0 PDB$SEED:SYSTEM *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-SYSTEM_FNO-5_0grcua21
    6 0 USERS *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-USERS_FNO-6_0ircua2f
    7 0 PDB$SEED:SYSAUX *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-SYSAUX_FNO-7_0drcua1b
    8 0 PDB1:SYSTEM *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-SYSTEM_FNO-8_0hrcua28
    9 0 PDB1:SYSAUX *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-SYSAUX_FNO-9_0ercua1i
    10 0 PDB1:USERS *** /u04/database/oradata/ora12mt/data_data_D-ORA12MT_I-4146636107_TS-USERS_FNO-10_0jrcua2g
    11 0 T1 *** /u04/database/oradata/ora12mt/t1.dbf
    12 0 PDB1:T1 *** /u04/database/oradata/ora12mt/t1-pdb1.dbf

    List of Temporary Files
    =======================
    File Size(MB) Tablespace Maxsize(MB) Tempfile Name
    ---- -------- -------------------- ----------- --------------------
    1 60 TEMP 32767 /u04/database/oradata/ora12mt/ORA12MT/datafile/o1_mf_temp_ctpogy8o_.tmp
    2 20 PDB$SEED:TEMP 32767 /u03/database/oradata/ora12mt/ORA12MT/datafile/pdbseed_temp012016-07-18_05-31-24-PM.dbf
    3 20 PDB1:TEMP 32767 /u04/database/oradata/ora12mt/ORA12MT/37E8C85AD7431EDBE0531602A8C02428/datafile/o1_mf_temp_cttxkklv_.tmp

    ++ To extract the data from the table which is part of PDB all we need is

              

    -- SYSTEM,SYSAUX,   (in case of RAC include all the undo tablespaces from each node) of ROOT

    -- PDB$SEED

    -- SYSTEM,SYSAUX,   and of Pluggable database

    Syntax will be as below

          restore database root skip tablespace database "PDB$SEED" database skip tablespace ;

    (in our case table information in USERS tablespace of pluggable database PDB1)

    RMAN> run{
    allocate channel t1 type disk;
    allocate channel t2 type disk;
    allocate channel t3 type disk;
    allocate channel t4 type disk;
    SET UNTIL TIME = "to_date('2016-11-23 14:56:30','YYYY/MM/DD HH24:MI:SS')";
    set newname for database root to '/u03/database/oradata/ora12mt/%U';
    set newname for database "PDB$SEED" to '/u03/database/oradata/ora12mt/%U';
    set newname for datafile 8 to '/u03/database/oradata/ora12mt/%U';
    set newname for datafile 9 to '/u03/database/oradata/ora12mt/%U';
    set newname for datafile 10 to '/u03/database/oradata/ora12mt/%U';
    restore database root skip tablespace users database "PDB$SEED" database PDB1 skip tablespace PDB1:T1;
    switch datafile 1;
    switch datafile 3;
    switch datafile 4;
    switch datafile 5;
    switch datafile 7;
    switch datafile 8;
    switch datafile 9;
    switch datafile 10;
    }2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21>

    released channel: ORA_DISK_1
    allocated channel: t1
    channel t1: SID=242 device type=DISK

    allocated channel: t2
    channel t2: SID=355 device type=DISK

    allocated channel: t3
    channel t3: SID=8 device type=DISK

    allocated channel: t4
    channel t4: SID=125 device type=DISK

    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

    Starting restore at 15-DEC-16

    channel t1: starting datafile backup set restore
    channel t1: specifying datafile(s) to restore from backup set
    channel t1: restoring datafile 00001 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSTEM_FNO-1
    channel t1: restoring datafile 00003 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSAUX_FNO-3
    channel t1: restoring datafile 00004 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-UNDOTBS1_FNO-4
    channel t1: reading from backup piece /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp
    channel t2: starting datafile backup set restore
    channel t2: specifying datafile(s) to restore from backup set
    channel t2: restoring datafile 00008 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSTEM_FNO-8
    channel t2: restoring datafile 00009 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSAUX_FNO-9
    channel t2: restoring datafile 00010 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-USERS_FNO-10
    channel t2: reading from backup piece /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp
    channel t3: starting datafile backup set restore
    channel t3: specifying datafile(s) to restore from backup set
    channel t3: restoring datafile 00005 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSTEM_FNO-5
    channel t3: restoring datafile 00007 to /u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSAUX_FNO-7
    channel t3: reading from backup piece /u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp
    channel t3: piece handle=/u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br8c6d_.bkp tag=TAG20161123T145518
    channel t3: restored backup piece 1
    channel t3: restore complete, elapsed time: 00:01:45
    channel t2: piece handle=/u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br6n46_.bkp tag=TAG20161123T145518
    channel t2: restored backup piece 1
    channel t2: restore complete, elapsed time: 00:01:56
    channel t1: piece handle=/u03/backup/o1_mf_nnndf_TAG20161123T145518_d3br3yyn_.bkp tag=TAG20161123T145518
    channel t1: restored backup piece 1
    channel t1: restore complete, elapsed time: 00:02:36
    Finished restore at 15-DEC-16

    datafile 1 switched to datafile copy
    input datafile copy RECID=53 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSTEM_FNO-1

    datafile 3 switched to datafile copy
    input datafile copy RECID=54 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSAUX_FNO-3

    datafile 4 switched to datafile copy
    input datafile copy RECID=55 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-UNDOTBS1_FNO-4

    datafile 5 switched to datafile copy
    input datafile copy RECID=56 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSTEM_FNO-5

    datafile 7 switched to datafile copy
    input datafile copy RECID=57 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSAUX_FNO-7

    datafile 8 switched to datafile copy
    input datafile copy RECID=58 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSTEM_FNO-8

    datafile 9 switched to datafile copy
    input datafile copy RECID=59 STAMP=930653716 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-SYSAUX_FNO-9

    datafile 10 switched to datafile copy
    input datafile copy RECID=60 STAMP=930653717 file name=/u03/database/oradata/ora12mt/data_D-ORA12MT_TS-USERS_FNO-10
    released channel: t1
    released channel: t2
    released channel: t3
    released channel: t4

    ++ Identify the archives and restore it from backup

    RMAN> list backup of archivelog all;

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

    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    3 10.21M DISK 00:00:03 23-NOV-16
    BP Key: 15 Status: AVAILABLE Compressed: YES Tag: TAG20161123T145514
    Piece Name: /u03/backup/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp

    List of Archived Logs in backup set 3
    Thrd Seq Low SCN Low Time Next SCN Next Time
    ---- ------- ---------- --------- ---------- ---------
    1 54 2107527 11-OCT-16 7688704 23-NOV-16
    1 55 7688704 23-NOV-16 7689057 23-NOV-16

    BS Key Size Device Type Elapsed Time Completion Time
    ------- ---------- ----------- ------------ ---------------
    7 13.00K DISK 00:00:00 23-NOV-16
    BP Key: 9 Status: AVAILABLE Compressed: YES Tag: TAG20161123T145824
    Piece Name: /u03/backup/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp

    List of Archived Logs in backup set 7
    Thrd Seq Low SCN Low Time Next SCN Next Time
    ---- ------- ---------- --------- ---------- ---------
    1 56 7689057 23-NOV-16 7689108 23-NOV-16
    1 57 7689108 23-NOV-16 7689190 23-NOV-16

    RMAN> restore archivelog from logseq 54 until logseq 57;

    Starting restore at 15-DEC-16
    using channel ORA_DISK_1

    channel ORA_DISK_1: starting archived log restore to default destination
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=54
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=55
    channel ORA_DISK_1: reading from backup piece /u03/backup/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp
    channel ORA_DISK_1: piece handle=/u03/backup/o1_mf_annnn_TAG20161123T145514_d3br3v24_.bkp tag=TAG20161123T145514
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
    channel ORA_DISK_1: starting archived log restore to default destination
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=56
    channel ORA_DISK_1: restoring archived log
    archived log thread=1 sequence=57
    channel ORA_DISK_1: reading from backup piece /u03/backup/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp
    channel ORA_DISK_1: piece handle=/u03/backup/o1_mf_annnn_TAG20161123T145824_d3br9rpz_.bkp tag=TAG20161123T145824
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
    Finished restore at 15-DEC-16

    Recovery Manager complete.

    ++ Now, we need to turn offline all the remaining datafiles (not part of restore )

    $ sqlplus "/as sysdba"

    SQL*Plus: Release 12.1.0.2.0 Production on Thu Dec 15 11:37:16 2016

    Copyright (c) 1982, 2014, Oracle. All rights reserved.

    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

    SQL> select 'container : '||c.name|| ' : alter database datafile '||d.file#||' offline drop;' from v$datafile d ,v$containers c
    2 where d.con_id=c.con_id
    3 and d.file# in (select file# from v$datafile_header where length(error)>=1)
    4 order by c.con_id;

    'CONTAINER:'||C.NAME||':ALTERDATABASEDATAFILE'||D.FILE#||'OFFLINEDROP;'
    --------------------------------------------------------------------------------
    container : CDB$ROOT : alter database datafile 6 offline drop;
    container : CDB$ROOT : alter database datafile 11 offline drop;
    container : PDB1 : alter database datafile 12 offline drop;

    SQL> show con_name

    CON_NAME
    ------------------------------
    CDB$ROOT
    SQL> alter database datafile 6 offline drop;

    Database altered.

    SQL> alter database datafile 11 offline drop;

    Database altered.

    SQL> alter session set container=PDB1;

    Session altered.

    SQL> alter database datafile 12 offline drop;

    Database altered.

    SQL>

    ++ Now,complete the recovery

     SQL>recover automatic database UNTIL TIME '2016/11/23 14:56:30' USING BACKUP CONTROLFILE;

    Media recovery complete.

    ++ Check the redo log file location and name ,change it if required and open DB w/ resetlogs

    SQL> select member from v$logfile;

    MEMBER
    --------------------------------------------------------------------------------
    /u04/database/oradata/ora12mt/redo04_1.dbf
    /u04/database/oradata/ora12mt/redo05_1.dbf
    /u04/database/oradata/ora12mt/redo06_1.dbf

    SQL> alter database rename file '/u04/database/oradata/ora12mt/redo04_1.dbf' to '/u03/database/oradata/ora12mt/redo-01.dbf';

    Database altered.

    SQL> alter database rename file '/u04/database/oradata/ora12mt/redo05_1.dbf' to '/u03/database/oradata/ora12mt/redo-02.dbf';

    Database altered.

    SQL> alter database rename file '/u04/database/oradata/ora12mt/redo06_1.dbf' to '/u03/database/oradata/ora12mt/redo-03.dbf';

    Database altered.

    SQL> alter database open resetlogs;

    Database altered.

    SQL>

     Now, you can extract the data from table and import it back to production

  • 相关阅读:
    进程通信——共享内存
    gRPC使用案例-使用gRPC获取数据库版本
    ELF 文件介绍
    Java面试
    npm install 一直在等待sill idealTree buildDeps
    学校常见的网络舆情风险点及防控措施有哪些?
    阿里 P7 到底是怎样的水平?
    五子棋游戏AI智能算法设计
    组合式API_生命周期
    SystemVerilog-Function 和 task
  • 原文地址:https://blog.csdn.net/jnrjian/article/details/132583630