Viewing the Oracle PDB Database ID
Oracle has introduced the Multitenant feature for Oracle 12c. There are 2 databases that are part of the Mulitenant feature:
- The container database (CDB) - This database contains the files that the database needs to run such as the control file, dictionary and redo logs. A CDB can contain one or more pluggable databases (PDB).
- Pluggable databases (PDB) - PDBs contain datafiles and tablespaces. They do not contain any control file because they use the CDB control file. Each PDB has a unique database ID.
If you have Oracle 12c, then you can unplug a PDB from one CDB and plug it into a new CDB to simplify software patching and maintenance. When you move a PDB to a new CDB instance, Oracle prunes the database backup information from the original CDB instance and does not update the new CDB instance with the backup information. The Commvault Oracle Agent software keeps track of the CDB at a specific point in time so that you can identify the CDB for a point-in-time restore.
Commvault provides this functionality by including the PDB database ID in backups and providing script that you run from the command line that displays the following PDB information:
- The client name where you ran the backup
- The Oracle instance name
- The Oracle PDB name
- The backup job start time of the first PDB backup
- The backup job end time of the last PDB backup
- The PDB database ID
After you have this information, you can use RMAN scripts to plug the PDB into a new CDB, or to clone the PDB.
Procedure
- If you are not logged on to the CommServe computer, run the qlogin command.
- On the command line, go to Software_Installation_Directory/Base and type the command.
qoperation execute -af qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si startTime = 'start-time' -si endTime = 'end-time' -si databaseNameList = 'pdbNameList' -si instanceNameList='instanceNameList' -si clientNameList = 'clientnameList' -si dbIdList = 'dbIdList' -si enableDateTimeFormat = '0 or 1'
Where:
Parameter
Definition
startTime
The backup job start time of the first PDB backup (for the CDB). The format is MM/DD/YYYY HH24:MI:SS.
endTime
The backup job end time of the last PDB backup (for the CDB). The format is MM/DD/YYYY HH24:MI:SS.
databaseNameList
The databases that the software queries. Use a comma (",") to separate each database name.
pdbNameList
The PDBs that the software queries. Use a comma (",") to separate each PDB name.
instanceNameList
The instances that the software queries. Use a comma (",") to separate each instance name.
clientNameList
The clients that the software queries. Use a comma (",") to separate each client name.
dbIdLiast
The database IDs that the software queries. Use a comma (",") to separate each database ID.
enableDateTimeFormat
By default the Commvault software outputs the start time and end time in the epoch format (the number of seconds that have elapsed since 1/1/70) so that you can use them in xml scripts. Set this value to 1 to have the output in date format.
- To logoff the CommServe computer, run the qlogout command.
Examples
Using an Instance Name List
The following example uses an instance name list for the query. In this example, the parameters are on the command line.
./qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si '05/15/2017 00:30:00' -si '05/24/17 03:57:41' -si '' -si 'cdb1,CDB1' QScript[QS_GetOracle12CPDBBackupDetails] CS[172]
Qscript Output:
client instance PDBName CreatedTime EndTime DatabaseId
------ -------- ------- ----------- ------- ----------
client1 cdb1 PDB2_CLONE 1494257431 CURRENT 939761637
client2 CDB1 SALESDB 1487819022 CURRENT 982462945
client2 CDB1 TEST 1487819022 CURRENT 1402352903
client2 CDB1 TEST2 1487819022 1494873223 1724511053
client1 cdb1 PDB2 1494257431 1495597590 2147483647
client1 cdb1 BNP 1495558116 1495597590 2147483647
client2 CDB1 BNP 1487819022 1495558332 2147483647
client1 cdb1 BNP 1495597590 CURRENT 2620863108
client1 cdb1 PDB2 1495597590 CURRENT 3666063263
Using a PDB Name List
The following example uses a PDB name list for the query. In this example, the parameters are on the command line.
./qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si '05/15/2017 00:30:00' -si '05/24/17 03:57:41' -si 'TEST,BNP'
client instance PDBName CreatedTime EndTime DatabaseId
------ -------- ------- ----------- ------- ----------
client2 CDB1 TEST 1487819022 CURRENT 1402352903
client1 cdb1 BNP 1495558116 1495597590 2147483647
client2 CDB1 BNP 1487819022 1495558332 2147483647
client1 cdb1 BNP 1495597590 CURRENT 2620863108
Using a Client Name List
The following example uses a client name list for the query. In this example, the parameters are on the command line.
./qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si '05/15/2017 00:30:00' -si '05/24/17 03:57:41' -si '' -si '' -si 'client1,client2'
QScript[QS_GetOracle12CPDBBackupDetails] CS[172]
Qscript Output:
client instance PDBName CreatedTime EndTime DatabaseId
------ -------- ------- ----------- ------- ----------
client1 cdb1 PDB2_CLONE 1494257431 CURRENT 939761637
client2 CDB1 SALESDB 1487819022 CURRENT 982462945
client2 CDB1 TEST 1487819022 CURRENT 1402352903
client2 CDB1 TEST2 1487819022 1494873223 1724511053
client1 cdb1 PDB2 1494257431 1495597590 2147483647
client1 cdb1 BNP 1495558116 1495597590 2147483647
client2 CDB1 BNP 1487819022 1495558332 2147483647
client1 cdb1 BNP 1495597590 CURRENT 2620863108
client1 cdb1 PDB2 1495597590 CURRENT 3666063263
Using a PDB Database ID List
The following example uses a PDB database ID list for the query. In this example, the parameters are on the command line.
./qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si '05/15/2017 00:30:00' -si '05/24/17 03:57:41' -si '' -si '' -si '' -si '939761637,2147483647'
Qscript Output:
client instance PDBName CreatedTime EndTime DatabaseId
------ -------- ------- ----------- ------- ----------
client1 cdb1 PDB2_CLONE 1494257431 CURRENT 939761637
client1 cdb1 PDB2 1494257431 1495597590 2147483647
client1 cdb1 BNP 1495558116 1495597590 2147483647
client2 CDB1 BNP 1487819022 1495558332 2147483647
Changing the Time Format
The following example uses the enableDateTimeFormat to display the output in the default epoch format.
./qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si '08/03/2017 12:30:00' -si '08/17/17 17:25:41' -si 'XPPDB1' -si '' -si '' -si '' -si 0 -si 1
Qscript Output:
client instance PDBName CreatedTime EndTime DatabaseId
------ -------- ------- ----------- ------- ----------
client3 CDB2 PDB12 08-07-2017 18:07:44 08-14-2017 21:20:23 2 071778599
The following example uses the enableDateTimeFormat to display the output in date format.
./qoperation execscript -sn QS_GetOracle12CPDBBackupDetails -si '08/03/2017 12:30:00' -si '08/17/17 17:25:41' -si 'XPPDB1' -si '' -si '' -si '' -si 0 -si 1
Qscript Output:
client instance PDBName CreatedTime EndTime DatabaseId
------ -------- ------- ----------- ------- ----------
client3 CDB2 PDB12 1502129264 1502745623 2071778599
What to Do Next
Run RMAN scripts that plug databases into a different CDB.
Last modified: 2/28/2018 12:29:20 AM