DBA Hub

📋Steps in this guide1/3

Multitenant : Pluggable Database (PDB) Names

A brief article to highlight the importance of unique PDB names.

oracle 12cconfigurationintermediate
by OracleDba
13 views
1

Overview

The command includes a very brief, but important statement about the naming of pluggable databases (PDBs). > "Specify the name of the PDB to be created. The first character of a PDB name must be alphanumeric and the remaining characters can be alphanumeric or the underscore character (_). The PDB name must be unique in the CDB, and it must be unique within the scope of all the CDBs whose instances are reached through a specific listener." "Specify the name of the PDB to be created. The first character of a PDB name must be alphanumeric and the remaining characters can be alphanumeric or the underscore character (_). The PDB name must be unique in the CDB, and it must be unique within the scope of all the CDBs whose instances are reached through a specific listener." "Specify the name of the PDB to be created. The first character of a PDB name must be alphanumeric and the remaining characters can be alphanumeric or the underscore character (_). The PDB name must be unique in the CDB, and it must be unique within the scope of all the CDBs whose instances are reached through a specific listener." The first part of the second paragraph seems pretty obvious. Why would we expect to have two PDBs with the same name in the same container? The second part of the second paragraph is less obvious though. The PDB name must be unique amongst all the PDBs serviced by a single listener. There is a note about possible collisions towards the top of the page . Imagine a scenario where we have two CDBs under the same ORACLE_HOME, both using the same listener. If both have a PDB called "pdb1", this will cause problems when trying to connect. If we check the listener status, we can see a service called "pdb1", with two instances ("cdb1" and "cdb2").
2

Section 2

In the "tnsnames.ora" file we have the following entry. If we connect using the alias, we will round-robin between the two instances. Because we can move PDBs between containers using unplug/plugin, it would be easy to accidentally bring about this situation, so the safest approach is to make sure all PDBs have a unique name within your organisation.

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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 14-FEB-2015 13:15:50

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ol7-121.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                14-FEB-2015 12:29:40
Uptime                    0 days 0 hr. 46 min. 10 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/12.1.0.2/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/ol7-121/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ol7-121.localdomain)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "cdb1" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb1XDB" has 1 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "cdb2" has 1 instance(s).
  Instance "cdb2", status READY, has 1 handler(s) for this service...
Service "cdb2XDB" has 1 instance(s).
  Instance "cdb2", status READY, has 1 handler(s) for this service...
Service "pdb1" has 2 instance(s).
  Instance "cdb1", status READY, has 1 handler(s) for this service...
  Instance "cdb2", status READY, has 1 handler(s) for this service...
The command completed successfully
$

PDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ol7-121.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdb1)
    )
  )

SQL> CONN sys@pdb1 AS SYSDBA
Enter password:
Connected.
SQL> SELECT name FROM v$database;

NAME
---------
CDB2

SQL> CONN sys@pdb1 AS SYSDBA
Enter password:
Connected.
SQL> SELECT name FROM v$database;

NAME
---------
CDB1

SQL> CONN sys@pdb1 AS SYSDBA
Enter password:
Connected.
SQL> SELECT name FROM v$database;

NAME
---------
CDB2

SQL>
3

Section 3

For more information see: - CREATE PLUGGABLE DATABASE - Multitenant : All Articles Hope this helps. Regards Tim...

Comments (0)

Please to add comments

No comments yet. Be the first to comment!