904 Bedford St, New York NY 10014

(+1) 5184-453-1514

Managing a Listener in a PDB Environment- Large Objects

Recall from Chapter 2 that a listener is the process that enables remote network connections to a database. Most database environments require a listener to operate.

When a client attempts to connect to a remote database, the client provides three key pieces of information: the host the listener is on, the host port the listener is listening on, and a database service name.

Each database has one or more service names assigned to it. By default, there is usually one service name that is derived from the database’s unique name and domain.

You can manually create one or more service names for a database. DBAs sometimes create more than one service so that resource usage can be controlled or monitored for each service.

For example, a service may be created for a sales application, and a service may be created for the HR application. Each application connects to the database via its

service name. The service connection information appears in the SERVICE_NAME column of the V$SESSION view for each session.

If you start a default listener with no listener.ora file in place, the PMON background process will automatically register any databases (including any pluggable) as a service:

$ lsnrctl start

Eventually, you should see the databases (including any PDBs) registered with the default listener.

When starting the listener, if there is a listener.ora file present, the listener will attempt to statically register any service names that appear in the listener.ora file.

By default, the PDBs are registered with a service name that is the same as the PDB name. The default service is typically the one that you would use to make connections:

$ sqlplus pdbsys/Cr4zyPa$$word1@mm23c:1521/salespdb as sysdba

You can verify which services are running by connecting as SYS to the root container and querying like this:

SQL> select name, network_name, pdb from v$services order by pdb, name;

You can also verify which services a listener is listing for via the lsnrctl utility:

$ lsnrctl services

Oracle recommends that you configure an additional service (besides the default service) for any applications that need to access a PDB.

You can manually configure services by using the SRVCTL utility or the DBMS_SERVICE package. This example shows how to configure a service via the DBMS_SERVICE package.

First, connect as SYS to the PDB that you want to create the service in via the default service:

$ sqlplus pdbsys/Cr4zyPa$$word1@mm23c:1521/salespdb as sysdba

Make sure the PDB is open for read-write mode:

SQL> SELECT con_id, name, open_mode FROM v$pdbs;

Next, create a service. This code creates and starts a service named SALESWEST:

SQL> exec DBMS_SERVICE.CREATE_SERVICE(service_name => ‘SALESWEST’, network_ name => ‘SALESWEST’);

SQL> exec DBMS_SERVICE.START_SERVICE(service_name => ‘SALESWEST’);

Now, application users can connect to the SALESPDB pluggable database via the service:

$ sqlplus appuser/Cr4zyPas$$word1@mm23c:1521/saleswest

Caution If you have multiple CDB databases on one server, ensure that the PDB service names are unique across all CDB databases on the server. It is not advisable to register two PDB databases with the same name with one common listener.this will lead to confusion as to which PDB you are actually connecting to.

Search

Popular Posts

  • Recovery Catalog Versions – RMAN Backups and Reporting
    Recovery Catalog Versions – RMAN Backups and Reporting

    I recommend that you create a recovery catalog for each version of the target databases that you are backing up. Doing so will save you some headaches with compatibility issues and upgrades. I have found it easier to use a recovery catalog when the database version of the rman client is the same version used…

  • Registering a Target Database – RMAN Backups and Reporting
    Registering a Target Database – RMAN Backups and Reporting

    Now, you can register a target database with the recovery catalog. Log in to the target database server. Ensure that you can establish connectivity to the recovery catalog database. For instance, one approach is to populate the TNS_ADMIN/tnsnames.ora file with an entry that points to the remote database. On the target database server, register the…

  • Creating a Recovery Catalog – RMAN Backups and Reporting
    Creating a Recovery Catalog – RMAN Backups and Reporting

    When I use a recovery catalog, I prefer to have a dedicated database that is used only for the recovery catalog. This ensures that the recovery catalog is not affected by any maintenance or downtime required by another application (and vice versa). Listed next are the steps for creating a recovery catalog: 1. Create a…

Tags