Manual de Mantenimiento e implementación Oracle Database Backup Cloud Service - Parte 2: Casos de uso

Por Ronald Vargas Quesada Oracle ACE director
Publicado en Abril 2018

Revisado por Lorenzo Mota


Esta es la continuación del artículo Manual de Mantenimiento e implementación Oracle Database Backup Cloud Service. En esta segunda parte veremos algunos casos de uso.



RECUPERACIÓN DE UN PDB CON UN SCN ESPECÍFICO


login as: root
root@192.168.1.78's password:
Last login: Wed Apr 19 08:43:26 2017 from 192.168.1.6
[root@server01db ~]# su - oracle
[oracle@server01db ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1
The Oracle base has been set to /opt/app/oracle
[oracle@server01db ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-APR-2017 08:58:11

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server01db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                19-APR-2017 08:44:44
Uptime                    0 days 0 hr. 13 min. 27 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/app/oracle/diag/tnslsnr/server01db/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server01db)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
[oracle@server01db ~]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Wed Apr 19 08:58:19 2017

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

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size                  8801008 bytes
Variable Size             503317776 bytes
Database Buffers          553648128 bytes
Redo Buffers                7974912 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@server01db ~]$ . oraenv
ORACLE_SID = [cdb1] ? repo
The Oracle base remains unchanged with value /opt/app/oracle
[oracle@server01db ~]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Wed Apr 19 08:59:44 2017

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

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  645922816 bytes
Fixed Size                  8624024 bytes
Variable Size             301992040 bytes
Database Buffers          327155712 bytes
Redo Buffers                8151040 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@server01db ~]$ . oraenv
ORACLE_SID = [repo] ? cdb1
The Oracle base remains unchanged with value /opt/app/oracle
[oracle@server01db ~]$ rman target / catalog rman/rman@repo

Recovery Manager: Release 12.2.0.1.0 - Production on Wed Apr 19 09:03:11 2017

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

connected to target database: CDB1 (DBID=912848444)
connected to recovery catalog database

RMAN> backup database plus archivelog delete input;


Starting backup at 19-APR-17
current log archived
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=8 RECID=1 STAMP=941629681
channel ORA_SBT_TAPE_1: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: starting compressed archived log backup set
channel ORA_SBT_TAPE_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=14 STAMP=941707617
input archived log thread=1 sequence=22 RECID=15 STAMP=941709267
input archived log thread=1 sequence=23 RECID=16 STAMP=941709604
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_3: starting compressed archived log backup set
channel ORA_SBT_TAPE_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=17 RECID=10 STAMP=941641838
input archived log thread=1 sequence=18 RECID=11 STAMP=941652362
input archived log thread=1 sequence=19 RECID=12 STAMP=941653359
input archived log thread=1 sequence=20 RECID=13 STAMP=941706679
channel ORA_SBT_TAPE_3: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_4: starting compressed archived log backup set
channel ORA_SBT_TAPE_4: specifying archived log(s) in backup set
input archived log thread=1 sequence=9 RECID=2 STAMP=941629775
input archived log thread=1 sequence=10 RECID=3 STAMP=941630357
input archived log thread=1 sequence=11 RECID=4 STAMP=941630550
input archived log thread=1 sequence=12 RECID=5 STAMP=941630596
channel ORA_SBT_TAPE_4: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_4: finished piece 1 at 19-APR-17
piece handle=1as22m96_1_1 tag=TAG20170419T100005 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:00:35
channel ORA_SBT_TAPE_4: deleting archived log(s)
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_9_939131007.arc
 RECID=2 STAMP=941629775
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_10_939131007.arc
 RECID=3 STAMP=941630357
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_11_939131007.arc
 RECID=4 STAMP=941630550
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_12_939131007.arc
 RECID=5 STAMP=941630596
channel ORA_SBT_TAPE_4: starting compressed archived log backup set
channel ORA_SBT_TAPE_4: specifying archived log(s) in backup set
input archived log thread=1 sequence=13 RECID=6 STAMP=941630708
input archived log thread=1 sequence=14 RECID=7 STAMP=941630789
input archived log thread=1 sequence=15 RECID=8 STAMP=941630818
input archived log thread=1 sequence=16 RECID=9 STAMP=941631408
channel ORA_SBT_TAPE_4: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=18s22m96_1_1 tag=TAG20170419T100005 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:51
channel ORA_SBT_TAPE_2: deleting archived log(s)
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_21_939131007.arc
 RECID=14 STAMP=941707617
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_22_939131007.arc
 RECID=15 STAMP=941709267
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_23_939131007.arc
 RECID=16 STAMP=941709604
channel ORA_SBT_TAPE_3: finished piece 1 at 19-APR-17
piece handle=19s22m96_1_1 tag=TAG20170419T100005 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_3: backup set complete, elapsed time: 00:01:03
channel ORA_SBT_TAPE_2: deleting archived log(s)
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_17_939131007.arc
 RECID=10 STAMP=941641838
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_18_939131007.arc
 RECID=11 STAMP=941652362
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_19_939131007.arc
 RECID=12 STAMP=941653359
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_20_939131007.arc
 RECID=13 STAMP=941706679
channel ORA_SBT_TAPE_4: finished piece 1 at 19-APR-17
piece handle=1bs22maa_1_1 tag=TAG20170419T100005 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:00:47
channel ORA_SBT_TAPE_2: deleting archived log(s)
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_13_939131007.arc
 RECID=6 STAMP=941630708
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_14_939131007.arc
 RECID=7 STAMP=941630789
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_15_939131007.arc
 RECID=8 STAMP=941630818
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_16_939131007.arc
 RECID=9 STAMP=941631408
channel ORA_SBT_TAPE_1: finished piece 1 at 19-APR-17
piece handle=17s22m96_1_1 tag=TAG20170419T100005 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:44
channel ORA_SBT_TAPE_1: deleting archived log(s)
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_8_939131007.arc
 RECID=1 STAMP=941629681
Finished backup at 19-APR-17

Starting backup at 19-APR-17
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed full datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/opt/app/oracle/oradata/cdb1/system01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00003 name=/opt/app/oracle/oradata/cdb1/sysaux01.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_3: starting compressed full datafile backup set
channel ORA_SBT_TAPE_3: specifying datafile(s) in backup set
input datafile file number=00010 name=/opt/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
channel ORA_SBT_TAPE_3: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_4: starting compressed full datafile backup set
channel ORA_SBT_TAPE_4: specifying datafile(s) in backup set
input datafile file number=00006 name=/opt/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
channel ORA_SBT_TAPE_4: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_4: finished piece 1 at 19-APR-17
piece handle=1fs22mck_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:02:26
channel ORA_SBT_TAPE_4: starting compressed full datafile backup set
channel ORA_SBT_TAPE_4: specifying datafile(s) in backup set
input datafile file number=00009 name=/opt/app/oracle/oradata/cdb1/pdb1/system01.dbf
input datafile file number=00012 name=/opt/app/oracle/oradata/cdb1/pdb1/users01.dbf
channel ORA_SBT_TAPE_4: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_4: finished piece 1 at 19-APR-17
piece handle=1gs22mhf_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:00:55
channel ORA_SBT_TAPE_4: starting compressed full datafile backup set
channel ORA_SBT_TAPE_4: specifying datafile(s) in backup set
input datafile file number=00005 name=/opt/app/oracle/oradata/cdb1/pdbseed/system01.dbf
channel ORA_SBT_TAPE_4: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=1ds22mci_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:05:17
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00011 name=/opt/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf
input datafile file number=00013 name=/opt/app/oracle/oradata/cdb1/pdb1/CDB1/
4B2FD5D1B0F83FD0E0530A02000A3008/datafile/o1_mf_tbs_data_dhh1116p_.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=1is22mmg_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:45
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00008 name=/opt/app/oracle/oradata/cdb1/pdbseed/undotbs01.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=1js22mnt_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:01:25
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00004 name=/opt/app/oracle/oradata/cdb1/undotbs01.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=1ks22mqi_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:36
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00007 name=/opt/app/oracle/oradata/cdb1/users01.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=1ls22mrm_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:45
channel ORA_SBT_TAPE_4: finished piece 1 at 19-APR-17
piece handle=1hs22mj6_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:08:17
channel ORA_SBT_TAPE_3: finished piece 1 at 19-APR-17
piece handle=1es22mcj_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_3: backup set complete, elapsed time: 00:15:38
channel ORA_SBT_TAPE_1: finished piece 1 at 19-APR-17
piece handle=1cs22mch_1_1 tag=TAG20170419T100150 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:15:60
Finished backup at 19-APR-17

Starting backup at 19-APR-17
current log archived
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=24 RECID=17 STAMP=941710675
channel ORA_SBT_TAPE_1: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_1: finished piece 1 at 19-APR-17
piece handle=1ms22nal_1_1 tag=TAG20170419T101757 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:35
channel ORA_SBT_TAPE_1: deleting archived log(s)
archived log file name=/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_24_939131007.arc 
RECID=17 STAMP=941710675
Finished backup at 19-APR-17

Starting Control File and SPFILE Autobackup at 19-APR-17
piece handle=c-912848444-20170419-05 comment=API Version 2.0,MMS Version 3.17.3.23
Finished Control File and SPFILE Autobackup at 19-APR-17

RMAN>
==========================================
SQL> truncate table t;

Table truncated.

SQL> execute insertar

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> select count(*) from t;

  COUNT(*)
----------
    100000

SQL> connect system/oracle@pdb1
Connected.
SQL> select timestamp_to_scn(sysdate) from v$database;

TIMESTAMP_TO_SCN(SYSDATE)
-------------------------
                  1949607

SQL> connect error/error@pdb1
Connected.
SQL> truncate table t;

Table truncated.

SQL> select count(*) from t;

  COUNT(*)
----------
         0

SQL> connect / as sysdba
Connected.
SQL> alter pluggable database pdb1 close;

Pluggable database altered.

SQL>
==========================================

[oracle@server01db ~]$ clear screen
[oracle@server01db ~]$ rman target / catalog rman/rman@repo

Recovery Manager: Release 12.2.0.1.0 - Production on Wed Apr 19 12:40:12 2017

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

connected to target database: CDB1 (DBID=912848444)
connected to recovery catalog database

RMAN> set decryption identified by "cloud01";

executing command: SET decryption
starting full resync of recovery catalog
full resync complete

RMAN> run {
set until SCN=1949607;
restore pluggable database pdb1;
recover pluggable database pdb1 auxiliary destination '/opt/app/tmp';
alter pluggable database pdb1 open resetlogs;
}

executing command: SET until clause

Starting restore at 19-APR-17
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=270 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=278 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_3
channel ORA_SBT_TAPE_3: SID=36 device type=SBT_TAPE
channel ORA_SBT_TAPE_3: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_4: SID=274 device type=SBT_TAPE
channel ORA_SBT_TAPE_4: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=262 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=41 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=266 device type=DISK

channel ORA_SBT_TAPE_1: starting datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_1: restoring datafile 00009 to 
/opt/app/oracle/oradata/cdb1/pdb1/system01.dbf
channel ORA_SBT_TAPE_1: restoring datafile 00012 to 
/opt/app/oracle/oradata/cdb1/pdb1/users01.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 1gs22mhf_1_1
channel ORA_SBT_TAPE_2: starting datafile backup set restore
channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_2: restoring datafile 00011 to /opt/app/oracle/oradata/cdb1/
pdb1/undotbs01.dbf
channel ORA_SBT_TAPE_2: restoring datafile 00013 to /opt/app/oracle/oradata/cdb1/
pdb1/CDB1/4B2FD5D1B0F83FD0E0530A02000A3008/datafile/o1_mf_tbs_data_dhh1116p_.dbf
channel ORA_SBT_TAPE_2: reading from backup piece 1is22mmg_1_1
channel ORA_SBT_TAPE_3: starting datafile backup set restore
channel ORA_SBT_TAPE_3: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_3: restoring datafile 00010 to /opt/app/oracle/oradata/cdb1
/pdb1/sysaux01.dbf
channel ORA_SBT_TAPE_3: reading from backup piece 1es22mcj_1_1
channel ORA_SBT_TAPE_2: piece handle=1is22mmg_1_1 tag=TAG20170419T100150
channel ORA_SBT_TAPE_2: restored backup piece 1
channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:15
channel ORA_SBT_TAPE_1: piece handle=1gs22mhf_1_1 tag=TAG20170419T100150
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:02:15
channel ORA_SBT_TAPE_3: piece handle=1es22mcj_1_1 tag=TAG20170419T100150
channel ORA_SBT_TAPE_3: restored backup piece 1
channel ORA_SBT_TAPE_3: restore complete, elapsed time: 00:05:15
Finished restore at 19-APR-17

Starting recover at 19-APR-17
current log archived
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4


starting media recovery

archived log for thread 1 with sequence 24 is already on disk as file 
/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_24_939131007.arc
archived log for thread 1 with sequence 25 is already on disk as file 
/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_25_939131007.arc
archived log for thread 1 with sequence 26 is already on disk as file 
/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_26_939131007.arc
archived log for thread 1 with sequence 27 is already on disk as file 
/opt/app/oracle/product/12.2.0/dbhome_1/dbs/archcdb1_1_27_939131007.arc
media recovery complete, elapsed time: 00:00:12
Finished recover at 19-APR-17
starting full resync of recovery catalog
full resync complete

Statement processed
starting full resync of recovery catalog
full resync complete

RMAN>

===================== Segundo escenario ===========
RMAN> resync catalog;

starting full resync of recovery catalog
full resync complete

RMAN> set encryption on identified by "cloud01" only;

executing command: SET encryption

RMAN> backup pluggable database pdb1 plus archivelog;


Starting backup at 19-APR-17
current log archived
released channel: ORA_DISK_1
released channel: ORA_DISK_2
released channel: ORA_DISK_3
released channel: ORA_DISK_4
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=26 RECID=19 STAMP=941713575
input archived log thread=1 sequence=27 RECID=21 STAMP=941719589
channel ORA_SBT_TAPE_1: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: starting compressed archived log backup set
channel ORA_SBT_TAPE_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=24 RECID=20 STAMP=941716302
input archived log thread=1 sequence=25 RECID=18 STAMP=941712301
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_3: starting compressed archived log backup set
channel ORA_SBT_TAPE_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=28 RECID=22 STAMP=941719892
channel ORA_SBT_TAPE_3: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=28s230am_1_1 tag=TAG20170419T125133 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:25
channel ORA_SBT_TAPE_3: finished piece 1 at 19-APR-17
piece handle=29s230am_1_1 tag=TAG20170419T125133 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_3: backup set complete, elapsed time: 00:00:25
channel ORA_SBT_TAPE_1: finished piece 1 at 19-APR-17
piece handle=27s230am_1_1 tag=TAG20170419T125133 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:45
Finished backup at 19-APR-17

Starting backup at 19-APR-17
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed full datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00010 name=/opt/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00009 name=/opt/app/oracle/oradata/cdb1/pdb1/system01.dbf
input datafile file number=00012 name=/opt/app/oracle/oradata/cdb1/pdb1/users01.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_3: starting compressed full datafile backup set
channel ORA_SBT_TAPE_3: specifying datafile(s) in backup set
input datafile file number=00011 name=/opt/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf
input datafile file number=00013 name=/opt/app/oracle/oradata/cdb1/pdb1/CDB1/
4B2FD5D1B0F83FD0E0530A02000A3008/datafile/o1_mf_tbs_data_dhh1116p_.dbf
channel ORA_SBT_TAPE_3: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_3: finished piece 1 at 19-APR-17
piece handle=2cs230c5_1_1 tag=TAG20170419T125219 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_3: backup set complete, elapsed time: 00:00:15
channel ORA_SBT_TAPE_1: finished piece 1 at 19-APR-17
piece handle=2as230c5_1_1 tag=TAG20170419T125219 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:35
channel ORA_SBT_TAPE_2: finished piece 1 at 19-APR-17
piece handle=2bs230c5_1_1 tag=TAG20170419T125219 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:03:25
Finished backup at 19-APR-17

Starting backup at 19-APR-17
current log archived
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=29 RECID=23 STAMP=941720146
channel ORA_SBT_TAPE_1: starting piece 1 at 19-APR-17
channel ORA_SBT_TAPE_1: finished piece 1 at 19-APR-17
piece handle=2ds230ij_1_1 tag=TAG20170419T125547 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:15
Finished backup at 19-APR-17

Starting Control File and SPFILE Autobackup at 19-APR-17
piece handle=c-912848444-20170419-09 comment=API Version 2.0,MMS Version 3.17.3.23
Finished Control File and SPFILE Autobackup at 19-APR-17

RMAN>




RECUPERACIÓN DE UNA BASE DE DATOS PDB A UNA HORA DETERMINADA


SQL> show user
USER is "HR"
SQL> clear screen
SQL> select * from cat;

TABLE_NAME                               TABLE_TYPE
---------------------------------------- -----------
REGIONS                                  TABLE
COUNTRIES                                TABLE
LOCATIONS                                TABLE
LOCATIONS_SEQ                            SEQUENCE
DEPARTMENTS                              TABLE
DEPARTMENTS_SEQ                          SEQUENCE
JOBS                                     TABLE
EMPLOYEES                                TABLE
EMPLOYEES_SEQ                            SEQUENCE
JOB_HISTORY                              TABLE
EMP_DETAILS_VIEW                         VIEW
T                                        TABLE

12 rows selected.

SQL> create table empleados as select * from employees;

Table created.

SQL> select count(*) from empleados;

  COUNT(*)
----------
       107

SQL> select * from empleados;

EMPLOYEE_ID FIRST_NAME           LAST_NAME                 EMAIL       
----------- -------------------- ------------------------- ------------
        100 Steven               King                      SKING       
        101 Neena                Kochhar                   NKOCHHAR    
        102 Lex                  De Haan                   LDEHAAN     
        103 Alexander            Hunold                    AHUNOLD     
        104 Bruce                Ernst                     BERNST      
        105 David                Austin                    DAUSTIN     
        106 Valli                Pataballa                 VPATABAL    
        107 Diana                Lorentz                   DLORENTZ    
        108 Nancy                Greenberg                 NGREENBE    
        109 Daniel               Faviet                    DFAVIET     
        110 John                 Chen                      JCHEN       
        111 Ismael               Sciarra                   ISCIARRA    
        112 Jose Manuel          Urman                     JMURMAN     
        113 Luis                 Popp                      LPOPP       
        114 Den                  Raphaely                  DRAPHEAL    
        115 Alexander            Khoo                      AKHOO       
...
107 rows selected.

SQL> drop table empleados;

Table dropped.

SQL> flashback table empleados to before drop;

Flashback complete.

SQL> select count(*) from empleados;

  COUNT(*)
----------
       107

SQL> select to_char(sysdate,'dd-mon-yyyy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'DD-MON-YYYYH
-----------------------------
20-apr-2017 14:51:55

[oracle@server01db ~]$ sqlplus hr/hr@pdb1

SQL*Plus: Release 12.2.0.1.0 Production on Thu Apr 20 15:20:49 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Last Successful login time: Thu Apr 20 2017 14:45:49 -06:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select * from cat;

TABLE_NAME                               TABLE_TYPE
---------------------------------------- -----------
REGIONS                                  TABLE
COUNTRIES                                TABLE
LOCATIONS                                TABLE
LOCATIONS_SEQ                            SEQUENCE
DEPARTMENTS                              TABLE
DEPARTMENTS_SEQ                          SEQUENCE
JOBS                                     TABLE
EMPLOYEES                                TABLE
EMPLOYEES_SEQ                            SEQUENCE
JOB_HISTORY                              TABLE
EMP_DETAILS_VIEW                         VIEW
T                                        TABLE
EMPLEADOS                                TABLE

13 rows selected.

SQL> drop table empleados;
Table dropped.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@server01db ~]$ rman target / catalog rman/rman@repo
Recovery Manager: Release 12.2.0.1.0 - Production on Thu Apr 20 15:28:41 2017

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

connected to target database: CDB1 (DBID=912848444)
connected to recovery catalog database

RMAN> set encryption on identified by "cloud01" only;

executing command: SET encryption
starting full resync of recovery catalog
full resync complete

RMAN> backup archivelog all;

Starting backup at 20-APR-17
current log archived
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=15 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=34 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_3
channel ORA_SBT_TAPE_3: SID=16 device type=SBT_TAPE
channel ORA_SBT_TAPE_3: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_4: SID=272 device type=SBT_TAPE
channel ORA_SBT_TAPE_4: Oracle Database Backup Service Library VER=3.17.3.23
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=30 RECID=24 STAMP=941728850
input archived log thread=1 sequence=31 RECID=25 STAMP=941729734
input archived log thread=1 sequence=32 RECID=26 STAMP=941800544
channel ORA_SBT_TAPE_1: starting piece 1 at 20-APR-17
channel ORA_SBT_TAPE_2: starting compressed archived log backup set
channel ORA_SBT_TAPE_2: specifying archived log(s) in backup set
input archived log thread=1 sequence=24 RECID=20 STAMP=941716302
input archived log thread=1 sequence=25 RECID=18 STAMP=941712301
input archived log thread=1 sequence=26 RECID=19 STAMP=941713575
channel ORA_SBT_TAPE_2: starting piece 1 at 20-APR-17
channel ORA_SBT_TAPE_3: starting compressed archived log backup set
channel ORA_SBT_TAPE_3: specifying archived log(s) in backup set
input archived log thread=1 sequence=27 RECID=21 STAMP=941719589
input archived log thread=1 sequence=28 RECID=22 STAMP=941719892
input archived log thread=1 sequence=29 RECID=23 STAMP=941720146
channel ORA_SBT_TAPE_3: starting piece 1 at 20-APR-17
channel ORA_SBT_TAPE_4: starting compressed archived log backup set
channel ORA_SBT_TAPE_4: specifying archived log(s) in backup set
input archived log thread=1 sequence=33 RECID=27 STAMP=941801398
input archived log thread=1 sequence=34 RECID=28 STAMP=941815749
channel ORA_SBT_TAPE_4: starting piece 1 at 20-APR-17
channel ORA_SBT_TAPE_4: finished piece 1 at 20-APR-17
piece handle=3vs25tul_1_1 tag=TAG20170420T152925 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:00:35
channel ORA_SBT_TAPE_2: finished piece 1 at 20-APR-17
piece handle=3ts25tul_1_1 tag=TAG20170420T152925 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:56
channel ORA_SBT_TAPE_3: finished piece 1 at 20-APR-17
piece handle=3us25tul_1_1 tag=TAG20170420T152925 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_3: backup set complete, elapsed time: 00:01:26
channel ORA_SBT_TAPE_1: finished piece 1 at 20-APR-17
piece handle=3ss25tul_1_1 tag=TAG20170420T152925 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:01:36
Finished backup at 20-APR-17

Starting Control File and SPFILE Autobackup at 20-APR-17
piece handle=c-912848444-20170420-01 comment=API Version 2.0,MMS Version 3.17.3.23
Finished Control File and SPFILE Autobackup at 20-APR-17

[oracle@server01db ~]$ rman target / catalog rman/rman@repo

Recovery Manager: Release 12.2.0.1.0 - Production on Thu Apr 20 15:49:41 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

connected to target database: CDB1 (DBID=912848444)
connected to recovery catalog database

RMAN> set decryption identified by "cloud01";

executing command: SET decryption

RMAN> resync catalog;


starting full resync of recovery catalog
full resync complete

RMAN> set decryption identified by "cloud01";

executing command: SET decryption

RMAN> run {
ALTER PLUGGABLE DATABASE PDB1 CLOSE;
SET UNTIL TIME "TO_DATE('20-apr-2017 14:51:55','DD-MON-YYYY HH24:MI:SS')";
RESTORE PLUGGABLE DATABASE PDB1;
RECOVER PLUGGABLE DATABASE PDB1 auxiliary destination '/opt/app/tmp';
ALTER PLUGGABLE DATABASE PDB1 OPEN RESETLOGS;
}

executing command: SET until clause

Starting restore at 20-APR-17
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=237 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=31 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_3
channel ORA_SBT_TAPE_3: SID=272 device type=SBT_TAPE
channel ORA_SBT_TAPE_3: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_4: SID=26 device type=SBT_TAPE
channel ORA_SBT_TAPE_4: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=34 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=276 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=15 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=271 device type=DISK

skipping datafile 14; already restored to file 
/opt/app/oracle/oradata/cdb1/pdb1/system01.dbf
skipping datafile 15; already restored to file 
/opt/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
skipping datafile 16; already restored to file 
/opt/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf
skipping datafile 17; already restored to file 
/opt/app/oracle/oradata/cdb1/pdb1/tbs_data_admin.dbf
Finished restore at 20-APR-17

Starting recover at 20-APR-17
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 20-APR-17
starting full resync of recovery catalog
full resync complete

Statement processed
starting full resync of recovery catalog
full resync complete

RMAN> exit


Recovery Manager complete.
[oracle@server01db ~]$ sqlplus hr/hr@pdb1

SQL*Plus: Release 12.2.0.1.0 Production on Thu Apr 20 16:01:09 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Last Successful login time: Thu Apr 20 2017 14:45:49 -06:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select count(*) from empleados;

  COUNT(*)
----------
       107




RECUPERACIÓN DE UNA DATAFILE PERDIDO


login as: root
root@192.168.1.78's password:
Last login: Thu Apr 20 10:09:10 2017 from 192.168.1.6
s[root@server01db ~]# su - oracle
[oracle@server01db ~]$ ./subir_all
The Oracle base has been set to /opt/app/oracle
TFA Version : 12.2.1.0.0

.-------------------------------------------------------------------------------------------.
| Host       | Status of TFA | PID  | Port  | Version    | Build ID             | Inventory |
|            |               |      |       |            |                      |    Status |
+------------+---------------+------+-------+------------+----------------------+-----------+
| server01db | RUNNING       | 1596 | 55972 | 12.2.1.0.0 | 12210020161122170355 | COMPLETE  |
'------------+---------------+------+-------+------------+----------------------+-----------'

TFA Process is running.

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 21-APR-2017 10:41:01
Copyright (c) 1991, 2016, Oracle.  All rights reserved.
Starting /opt/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /opt/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /opt/app/oracle/diag/tnslsnr/server01db/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server01db)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server01db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-APR-2017 10:41:01
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/app/oracle/diag/tnslsnr/server01db/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server01db)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
Subiendo REPO

SQL*Plus: Release 12.2.0.1.0 Production on Fri Apr 21 10:41:03 2017

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

SQL> Connected to an idle instance.
SQL> ORACLE instance started.

Total System Global Area  645922816 bytes
Fixed Size                  8624024 bytes
Variable Size             306186344 bytes
Database Buffers          322961408 bytes
Redo Buffers                8151040 bytes
Database mounted.
Database opened.
SQL> alter pluggable database all open
*
ERROR at line 1:
ORA-65090: operation only allowed in a container database

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 
64bit Production
The Oracle base remains unchanged with value /opt/app/oracle
Subiendo CONTAINER

SQL*Plus: Release 12.2.0.1.0 Production on Fri Apr 21 10:41:37 2017

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

SQL> Connected to an idle instance.
SQL> ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size                  8801008 bytes
Variable Size             503317776 bytes
Database Buffers          553648128 bytes
Redo Buffers                7974912 bytes
Database mounted.
Database opened.
SQL>
Pluggable database altered.

SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 
64bit Production
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 21-APR-2017 10:42:41
Copyright (c) 1991, 2016, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server01db)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                21-APR-2017 10:41:01
Uptime                    0 days 0 hr. 1 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/app/oracle/diag/tnslsnr/server01db/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server01db)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=server01db)(PORT=5500))(Security=
(my_wallet_directory=/opt/app/oracle/admin/cdb1/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "4d8c7b144e1f3704e0530a02000a0c73" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb1" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb1XDB" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "pdb1" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "repo" has 1 instance(s).
  Instance "repo", status READY, has 1 handler(s) for this service...
Service "repoXDB" has 1 instance(s).
  Instance "repo", status READY, has 1 handler(s) for this service...
The command completed successfully
TFA Version : 12.2.1.0.0


.-------------------------------------------------------------------------------------------.
| Host       | Status of TFA | PID  | Port  | Version    | Build ID             | Inventory |
|            |               |      |       |            |                      |    Status |
+------------+---------------+------+-------+------------+----------------------+-----------+
| server01db | RUNNING       | 1596 | 55972 | 12.2.1.0.0 | 12210020161122170355 | COMPLETE  |
'------------+---------------+------+-------+------------+----------------------+-----------'

[oracle@server01db ~]$ . oraenv
ORACLE_SID = [oracle] ? cdb1
The Oracle base has been set to /opt/app/oracle
[oracle@server01db ~]$ rman target / catalog rman/rman@repo

Recovery Manager: Release 12.2.0.1.0 - Production on Fri Apr 21 10:52:15 2017

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
connected to target database: CDB1 (DBID=912848444)
connected to recovery catalog database

RMAN> set encryption on identified by "cloud01" only;

executing command: SET encryption
starting full resync of recovery catalog
full resync complete

RMAN> backup archivelog all;

Starting backup at 21-APR-17
current log archived
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=265 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=25 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_3
channel ORA_SBT_TAPE_3: SID=279 device type=SBT_TAPE
channel ORA_SBT_TAPE_3: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_4: SID=33 device type=SBT_TAPE
channel ORA_SBT_TAPE_4: Oracle Database Backup Service Library VER=3.17.3.23
channel ORA_SBT_TAPE_1: starting compressed archived log backup set
channel ORA_SBT_TAPE_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=39 RECID=33 STAMP=941885613
channel ORA_SBT_TAPE_1: starting piece 1 at 21-APR-17
channel ORA_SBT_TAPE_1: finished piece 1 at 21-APR-17
piece handle=4ks2825p_1_1 tag=TAG20170421T105345 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:00:45
Finished backup at 21-APR-17

Starting Control File and SPFILE Autobackup at 21-APR-17
piece handle=c-912848444-20170421-00 comment=API Version 2.0,MMS Version 3.17.3.23
Finished Control File and SPFILE Autobackup at 21-APR-17

RMAN> backup pluggable database pdb1;

Starting backup at 21-APR-17
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_1: starting compressed full datafile backup set
channel ORA_SBT_TAPE_1: specifying datafile(s) in backup set
input datafile file number=00015 name=/opt/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
channel ORA_SBT_TAPE_1: starting piece 1 at 21-APR-17
channel ORA_SBT_TAPE_2: starting compressed full datafile backup set
channel ORA_SBT_TAPE_2: specifying datafile(s) in backup set
input datafile file number=00014 name=/opt/app/oracle/oradata/cdb1/pdb1/system01.dbf
channel ORA_SBT_TAPE_2: starting piece 1 at 21-APR-17
channel ORA_SBT_TAPE_3: starting compressed full datafile backup set
channel ORA_SBT_TAPE_3: specifying datafile(s) in backup set
input datafile file number=00017 name=/opt/app/oracle/oradata/cdb1/pdb1/tbs_data_admin.dbf
channel ORA_SBT_TAPE_3: starting piece 1 at 21-APR-17
channel ORA_SBT_TAPE_4: starting compressed full datafile backup set
channel ORA_SBT_TAPE_4: specifying datafile(s) in backup set
input datafile file number=00016 name=/opt/app/oracle/oradata/cdb1/pdb1/undotbs01.dbf
channel ORA_SBT_TAPE_4: starting piece 1 at 21-APR-17
channel ORA_SBT_TAPE_3: finished piece 1 at 21-APR-17
piece handle=4os284rp_1_1 tag=TAG20170421T113936 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_3: backup set complete, elapsed time: 00:00:25
channel ORA_SBT_TAPE_4: finished piece 1 at 21-APR-17
piece handle=4ps284rp_1_1 tag=TAG20170421T113936 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_4: backup set complete, elapsed time: 00:00:25
channel ORA_SBT_TAPE_2: finished piece 1 at 21-APR-17
piece handle=4ns284rp_1_1 tag=TAG20170421T113936 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:01:06
channel ORA_SBT_TAPE_1: finished piece 1 at 21-APR-17
piece handle=4ms284rp_1_1 tag=TAG20170421T113936 comment=API Version 2.0,MMS Version 3.17.3.23
channel ORA_SBT_TAPE_1: backup set complete, elapsed time: 00:08:06
Finished backup at 21-APR-17

Starting Control File and SPFILE Autobackup at 21-APR-17
piece handle=c-912848444-20170421-01 comment=API Version 2.0,MMS Version 3.17.3.23
Finished Control File and SPFILE Autobackup at 21-APR-17

RMAN> exit

Recovery Manager complete.
[oracle@server01db ~]$ sqlplus system@pdb1/oracle
SQL*Plus: Release 12.2.0.1.0 Production on Fri Apr 21 11:48:50 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Last Successful login time: Wed Apr 19 2017 12:39:03 -06:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> connect hr/hr@pdb1
Connected.

SQL> desc user_tables
 Name                                           Null?    Type
 ---------------------------------------------- -------- ----------------
 TABLE_NAME                                     NOT NULL VARCHAR2(128)
 TABLESPACE_NAME                                         VARCHAR2(30)
 CLUSTER_NAME                                            VARCHAR2(128)
 IOT_NAME                                                VARCHAR2(128)
 STATUS                                                  VARCHAR2(8)
 PCT_FREE                                                NUMBER
….

SQL> select table_name, tablespace_name from user_tables;

TABLE_NAME                               TABLESPACE_NAME
---------------------------------------- ------------------------------
REGIONS                                  TBS_DATA_ADMIN
COUNTRIES
LOCATIONS                                TBS_DATA_ADMIN
DEPARTMENTS                              TBS_DATA_ADMIN
JOBS                                     TBS_DATA_ADMIN
EMPLOYEES                                TBS_DATA_ADMIN
JOB_HISTORY                              TBS_DATA_ADMIN
T                                        TBS_DATA_ADMIN
EMPLEADOS                                TBS_DATA_ADMIN
CONSECUTIVOS                             TBS_DATA_ADMIN

10 rows selected.

SQL> connect / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host
cd [oracle@server01db ~]$ cd /opt/app/oracle/oradata/cdb1/pdb1
[oracle@server01db pdb1]$ ls -la
total 994380
drwxr-xr-x. 2 oracle oinstall      4096 Apr 19 15:14 .
drwxr-x---. 4 oracle oinstall      4096 Apr 19 15:10 ..
-rw-r-----. 1 oracle oinstall 377495552 Apr 21 11:50 sysaux01.dbf
-rw-r-----. 1 oracle oinstall 272637952 Apr 21 11:50 system01.dbf
-rw-r-----. 1 oracle oinstall 262152192 Apr 21 11:50 tbs_data_admin.dbf
-rw-r-----. 1 oracle oinstall  67117056 Apr 20 17:04 temp012017-03-20_13-44-33-742-PM.dbf
-rw-r-----. 1 oracle oinstall 104865792 Apr 21 11:50 undotbs01.dbf
[oracle@server01db pdb1]$ mv tbs_data_admin.dbf tbs_data_admin.dbfold
[oracle@server01db pdb1]$ exit
exit

SQL> startup
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size                  8801008 bytes
Variable Size             503317776 bytes
Database Buffers          553648128 bytes
Redo Buffers                7974912 bytes
Database mounted.
Database opened.
SQL> alter pluggable database pdb1 open;
alter pluggable database pdb1 open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 17 - see DBWR trace file
ORA-01110: data file 17: '/opt/app/oracle/oradata/cdb1/pdb1/tbs_data_admin.dbf'


SQL> alter database datafile 17 offline;
alter database datafile 17 offline
*
ERROR at line 1:
ORA-01516: nonexistent log file, data file, or temporary file "17" in the current container

SQL> alter pluggable database pdb1 datafile 17 offline;
alter pluggable database pdb1 datafile 17 offline
*
ERROR at line 1:
ORA-65046: operation not allowed from outside a pluggable database

SQL> connect sys@pdb1/oracle
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0
Warning: You are no longer connected to ORACLE.

SQL> select name, open_mode from v$pdbs;
SP2-0640: Not connected



SQL> connect / as sysdba
Connected.
SQL> select name, open_mode from v$pdbs;

NAME                                     OPEN_MODE
---------------------------------------- ----------
PDB$SEED                                 READ ONLY
PDB1                                     MOUNTED

SQL> connect system@pdb1
Enter password:
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0

SQL> connect / as sysdba
Connected.
SQL> alter session set container=pdb1;
Session altered.

SQL> alter database datafile 17 offline;
Database altered.

SQL> alter pluggable database pdb1 open;
Pluggable database altered.

SQL> connect hr/hr@pdb1
Connected.
SQL> select count(*) from employees;
select count(*) from employees
                     *
ERROR at line 1:
ORA-00376: file 17 cannot be read at this time
ORA-01110: data file 17: '/opt/app/oracle/oradata/cdb1/pdb1/tbs_data_admin.dbf'

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 
64bit Production



[oracle@server01db ~]$ rman target / catalog rman/rman@repo
Recovery Manager: Release 12.2.0.1.0 - Production on Fri Apr 21 11:57:56 2017
Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
connected to target database: CDB1 (DBID=912848444)
connected to recovery catalog database
RMAN> list backup of datafile 17;

starting full resync of recovery catalog
full resync complete
RMAN-06169: could not read file header for datafile 17 error reason 4

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6933    Full    512.00K    SBT_TAPE    00:00:06     19-APR-17
        BP Key: 6945   Status: AVAILABLE  Compressed: YES  Tag: TAG20170419T152131
        Handle: 2rs239cg_1_1   Media: novacloudoracle.storage.oraclecloud.com/v1/
                                      Storage-novacloudorac
  List of Datafiles in backup set 6933
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  17      Full 1960023    19-APR-17              NO    /opt/app/oracle/oradata/cdb1
                                                       /pdb1/tbs_data_admin.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6996    Incr 0  512.00K    SBT_TAPE    00:00:06     19-APR-17
        BP Key: 7009   Status: AVAILABLE  Compressed: YES  Tag: TAG20170419T153908
        Handle: 38s23aee_1_1   Media: novacloudoracle.storage.oraclecloud.com/v1/
                                      Storage-novacloudorac
  List of Datafiles in backup set 6996
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  17   0  Incr 1961038    19-APR-17              NO    /opt/app/oracle/oradata/cdb1/
                                                       pdb1/tbs_data_admin.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7069    Full    512.00K    SBT_TAPE    00:00:06     19-APR-17
        BP Key: 7075   Status: AVAILABLE  Compressed: YES  Tag: TAG20170419T165826
        Handle: 3gs23epi_1_1   Media: novacloudoracle.storage.oraclecloud.com/v1/
                                      Storage-novacloudorac
  List of Datafiles in backup set 7069
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  17      Full 1989846    19-APR-17              NO    /opt/app/oracle/oradata/cdb1/
                                                       pdb1/tbs_data_admin.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7415    Full    512.00K    SBT_TAPE    00:00:04     20-APR-17
        BP Key: 7422   Status: AVAILABLE  Compressed: YES  Tag: TAG20170420T111658
        Handle: 3os25f5e_1_1   Media: novacloudoracle.storage.oraclecloud.com/v1/
                                      Storage-novacloudorac
  List of Datafiles in backup set 7415
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  17      Full 1997531    19-APR-17              NO    /opt/app/oracle/oradata/cdb1/
                                                       pdb1/tbs_data_admin.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8567    Full    512.00K    SBT_TAPE    00:00:06     20-APR-17
        BP Key: 8582   Status: AVAILABLE  Compressed: YES  Tag: TAG20170420T161052
        Handle: 4ds260mc_1_1   Media: novacloudoracle.storage.oraclecloud.com/v1/
                                      Storage-novacloudorac
  List of Datafiles in backup set 8567
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  17      Full 2031292    20-APR-17              NO    /opt/app/oracle/oradata/cdb1/
                                                       pdb1/tbs_data_admin.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8675    Full    512.00K    SBT_TAPE    00:00:14     21-APR-17
        BP Key: 8681   Status: AVAILABLE  Compressed: YES  Tag: TAG20170421T113936
        Handle: 4os284rp_1_1   Media: novacloudoracle.storage.oraclecloud.com/v1/
                                      Storage-novacloudorac
  List of Datafiles in backup set 8675
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  17      Full 2043097    21-APR-17              NO    /opt/app/oracle/oradata/cdb1/
                                                       pdb1/tbs_data_admin.dbf

RMAN> set decryption identified by "cloud01";

executing command: SET decryption

RMAN> restore datafile 17;

Starting restore at 21-APR-17
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=271 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=35 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_3
channel ORA_SBT_TAPE_3: SID=263 device type=SBT_TAPE
channel ORA_SBT_TAPE_3: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_SBT_TAPE_4
channel ORA_SBT_TAPE_4: SID=32 device type=SBT_TAPE
channel ORA_SBT_TAPE_4: Oracle Database Backup Service Library VER=3.17.3.23
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=266 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=33 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=267 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=36 device type=DISK

channel ORA_SBT_TAPE_1: starting datafile backup set restore
channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
channel ORA_SBT_TAPE_1: restoring datafile 00017 to /opt/app/oracle/oradata/cdb1/
pdb1/tbs_data_admin.dbf
channel ORA_SBT_TAPE_1: reading from backup piece 4os284rp_1_1
channel ORA_SBT_TAPE_1: piece handle=4os284rp_1_1 tag=TAG20170421T113936
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:15
Finished restore at 21-APR-17

RMAN> recover datafile 17;

Starting recover at 21-APR-17
using channel ORA_SBT_TAPE_1
using channel ORA_SBT_TAPE_2
using channel ORA_SBT_TAPE_3
using channel ORA_SBT_TAPE_4
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4

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

Finished recover at 21-APR-17

RMAN> alter database datafile 17 online;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of sql statement command at 04/21/2017 11:59:51
ORA-01516: nonexistent log file, data file, or temporary file "17" in the current container

RMAN> exit


Recovery Manager complete.
[oracle@server01db ~]$ sqlplus system@pdb1

SQL*Plus: Release 12.2.0.1.0 Production on Fri Apr 21 12:00:11 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Enter password:
Last Successful login time: Fri Apr 21 2017 11:48:51 -06:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> alter database datafile 17 online;
Database altered.

SQL> connect hr/hr@pdb1
Connected.
SQL> select * from countries;
CO COUNTRY_NAME                              REGION_ID
-- ---------------------------------------- ----------
AR Argentina                                         2
AU Australia                                         3
BE Belgium                                           1
,,,

25 rows selected.

SQL>




Ronald Vargas Quesada: Consultor, Profesor Universitario, Oracle Academy Instructor y Orador. Ronald tiene más de 25 años de experiencia en Oracle DBA. Él reside en Costa Rica y es responsable de la creación de las Centroamericano Oracle Grupos de usuarios. Es un participante activo en OracleMania, Comunidad Oracle Hispana y LAOUC y disfruta ayudando a sus compañeros para encontrar soluciones y respuestas en Oracle Technology. También el director de tecnología para la LAOUC. Fue instructor de la Universidad Oracle desde 2000-2007 y reconocido como uno de los 15 mejores instructores LAD por Oracle University. Se esfuerza por mantener su blog actualizado regularmente y disfruta de compartir sus pensamientos con la comunidad

Este artículo ha sido revisado por el equipo de productos Oracle y se encuentra en cumplimiento de las normas y prácticas para el uso de los productos Oracle.