Oracle Net Configuration Assistant with Examples
In this article, I am going to discuss Oracle Net Configuration Assistant with Examples. Please read our previous article where we discussed Static Listener in Oracle with Examples. Until now we have learned how to configure listeners manually by making changes in the listener.ora and tnsnames.ora files. We already have discussed that there are two types of service registrations.
Listener Service Registrations in Oracle:
The Listener service registrations are of two types
In order to configure dynamic registrations, we have to configure as below
- Local_listener parameter
In static registration, we configure listener.ora by adding SID_LIST. Apart from these two, we have other methods
- Oracle Net Manager(netmgr)
- Oracle Net Configuration Assistant(netca)
- Listener Control Utility
- Enterprise Manager Cloud Control (Database in the cloud)
- Database Configuration Assistant (allows you to create a listener while creating a CDB)
So, we have two main tools. Oracle Net Manager and Oracle Net Configuration Assistant. Oracle Net Manager will help us to control the listener. Oracle recommends we use this Oracle Net Configuration Assistant. Let us go ahead and open the listener.ora file.
We can see there are many listeners created. We have created these listeners manually. We have listener_PDB as the static listener and LISTENER_19c as the dynamic listener and the actual default listener. In order to configure a listener using Oracle Net Configuration Assistant. We have to follow the below steps.
Add Listener in Oracle:
Step1: Open netca
Open a terminal and enter the command netca. This is the command for opening Oracle Net Configuration Assistant.
From the output, we can see there is a popup for Oracle Net Configuration Assistant. Let us explore netca. When we enter the command netca, Oracle will create backup files in the admin folder for the listener.ora and tnsnames.ora.
Step 2: Listener Configuration.
When we start netca we will have many options like Listener Configuration, and Naming Method configuration which configures sqlnet.ora file, Local Net Service Name Configuration which is used to configure tnsnames.ora, Directory Usage Configuration. We will choose Listener Configuration where will configure the listener.ora file and add a new listener.
Select Listener Configuration and click Next.
Step 3: Add Listener
Here we are adding a new listener so, we have selected Add option. If we want to delete a listener then we can select the delete option. Select Add option and click Next.
Step 4: Listener Name
Here we have to enter the listener name that we are going to create. Make sure not to use the listener that is already present in the listener.ora file. Click Next.
Step 5: Protocol Selection.
We will have three options here TCPS, IPC, and TCP protocol. We have to select TCP protocol as it is the default protocol. Click Next.
Step 6: Port Number Selection
Here we will get an option to use the default port number or select any other port number. We will be using another port and let’s enter the new port number. We are selecting to use another port number option and entered 1530 as the port number.
If you click Next It asks for do you want to add another listener. If you click Yes then the process starts from the beginning and you will be able to create another listener. We are clicking No, so we will move to the next step.
Step 7: Start Listener.
You will get an option to start the listener we have configured. Select the listener that we have created and click Next. You can see in the background the listener is started.
Step 8: Finish Configuration
You will see a popup showing the listener configuration completed. Click Next and Click Finish.
Let’s go ahead and open the listener.ora to check whether the listener is created or not.
From the output, we can see the listener_test is created and the port number is 1530. The netca will make life easier while configuring listeners.
Remove a Listener in Oracle:
Step 1: Let us go ahead and learn how to remove a listener using netca.
Use the command netca again.
Select Listener Configuration and click Next
Step 2: Delete Configuration
Select Delete Configuration as we have to delete the listener and click Next.
Step 3: Listener Selection and Deletion.
Select a listener that we want to delete. We are selecting LISTENER_TEST.
Click Next. It will show a popup as below.
Netca is asking for confirmation that the listener is running, netca will stop the listener and then delete the listener. Click Yes.
The listener Successfully deleted. Click Next and finish. Let’s go ahead and check the listener.ora file if the LISTENER_TEST exists or not.
We can see the listener LISTENER_TEST is not present in the listener.ora file.
Tnsnames Entry in Oracle:
We will try to create tnsnames entry to the tnsnames entry. Let’s assume we have a pluggable database called TEST_DB. The service name would be TEST_DB.com. Let’s go ahead and create a tns entry for this TEST_DB.
Step 1: Local Net Service Name Configuration
Open netca and select the Local Net Service Name Configuration and click Next.
Step 2: Add tnsentry
As we are creating a new entry in tnsnames.ora we are selecting add and clicking Next.
Step 3: Service Name
Suppose there is a pluggable database named TEST_DB then the service name would be TEST_DB.com. So, we are entering TEST_DB.com and click Next.
Step 4: Protocol Selection.
We are selecting TCP protocol as it is the default protocol that we are using. Click Next.
Step 5: Hostname and Port number
In this step, we have to enter the hostname and port number. Our hostname is oracletest.com, so we are entering oracletest.com and the port number that we are using is the default port number. Click Next.
Step 6: Test Connection.
In this step, netca asks us to check the connection of the database with the new tnsentry. We are not going to perform a test because there is no database named TEST_DB on our server.
Step 7: Net service name
Here we have to enter the entry name into the tnsnames.ora file. This entry is used by the client to connect to the database. We are giving TEST_DB.
Click Next and netca asks us to create another tnsentry. Click No.
Click Next and the tnsentry process is finished.
So, the tnsentry process is completed. Let’s go ahead and open the tnsnames.ora file and check if the entry is created or not.
We can see the TEST_DB entry is present. The hostname is oracletest.com and the port number is 1521. The service name is TEST_DB.com
If we need to connect to TEST_DB we have to create a new database named TEST_DB. So, we have learned how to create a new entry to listener.ora and the tnsnames.ora using netca.
In the next article, I am going to discuss Oracle Net Manager with Examples. Here, in this article, I try to explain Oracle Net Configuration Assistant with Examples and I hope you enjoy this Oracle Net Configuration Assistant with Examples article.
About the Author: Pranaya Rout
Pranaya Rout has published more than 3,000 articles in his 11-year career. Pranaya Rout has very good experience with Microsoft Technologies, Including C#, VB, ASP.NET MVC, ASP.NET Web API, EF, EF Core, ADO.NET, LINQ, SQL Server, MYSQL, Oracle, ASP.NET Core, Cloud Computing, Microservices, Design Patterns and still learning new technologies.