Database Reference
In-Depth Information
Now you can connect to the PDB.
In addition to the default service name you can of course create additional services for your PDB. Either use
DBMS_SERVICE for this purpose—or if you are on ASM—create the service with srvctl:
[oracle@server1 ~]$ srvctl add service -db CDB1 -service soe -pdb swingbench1
Note the new “pdb” flag in the above command. When the service is created you can start it to allow user
connections.
a CaSe FOr eZCONNeCt
Many sites I visited over the years were against the use of eZConnect, except perhaps for those running real
application Clusters 11.2, where the “remote_listener” parameter makes use of the eZConnect syntax.
eZConnect shortens the url required to connect to a database, and very often becomes a time saver when trying
to connect to a database service for which no tnsnames.ora entry exists, and also where change management
would prevent a change to the file in time for the project. so instead of using the “connect user@netServiceName
syntax, you could use this instead:
SQL> connect soe/ password@server1.example.com / swingbench1
You can even specify a different listener port if needed:
SQL> connect soe/ password@server1.example.com : 1523/swingbench1
the reason I heard most often as to why eZConnect was banned was security. however, eZConnect does not
add a security problem; it has always been possible to connect to the database service without a service name
defined in tnsnames.ora. so instead of using the more convenient statement shown above, you could use this
rather long connection string instead:
Enter user-name: soe/passwd@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST= server1.example.com )(PORT=1521))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=swingbench1)))
as you can see, eZConnect should not pose an additional threat. Nevertheless these discussions need to be had
with your security department, the above can only be an example.
Moving within the CDB
During the preparation of this chapter I found myself switching from one PDB to another and back to the CDB$ROOT
quite a lot. When using EZConnect this quickly turns into a lot of typing. If you are connected as a common user
(see section “Users and Roles” further down in this chapter for more information about common and local users) and
possess the “SET CONTAINER” system privilege then you can move vertically within the CDB quite easily. Many DBAs
still type the “sqlplus / as sysdba” blindly into their terminal session and end up in the root container. Rather than
using the EZConnect syntax “connect system/xxx@localhost:listenerPort/servicename” the easier variant is to set the
container appropriately as shown here.
 
Search WWH ::




Custom Search