DEV Community

Vahid Yousefzadeh
Vahid Yousefzadeh

Posted on

Oracle 21c – pdbTimezone Parameter in DBCA Command

In a Container Database (CDB) environment, each container can be assigned a specific time zone. This feature has been available since version 12cR1. The list of available time zones can be retrieved using the V$TIMEZONE_NAMES view, and the desired time zone for each Pluggable Database (PDB) can be set using the ALTER DATABASE SET TIME_ZONE command:

SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> ALTER DATABASE SET TIME_ZONE='Asia/Tel_Aviv';
Database altered.
SQL> alter session set container=IranPdb;
Session altered.
SQL> ALTER DATABASE SET TIME_ZONE='Asia/Tehran';
Database altered.
SQL> alter session set container=cdb$root;
Session altered.
SQL> startup force;
SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT
SQL> SELECT dbtimezone FROM DUAL;
DBTIMEZONE
-------------
'Asia/Tel_Aviv'
SQL>  alter session set container=IranPdb;
Session altered.
SQL>  SELECT dbtimezone FROM DUAL;
DBTIMEZONE
-----------
'Asia/Tehran'
Enter fullscreen mode Exit fullscreen mode

Oracle 21c introduces a straightforward enhancement that allows specifying the time zone for each PDB during its creation using the dbca tool. Below is an example of how to use this feature:

[oracle@oLinux7 ~]$  dbca -silent -createPluggableDatabase -pdbName KievPdb -sourceDB db21c -pdbTimezone 'Europe/Kiev'
Enter PDBADMIN User Password: 
Prepare for db operation
13% complete
Creating Pluggable Database
15% complete
19% complete
23% complete
31% complete
53% complete
Completing Pluggable Database Creation
60% complete
Executing Post Configuration Actions
100% complete
Pluggable database "KIEVPDB" plugged successfully.
Look at the log file "/oracle21c/base/cfgtoollogs/dbca/db21c/KievPdb/db21c.log" for further details.
Enter fullscreen mode Exit fullscreen mode

After the PDB creation, verify the time zone setting:

[oracle@oLinux7 ~]$ sqlplus "/as sysdba"
SQL> alter session set container=KIEVPDB;
Session altered.
SQL> SELECT dbtimezone FROM DUAL;
DBTIMEZONE
-----------
'Europe/Kiev'
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.