DBA Hub

📋Steps in this guide1/13

Multitenant : Backup and Recovery of a Container Database (CDB) and a Pluggable Database (PDB) in Oracle Database 12c Release 1 (12.1)

Learn how backup and recovery is affected by the multitenant option in Oracle Database 12c Release 1 (12.1).

oracle 12cconfigurationintermediate
by OracleDba
13 views
1

RMAN Connections

Unless stated otherwise, this article assumes connections to RMAN are using OS authentication. This means you are connecting to the root container in the CDB with "AS SYSDBA" privilege. When connecting to a PDB to perform backup and recovery operations, the RMAN connection will look like the following. Notice the password prompt as no password was entered on the command line.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ export ORAENV_ASK=NO
$ export ORACLE_SID=cdb1
$ . oraenv
The Oracle base remains unchanged with value /u01/app/oracle
$ export ORAENV_ASK=YES

$ rman target=/
Recovery Manager: Release 12.1.0.1.0 - Production on Sun Dec 22 17:03:20 2013

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

connected to target database: CDB1 (DBID=797615285)

RMAN>

$ rman target=sys@pdb1
Recovery Manager: Release 12.1.0.1.0 - Production on Mon Dec 23 11:08:35 2013

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

target database Password: 
connected to target database: CDB1 (DBID=797615285)

RMAN>
2

Container Database (CDB) Backup

Backup of a Container Database (CDB) is essentially the same as a non-Container Database. The main thing to remember is, by doing a full backup of the CDB you are also doing a full backup of all PDBs. Connect to RMAN using OS authentication and take a full backup using the following command. This means you are connecting to the root container with "AS SYSDBA" privilege. A section of the output from the above backup command is shown below. Notice how the datafiles associated with the CBD (cdb1) and all the PDBs (pdb1, pdb2, pdb$seed) are included in the backup.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$ rman target=/

RMAN> BACKUP DATABASE PLUS ARCHIVELOG;

Starting backup at 22-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/cdb1/sysaux01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/cdb1/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/cdb1/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/cdb1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 22-DEC-13
channel ORA_DISK_1: finished piece 1 at 22-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg4wr40_.bkp tag=TAG20131222T163015 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
input datafile file number=00010 name=/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf
channel ORA_DISK_1: starting piece 1 at 22-DEC-13
channel ORA_DISK_1: finished piece 1 at 22-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E45393F0DE5F1A8AE043D200A8C00DFC/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg4z3so_.bkp tag=TAG20131222T163015 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00030 name=/u01/app/oracle/oradata/pdb2/sysaux01.dbf
input datafile file number=00029 name=/u01/app/oracle/oradata/pdb2/system01.dbf
input datafile file number=00031 name=/u01/app/oracle/oradata/pdb2/pdb2_users01.dbf
channel ORA_DISK_1: starting piece 1 at 22-DEC-13
channel ORA_DISK_1: finished piece 1 at 22-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E4B0CA84B47E6183E043D200A8C0A806/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg50766_.bkp tag=TAG20131222T163015 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf
channel ORA_DISK_1: starting piece 1 at 22-DEC-13
channel ORA_DISK_1: finished piece 1 at 22-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E453004B82C71772E043D200A8C08EC5/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg51bmg_.bkp tag=TAG20131222T163015 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36
Finished backup at 22-DEC-13
3

Root Container Backup

A backup of the root container is a backup of the CDB, excluding any of the PDBs. Connect to RMAN using OS authentication and backup the root container using the following command. This means you are connecting to the root container with "AS SYSDBA" privilege. A section of the output from the above backup command is shown below. Notice how the datafiles associated with the CBD (cdb1) are included, but all the PDBs (pdb1, pdb2, pdb$seed) are not included in the backup.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ rman target=/

RMAN> BACKUP DATABASE ROOT;

Starting backup at 23-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/cdb1/sysaux01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/cdb1/system01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/cdb1/undotbs01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/cdb1/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-13
channel ORA_DISK_1: finished piece 1 at 23-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2013_12_23/o1_mf_nnndf_TAG20131223T112413_9cj7bxtg_.bkp tag=TAG20131223T112413 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25
Finished backup at 23-DEC-13
4

Pluggable Database (PDB) Backup

There are two ways to back up pluggable databases. When connected to RMAN as the root container, you can backup one or more PDBs using the following command. You can see this includes the datafiles for both referenced PDBs. Alternatively, connect to a specific PDB and issue the following command. Being connected to the PDB, this limits the scope of the backup command to the current PDB only, as shown in the output below.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$ rman target=/

RMAN> BACKUP PLUGGABLE DATABASE pdb1, pdb2;

Starting backup at 23-DEC-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
input datafile file number=00010 name=/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-13
channel ORA_DISK_1: finished piece 1 at 23-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E45393F0DE5F1A8AE043D200A8C00DFC/backupset/2013_12_23/o1_mf_nnndf_TAG20131223T113119_9cj7r8lp_.bkp tag=TAG20131223T113119 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00030 name=/u01/app/oracle/oradata/pdb2/sysaux01.dbf
input datafile file number=00029 name=/u01/app/oracle/oradata/pdb2/system01.dbf
input datafile file number=00031 name=/u01/app/oracle/oradata/pdb2/pdb2_users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-13
channel ORA_DISK_1: finished piece 1 at 23-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E4B0CA84B47E6183E043D200A8C0A806/backupset/2013_12_23/o1_mf_nnndf_TAG20131223T113119_9cj7sfbx_.bkp tag=TAG20131223T113119 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
Finished backup at 23-DEC-13

$ rman target=sys@pdb1

RMAN> BACKUP DATABASE;

Starting backup at 23-DEC-13
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=237 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
input datafile file number=00008 name=/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
input datafile file number=00010 name=/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-DEC-13
channel ORA_DISK_1: finished piece 1 at 23-DEC-13
piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E45393F0DE5F1A8AE043D200A8C00DFC/backupset/2013_12_23/o1_mf_nnndf_TAG20131223T113504_9cj7z9kb_.bkp tag=TAG20131223T113504 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 23-DEC-13
5

Tablespace and Datafile Backups

Multiple PDBs in the same CDB can have a tablespace with the same name, for example SYSTEM, SYSAUX and USERS. One way to remove that ambiguity is connect to the appropriate PDB. Once RMAN is connected to the PDB, the tablespace backup commands is unchanged compared to previous versions. Alternatively, you can remove the ambiguity by qualifying the PDB name with the tablespace name when connected to the root container. Datafiles have unique file numbers and fully qualified names, so they can be backed up from the root container or the individual PDB. If you are connecting to a PDB, only the files belonging to that PDB can be backed up. So for example, when connected as PDB1, we get an error if we try to backup the SYSTEM datafile from the root container.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$ rman target=sys@pdb1

RMAN> BACKUP TABLESPACE system, sysaux, users;

$ rman target=sys@cdb1

RMAN> BACKUP TABLESPACE pdb1:system, pdb1:sysaux, pdb1:users, pdb2:system;

$ rman target=/

# Or

$ rman target=sys@pdb1

RMAN> BACKUP DATAFILE 8, 9, 10;

RMAN> BACKUP DATAFILE 1;

Starting backup at 23-DEC-13
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 12/23/2013 11:49:35
RMAN-20201: datafile not found in the recovery catalog
RMAN-06010: error while looking up datafile: 1

RMAN>
6

Archived Redo Log Backups

Redo is managed at the root container level. There is no concept of redo from the PDB perspective, but of course any changes in tablespaces owned by the root container or a user-defined PDB are protected by redo in the normal manner. As a result, you will never perform a PDB-level archived redo log backup, because there are no PDB-specific redo logs. Instead, you will do your archived redo log backups in the normal way from the root container. They can be done along with the database backups or as a separate operation, as shown below.

Code/Command (click line numbers to comment):

1
2
3
4
5
$ rman target=/

RMAN> BACKUP DATABASE PLUS ARCHIVELOG;

RMAN> BACKUP ARCHIVELOG ALL;
7

Container Database (CDB) Complete Recovery

Restoring a CDB is similar to restoring a non-CDB database, but remember restoring a whole CDB will restore not only the root container, but all the PDBs also. Likewise a Point In Time Recovery (PITR) of the whole CDB will bring all PDBs back to the same point in time. Connect to RMAN using OS authentication and restore the whole CDB using the following restore script. This means you are connecting to the root container with "AS SYSDBA" privilege. A section of the output from the above restore script is shown below. Notice the datafiles from the CDB (cdb1) and all the PDBs (pdb1, pdb2 and pdb$seed) are all considered during the restore. The seed PDB is not actually restored because it is read-only and RMAN can see a restore is not necessary.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$ rman target=/

RUN {
  SHUTDOWN IMMEDIATE; # use abort if this fails
  STARTUP MOUNT;
  RESTORE DATABASE;
  RECOVER DATABASE;
  ALTER DATABASE OPEN;
}

Starting restore at 22-DEC-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=11 device type=DISK
skipping datafile 5; already restored to file /u01/app/oracle/oradata/cdb1/pdbseed/system01.dbf
skipping datafile 7; already restored to file /u01/app/oracle/oradata/cdb1/pdbseed/sysaux01.dbf
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/cdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/cdb1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/cdb1/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/cdb1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/CDB1/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg4wr40_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg4wr40_.bkp tag=TAG20131222T163015
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00009 to /u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00010 to /u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/CDB1/E45393F0DE5F1A8AE043D200A8C00DFC/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg4z3so_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E45393F0DE5F1A8AE043D200A8C00DFC/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg4z3so_.bkp tag=TAG20131222T163015
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00029 to /u01/app/oracle/oradata/pdb2/system01.dbf
channel ORA_DISK_1: restoring datafile 00030 to /u01/app/oracle/oradata/pdb2/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00031 to /u01/app/oracle/oradata/pdb2/pdb2_users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/CDB1/E4B0CA84B47E6183E043D200A8C0A806/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg50766_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/CDB1/E4B0CA84B47E6183E043D200A8C0A806/backupset/2013_12_22/o1_mf_nnndf_TAG20131222T163015_9cg50766_.bkp tag=TAG20131222T163015
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 22-DEC-13

Starting recover at 22-DEC-13
using channel ORA_DISK_1

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

Finished recover at 22-DEC-13

Statement processed
8

Root Container Complete Recovery

Rather than recovering the whole CDB, including all PDBs, the root container can be recovered in isolation. Connect to RMAN using OS authentication and restore the root container using the following restore script. This means you are connecting to the root container with "AS SYSDBA" privilege. The following section of the output from the restore script shows only the root container datafiles are restored and recovered. It is probably a very bad idea to restore and recover just the root container without doing the same for the PDBs. Any difference in metadata between the two could prove problematic.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$ rman target=/

RUN {
  SHUTDOWN IMMEDIATE; # use abort if this fails
  STARTUP MOUNT;
  RESTORE DATABASE ROOT;
  RECOVER DATABASE ROOT;
  # Consider recovering PDBs before opening.
  ALTER DATABASE OPEN;
}

Starting restore at 23-DEC-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=247 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/cdb1/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/cdb1/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/cdb1/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/cdb1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/CDB1/backupset/2013_12_23/o1_mf_nnndf_TAG20131223T112413_9cj7bxtg_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/CDB1/backupset/2013_12_23/o1_mf_nnndf_TAG20131223T112413_9cj7bxtg_.bkp tag=TAG20131223T112413
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:26
Finished restore at 23-DEC-13

Starting recover at 23-DEC-13
using channel ORA_DISK_1

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

Finished recover at 23-DEC-13
9

Pluggable Database (PDB) Complete Recovery

There are two ways to restore and recover PDBs. From to root containers, you can restore and recover one or more PDBs using the following script. When connected directly to a PDB, you can restore and recover the current PDB using a local user with the SYSDBA privilege, as shown in the following script. In the current release, the RMAN commands will not work in a "run" script without producing errors.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ rman target=/

RUN {
  ALTER PLUGGABLE DATABASE pdb1, pdb2 CLOSE;
  RESTORE PLUGGABLE DATABASE pdb1, pdb2;
  RECOVER PLUGGABLE DATABASE pdb1, pdb2;
  ALTER PLUGGABLE DATABASE pdb1, pdb2 OPEN;
}

$ sqlplus sys@pdb1 as sysdba

CREATE USER admin_user IDENTIFIED BY admin_user;
GRANT CREATE SESSION, PDB_DBA, SYSDBA TO admin_user;
EXIT;

$ rman target=admin_user@pdb1

SHUTDOWN IMMEDIATE;
RESTORE DATABASE;
RECOVER DATABASE;
STARTUP;
10

Tablespace and Datafile Complete Recovery

Due to potential name clashes, restoring a tablespace must be done while connected to the PDB. Datafile recoveries can be done while connected to the container or directly to the PDB.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ rman target=sys@pdb1

RUN {
  ALTER TABLESPACE users OFFLINE;
  RESTORE TABLESPACE users;
  RECOVER TABLESPACE users;
  ALTER TABLESPACE users ONLINE;
}

$ rman target=/

# Or

$ rman target=sys@pdb1

RUN {
  ALTER DATABASE DATAFILE 10 OFFLINE;
  RESTORE DATAFILE 10;
  RECOVER DATAFILE 10;
  ALTER DATABASE DATAFILE 10 ONLINE;
}
11

Container Database (CDB) Point In Time Recovery (PITR)

Point In Time Recovery (PITR) of a CDB is the same as that of non-CDB instances. Just remember, you are performing a PITR on the CDB and all the PDBs at once.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
$ rman target=/

RUN {
  SHUTDOWN IMMEDIATE; # use abort if this fails
  STARTUP MOUNT;
  SET UNTIL TIME "TO_DATE('23-DEC-2013 12:00:00','DD-MON-YYYY HH24:MI:SS')";
  RESTORE DATABASE;
  RECOVER DATABASE;
  # Should probably open read-only and check it out first.
  ALTER DATABASE OPEN RESETLOGS;
}
12

Pluggable Database (PDB) Point In Time Recovery (PITR)

Point In Time Recovery (PITR) of a PDB follows a similar pattern to that of a regular database. The PDB is closed, restored and recovered to the required point in time, then opened with the option. In this case, the option does nothing with the logfiles themselves, but creates a new PDB incarnation. The simplicity of PITR of PDBs hides a certain amount of complexity. For a start, a PDB shares the root container with other PDBs, so a PITR of the root container must be performed. This is done in the fast recovery area (FRA) provided it is configured. If the FRA is not configured, an must be specified. Aside from the FRA space requirement, one other important restriction is relevant. If a point in time recovery of a PDB has been done, it is not possible to directly flashback the database to a time before the PDB point in time recovery. The workaround for this is discussed in this article .

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
$ rman target=/

RUN {
  ALTER PLUGGABLE DATABASE pdb1 CLOSE;
  SET UNTIL TIME "TO_DATE('23-DEC-2013 12:00:00','DD-MON-YYYY HH24:MI:SS')";
  RESTORE PLUGGABLE DATABASE pdb1;
  RECOVER PLUGGABLE DATABASE pdb1;
  ALTER PLUGGABLE DATABASE pdb1 OPEN RESETLOGS;
}
13

Table Point In Time Recovery (PITR) in PDBs

Oracle 12c includes a new RMAN feature which performs point in time recovery of tables using a single command. You can read about this feature and see examples of it's use in the following article. The same mechanism is available for recovering tables in PDBs, with a few minor changes. For the feature to work with a PDB, you must log in as a root user with SYSDBA or SYSBACKUP privilege. Issue the command in a similar way to that shown for a non-CDB database, but include the clause, as well as giving a suitable location for the auxiliary database. The following command also uses the clause to give the recovered table a new name. Alternatively, you can just stop at the point where the recovered table is in a data pump dump file, which you can import manually at a later time. The following example uses the , and clauses to achieve this. For more information see: Hope this helps. Regards Tim...

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ rman target=/

# SCN
RECOVER TABLE 'TEST'.'T1' OF PLUGGABLE DATABASE pdb1
  UNTIL SCN 5695703
  AUXILIARY DESTINATION '/u01/aux'  
  REMAP TABLE 'TEST'.'T1':'T1_PREV';

# TIME
RECOVER TABLE 'TEST'.'T1' OF PLUGGABLE DATABASE pdb1
  UNTIL TIME "TO_DATE('01-JAN-2013 15:00', 'DD-MON-YYYY HH24:MI')"
  AUXILIARY DESTINATION '/u01/aux'  
  REMAP TABLE 'TEST'.'T1':'T1_PREV';

RECOVER TABLE 'TEST'.'T1' OF PLUGGABLE DATABASE pdb1
  UNTIL SCN 5695703
  AUXILIARY DESTINATION '/u01/aux'
  DATAPUMP DESTINATION '/u01/export'
  DUMP FILE 'test_t1_prev.dmp'
  NOTABLEIMPORT;

Comments (0)

Please to add comments

No comments yet. Be the first to comment!