Issue
Oracle 12c Database Point-In-Time Recovery (PITR).

This article describes the steps for Oracle 12c PITR on Linux DS-Client.

Oracle 12c has some structural differences from the previous Oracle 11g version. Specifically, when you select the entire Oracle 12c server for backup, the backup will include the Root Container (CDB$ROOT), all Pluggable Databases (PDBs), the Archived Logfiles, the Database Controlfile, and the PDB$SEED.
You can create a backup set of individual Pluggable databases in two ways:
Connect to the Oracle Server at CDB-level and select only the PDB you want.
Connect to the Oracle Server at PDB-level by entering the Service Name defined at that level. (This is the 'Net service Name' that you enter in the Service Name field when asked for database credentials in the New Backup Set Wizard.) If you connect this way, you will only be able to browse the contents of that specific Pluggable database.


Summary
RMAN PITR Overview:

Oracle Recovery Manager (RMAN) PITR restores the database from backups prior to the target time for recovery, then uses incremental backups and 'redo' to roll the database forward to the target time. You can recover to a System Change Number (SCN), log sequence number, time, or restore point.

The prerequisites for database point-in-time recovery are as follows:
Your database must be running in ARCHIVELOG mode.
You must have backups of all data files from before the target SCN for PITR and archived logs for the period between the SCN of the backups and the target SCN.

For a full description of command prerequisites and usage notes, refer to the 'RECOVER' section in the "Oracle Database Backup and Recovery Reference" documentation.

Steps involving DS-User are condensed.
Requirement for PITR

Linux DS-Client only.
Database dump protocol used to make the backup set must be Local File System, NFS, or UNIX-SSH. A PITR is not possible if the database was backed up using the DS-PIPE method.
Peforming PITR of the full Container Database (CDB):

PITR of the whole CDB is the same as PITR of non-container (or pre-12c) database. Please refer to the PITR section in the Knowledge Base article in Section, "Oracle 11g Database Point-In-Time Recovery (DBPITR)", on guide.

You can perform PITR with the current control file or a backed up control file.

During the PITR process, you may need to view your database version in Read Only mode. (To open a database in Read Only mode, you would normally use a backed up control file instead of the current control file.)

If the PITR result is what you expected, then you can open the database with the Resetlogs option.

When you perform PITR of an Oracle 12 database, you have the following options:

Oracle 12c Database Point-In-Time Recovery (PITR)
Do not execute 'RECOVER' commands:
This option will not issue the Oracle 'RECOVER' command. You must use RMAN to perform the PITR manually.
See Section "PITR of whole CDB using the 'Do not execute RECOVER commands' option", on guide.
'RECOVER DATABASE' at:
This option will automatically recover the database to the target time and opens the database with the Resetlogs option.
See Section "PITR of whole CDB using the 'RECOVER DATABASE' at option", on guide.
By default, this sets the target time for a CDB-level PITR.
When used with the PITR of pluggable database(s) option, this sets the target time for PDB-level PITR.
o WARNING: This should not be selected on its own if you are restoring only part of the CDB.
PITR of pluggable database(s)
This option appears if your restore selection qualifies for a PITR.
See Section, "Performing PITR of Pluggable Databases (PDBs)", on guide.
If you select this option, you must also select 'RECOVER DATABASE' at: and enter the date and time you want to perform the PITR of the pluggable database(s) to.
The PITR will be applied to the pluggable database(s) selected for restore at the beginning of the Restore Wizard.

NOTE: If you select all three options, the option PITR of pluggable database(s) will be executed.

PITR of whole CDB using the 'RECOVER DATABASE' at option

This option will automatically recover the database to the target time and opens the database with the Oracle RMAN Resetlogs option.

If you have all the archived logs up to the target recovery time, restore the Root container (CDB$ROOT), the Database Control file, the PDB$SEED and all other PDBs.

1. Do one of the following as applicable:

If you are performing PITR with a backed up control file, you must include the Database Controlfile item in the restore selection. Before restoring, you must set the database in Nomount state using the following SQL*Plus commands:

SQL>Shutdown immediate;

SQL>Startup nomount;

If you are performing PITR with the current control file on the Oracle server, you exclude the Database Controlfile item from your restore selection.

Before restoring, you must mount the database using the following SQL*Plus command:

SQL>Startup mount;

2. From the DS-User Restore Wizard, select the whole Oracle 12 database. Uncheck the Archived Logfiles (since you will be using the existing Logfiles on the Oracle server).

NOTE: All required archived logs must be available on the Oracle server (i.e. from the time of the backup session that you are restoring, up to the PITR target time that you specify).
3. Select to include or clear to exclude the Database Controlfile, depending on your selection when you began this procedure.

Figure 4: The whole CDB is selected with the backed up Controlfile

Figure 5: The whole CDB is selected without the Controfile
4. Continue to the Select Restore Options tab of the Restore Wizard.

In the Additional Restore Options section:

a) Select the checkbox for the 'RECOVER DATABASE' at option.

b) Input the target recovery point-in-time at which you want to recover your database.

NOTE: All required archived logs must be available on the Oracle server (i.e. from the time of the backup session that you are restoring, up to the PITR target time that you specify).

5. Finish the Wizard.

After you click Finish, DS-Client will automatically recover the whole Oracle CDB database to the target time. Then, DS-Client will open the database with the Oracle RMAN Resetlogs option.

PITR of whole CDB using the 'Do not execute RECOVER commands' option

This option will not issue the Oracle 'RECOVER' command. This means DS-Client will restore only the data files and archived logs back to the Oracle server. You must use RMAN to perform the PITR manually.

1. Put the database in Nomount state with the following SQL*Plus commands:

SQL>Shutdown immediate;

SQL>Startup nomount;

2. From the DS-User Restore Wizard, select the whole Oracle 12 database. Uncheck the Archived Logfiles (since you will be using the existing Logfiles on the Oracle server).

NOTE: All required archived logs must be available on the Oracle server (i.e. from the time of the backup session that you are restoring, up to the PITR target time that you specify).

3. Continue to the Select Restore Options tab of the Restore Wizard.

4. Select the option Do not execute 'RECOVER' commands.

5. Finish the Wizard. After you click Finish, DS-Client will:

Replicate the control file

Mount the database

Restore the database

6. Manually perform PITR with Oracle's RMAN. The database will be in Mount state.

Use RMAN to connect to the target database and perform the PITR.

7. Perform the following operations within a RUN block:

RMAN>Run{

Set Until Time="TO_DATE('2015-08-17 17:40:00', 'YYYY-MM-DD

HH24:MI:SS')";

Recover database;

}

If you know the specific logseq# or SCN where you want to recover the database, you can use with the RMAN Set Until clause as in the following examples:

RMAN>Run{

Set Until logseq=6;

Recover Database;

}

OR

RMAN>Run{

Set Until SCN 2490455;

Recover database;

}

8. Review the recovery results. Open the database in Read Only mode with the following SQL*Plus commands to check if you are satisfied with the results:

SQL>Alter database open Read Only;

SQL>Alter pluggable database all open Read Only;

9. If satisfied, you can open the database with the Resetlogs option:

SQL>Alter database open Resetlogs;

If not satisfied, you can repeat the PITR procedure to a new target time.

EXAMPLES

The following screen shots show the RMAN output from the three examples from step 7 above:


Figure 6: Recover Database Until a Target Time

Figure 7: Recover Database Until a Target Log Sequence Number

Figure 8: Recover Database Until a Target SCN
Performing PITR of Pluggable Database (PDBs)

Requirements:

Because each PDB needs to retrieve the Undo information and other related information from the CDB-level, this means the Root container (CDB$ROOT) and the Database Controlfile need to be included for a PITR of a PDB.

An Oracle backup set created at PDB-level cannot be used for PITR.

The target PDB(s) must be closed.

PITR of a single pluggable database

The following example is for a PITR of the PDB named "PDB03".
1. Open the Restore Wizard for the Oracle 12 backup set you want.

2. Select the Root container (CDB$ROOT), the Database Controlfile, and the specific PDB you want. This PDB must be closed.

3. Continue to the Select Restore Options tab of the Restore Wizard.

4. Select the target time for PITR:
a) Select the checkbox for the 'RECOVER DATABASE' at option. Input the target recovery point-in-time at which you want to recover the PDB database.

b) Select the checkbox for the PITR of pluggable database(s) option.

NOTE: Make sure PITR of pluggable database(s) is selected. If you only select 'RECOVER DATABASE' at, the restore will default back to a PITR at CDB-level. Since you have not selected all the PDBs for restore, this will restore the CDB in an inconsistent state.

5. Finish the Wizard.

After you click Finish, DS-Client will instruct RMAN to perform PITR for the pluggable database "PDB03".

After PITR of PDB03 completes successfully, the PDB03 will be opened. If PITR of PDB03 failed, DS-Client will stop the restore process with error(s) and a PITR log file will be written to '/tmp' and named in the format:

RecoverPluggablePIT.Backupset_ID.Generation_number.log.Timesta mp

PITR of multiple pluggable databases at the same time

The following example is for a PITR four PDBs at the same time named "PDB01", "PDB02", "PDB03", and "PDBORCL12".

1. Open the Restore Wizard for the Oracle 12 backup set you want.


2. Select the Root container (CDB$ROOT), the Database Controlfile, and the specific PDBs you want. All these PDBs must be closed.

3. Continue to the Select Restore Options tab of the Restore Wizard.

4. Select the target time for PITR
The rest of the procedure is the same as for restoring a Single PDB.