How to Rename CDB PDB and Change DBID in Oracle Multitenant Architecture

Sometimes DBAs have to change CDB/PDB names to meet the organization’s naming standards, and change the DBID of a cloned database to make sure database registered in RMAN recovery catalog.

This post illustrates how to rename CDB/PDB, change DBID, and move and rename datafiles/tempfiles/controlfiles of CDB/PDB.

Subscribe to get access

Read more of this content when you subscribe today.

Create 12.2.0.1 Multitenant Database with DBCA

Here is an example of how to create a multitenant oracle database with DBCA in Oracle 12.2.0.1.

We will create a multitenant database with 1 CDB and 1 PDB. For CDB, all the components are selected and installed.  But for PDB, only following three components are selected and installed :

Oracle JVM 
Oracle Text
Oracle Multimedia

1)Startup VNCSERVER on node 1.

[oracle@racnode1 ~]$ vncserver :1

New 'racnode1.virtuallab:1 (oracle)' desktop is racnode1.virtuallab:1

Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/racnode1.virtuallab:1.log

[oracle@racnode1 ~]$

2) Open VNC Viewer .

3) Startup DBCA.

[oracle@racnode1 ~]$/u01/app/oracle/product/12.2.0/dbhome_1/dbca
dbca Create a database
dbca Create a database

4) Choose “Create a database”
“Advanced configuration”
“Custom database”
“Select all” nodes
Put in Database Name, SID, PDB details.

..
.

dbca Advanced configuration
dbca Advanced configuration
dbca select nodes
dbca select nodes
dbca database name
dbca database name
dbca storage option
dbca storage option
dbca FRA
dbca FRA
dbca database option
dbca database option
dbca data vault config option
dbca data vault config option

Choose ASMM in memory option, otherwise you will get below error:

[DBT-11211] The Automatic Memory Management option is not allowed when the
            total physical memory is greater than 4GB.
dbca configuration option
dbca configuration option
dbca management option
dbca management option
dbca user credentials
dbca user credentials
dbca creation option
dbca creation option
dbca prerequisite Checks
dbca prerequisite Checks
dbca summary
dbca summary
dbca Progress Page
dbca Progress Page
dbca Finish
dbca Finish

5) check the database.

[oracle@racnode1 ~]$ srvctl status database -d RACTESTB
Instance RACTESTB1 is running on node racnode1
Instance RACTESTB2 is running on node racnode2
[oracle@racnode1 ~]$
SQL>show con_name;

SQL>  show con_name;

CON_NAME
------------------------------
CDB$ROOT

SQL> select COMP_NAME, STATUS from dba_registry;

COMP_NAME                                STATUS
---------------------------------------- ----------------
Oracle Database Catalog Views            VALID
Oracle Database Packages and Types       VALID
JServer JAVA Virtual Machine             VALID
Oracle XDK                               VALID
Oracle Database Java Packages            VALID
OLAP Analytic Workspace                  VALID
Oracle Real Application Clusters         VALID
Oracle XML Database                      VALID
Oracle Workspace Manager                 VALID
Oracle Text                              VALID
Oracle Multimedia                        VALID
Spatial                                  VALID
Oracle OLAP API                          VALID
Oracle Application Express               VALID

14 rows selected.


SQL> alter session set container=ractestbpdb;

Session altered.

SQL> show con_name;

CON_NAME
------------------------------
RACTESTBPDB

SQL> select COMP_NAME, STATUS from dba_registry;

COMP_NAME                                STATUS
---------------------------------------- -----------
Oracle Database Catalog Views            VALID
Oracle Database Packages and Types       VALID
JServer JAVA Virtual Machine             VALID
Oracle XDK                               VALID
Oracle Database Java Packages            VALID
Oracle Real Application Clusters         VALID
Oracle XML Database                      VALID
Oracle Workspace Manager                 VALID
Oracle Text                              VALID
Oracle Multimedia                        VALID

10 rows selected.

[DBT-11211] The Automatic Memory Management option is not allowed when the total physical memory is greater than 4GB

In 12.2.0.1, when creating a multitenant CDB database by using DBCA, the below error occurs:

[DBT-11211] The Automatic Memory Management option is not allowed
            when the total physical memory is greater than 4GB
DBT-11211
DBT-11211

Workaround

Choose to use ASMM ( Automatic Shared Memory Management ) instead of AMM ( Automatic Memory Management ).

DBCA Memory Option
DBCA Memory Option

How to Exclude Tablespaces from RMAN Backup

You can use “CONFIGURE EXCLUDE FOR TABLESPACE” to exclude tablespaces from RMAN  backup command “BACKUP DATABASE”.

To exclude tablespace TEST_TBS from RMAN backup:

$ rman target / catalog rman/passwd@rman

RMAN>CONFIGURE EXCLUDE FOR TABLESPACE TEST_TBS;

Tablespace TEST_TBS will be excluded from future whole database backups
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete


RMAN> show exclude ;
RMAN configuration parameters for database with db_unique_name RACTEST are:
CONFIGURE EXCLUDE FOR TABLESPACE 'TEST_TBS';

RMAN>

To exclude PDB tablespace TEST_TBS  from RMAN backup:

RMAN> CONFIGURE EXCLUDE FOR TABLESPACE RACTESTPDB:TEST_TBS;

Tablespace RACTESTPDB:TEST_TBS will be excluded from future whole 
database backups. 
new RMAN configuration parameters are successfully stored. 
starting full resync of recovery catalog
full resync complete

RMAN>show exclude ;
RMAN configuration parameters for database with db_unique_name RACTEST are:
CONFIGURE EXCLUDE FOR TABLESPACE 'TEST_TBS';
CONFIGURE EXCLUDE FOR TABLESPACE 'RACTESTPDB:TEST_TBS';

The following rman backup will excluded the above mentioned tablespaces:

RMAN> BACKUP DATABASE;

The excluded tablespace can be backed up by explicitly specifying them in a BACKUP command or by specifying the NOEXCLUDE option:

RMAN> BACKUP DATABASE NOEXCLUDE;

RMAN> BACKUP TABLESPACE TEST_TBS;

To disable the exclusion for RMAN backups:

RMAN> CONFIGURE EXCLUDE FOR TABLESPACE TEST_TBS CLEAR;

RMAN> CONFIGURE EXCLUDE FOR TABLESPACE RACTESTPDB:TEST_TBS CLEAR;

RMAN> show exclude;

 

ORA-16857: standby disconnected from redo source for longer than specified threshold

One single 11.2.0.4 instance Oracle database alert log shows below information;

 RFS[1]: No standby redo logfiles available for thread 1

Data Guard shows ORA-16857 error:

DGMGRL> show database "TESTSTY";

Database - TESTSTY

Role: PHYSICAL STANDBY
 Intended State: APPLY-ON
 Transport Lag: 10 minutes 32 seconds (computed 48 seconds ago)
 Apply Lag: 10 minutes 32 seconds (computed 48 seconds ago)
 Apply Rate: 39.97 MByte/s
 Real Time Query: OFF
 Instance(s):
 TESTSTY

Database Warning(s):
 ORA-16857: standby disconnected from redo source for longer than 
specified threshold

Database Status:
WARNING

Checked both primary and standby database, the  standby online redo logs have been created. But the size of the standby online redo logs are different from the database redo logs for both primary and secondary database.

— on standby :

SQL> select GROUP#,THREAD# ,BYTES/1024/1024 from v$standby_log;

GROUP#     THREAD#    BYTES/1024/1024
---------- ---------- ---------------
 4         1           50
 5         1           50
 6         1           50
 7         1           50

SQL> select GROUP#,THREAD#,BYTES/1024/1024 from v$log;

GROUP#     THREAD#    BYTES/1024/1024
---------- ---------- ---------------
 1         1          100
 3         1          100
 2         1          100

— On Primary

SQL> select GROUP#,THREAD# ,BYTES/1024/1024 from v$standby_log;

GROUP#     THREAD#    BYTES/1024/1024
---------- ---------- ---------------
 4         1          50
 5         1          50
 6         1          50
 7         1          50

SQL> select GROUP#,THREAD#,BYTES/1024/1024 from v$log;

GROUP#     THREAD#    BYTES/1024/1024
---------- ---------- ---------------
 1         1          100
 2         1          100
 3         1          100

Drop all standby online redo logs on both primary and standby databases, and recreate them again with same size as redo logfiles.

-- for standby db which is under recovery, recovery needs to be stopped first
SQL>alter database recover managed standby database cancel;

SQL>alter database add standby logfile thread 1 group 4 size 100m;

It will create standby online redo logs for one under +FRA, and another one under from “db_create_file_dest” parameter, if “db_create_online_log_dest_x” are not defined.

Finally restart the recovery process, then everything is fine.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE 
THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILE;

Database altered.

alert.log:

RFS[1]: Selected log 4 for thread 1 sequence 41436 dbid 1345227970 branch 816878594
Mon Feb 19 14:38:25 2018
..
.
Recovery of Online Redo Log: Thread 1 Group 4 Seq 41436 Reading mem 0
..
.

DGMGRL of DataGuard:

DGMGRL> show database 'TESTSTY';

Database - TESTSTY

Role: PHYSICAL STANDBY
 Intended State: APPLY-ON
 Transport Lag: 0 seconds (computed 0 seconds ago)
 Apply Lag: 0 seconds (computed 0 seconds ago)
 Apply Rate: 208.00 KByte/s
 Real Time Query: OFF
 Instance(s):
 TESTSTY

Database Status:
SUCCESS