For a client application and a database to communicate, the client application must be able to identify the database it wants to connect to, and the database must provide an identification. You can use a service name to connect to a database. A service name is a logical representation of a database, which is the way a database is presented to clients. A single database can be presented as multiple services.
Service names can provide location transparency so that the client application does not have to know the server’s location. If the database is moved to another location, then you must reconfigure only Oracle Net. No changes are necessary to client applications.
This tutorial will help you completely configure your client/server network.
Configuring a database listener with Oracle Net Manager
Oracle Net Manager provides various network configuration features, including the ability to configure profiles.
Note that you can also configure a database listener using NetCA.
In order to create and configure a listener from Oracle Net Manager, you will need to
- launch it from Windows start menu
- scroll down to “Listeners” and hit the “Create” button (+)
Next, provide a unique identifier for the listener. In this example, we use “LISTENER_GIT2”.
Select protocol addresses that identify the database. This address defines the protocol the listener is listening on and any other protocol-specific information. Click the “Add Address” button to add a listening protocol address.
Provide a hostname or IP address, a port number for the listening protocols TCP/IP and TCP/IP with SSL
After specifying protocol addresses, you will need to attach your listener to an Oracle database instance. To do so, select “Database Services” from the drop-down menu.
Provide the global name and SID of your database and the Oracle Home Directory in order to link your listener with your instance.
Important: Don’t forget to save your network configuration. Go to “File” and “Save Network Configuration”
Once you save your configuration, you can start or see the newly created listener using the integrated tool LSNRCTL.
To start a specific listener, you will need to enter the following command
If no name is specified, LSNRCTL will try to start the default listener (configured with TCP/IP and port number 1521).
The status command of LSNRCTL will give you detailed informations of the listener configuration such as the listener identifier, start date, listener parameter file, protocol descriptions (hostname or host IP address and port numbers), the linked database.
Oracle database 12c Client configuration
This section describes how to use SQL*Plus to connect to an Oracle database from a client computer. SQL*Plus is typically installed when you install Oracle Database client software.
After client installation, Oracle provide bunch of tools to access or manage the database from the client. For example, from the client computer, you can test the connectivity of your database using tnsping utility. In the following, we check if the database service dic2git is available on server.ept.sn listening on port number 1599.
Once, the availability of the instance verified, we can connect to the database from the client using an easy connect connection string. The easy connect naming method provides TCP/IP connectivity to databases without requiring you to configure Oracle Net Services.
Configuring Oracle Net Services from the client
To configure Oracle Net Services, you will need to start Oracle Net Manager from Windows start menu. In this section, we will configure only Service naming methods to create a network SID.
Select “Service Naming” and click on the “Create” button.
Provide then a service name. This network SID will be used to access the database remotely from the client. Make sure the name you select refers to the remote instance. In this example, we use git2client.
Next, select a network protocol you want to use to access the database. Make sure the protocol is configured on the server side.
Provide the server hostname or IP address and a port number. This information can be found on the listener configuration (server side). In our case, the server name is server.ept.sn and the port number is 1599 (see Page 1)
Next, you will need to enter the database global name you want to access and select a connection mode (dedicated mode, shared server, …)
The last step allow you test your network SID configuration. The wizard will try to connect to the remote database using a prebuilt user account, namely Scott. If there are no configuration issues, the wizard will be able to connect to the instance.
The connection attempt fails since Scott account is locked. On the other hand, it means the wizard was able to access the database server remotely. We can perform the test again using a non-locked account on the database.
If the HR account is not locked, we may use it to perform another test.
One last thing you will to do is to save the current network configuration. Otherwise, no change will be made on the client computer and all the configuration may be lost.
After saving your configuration, you can test the service you have configured using the tnsping utility. Since the service is configured on the client computer, we will provide only the SID.
The service is available on the network and allow us to connect to the remote database using a simplified connection string.