The Listener and TNSName (Transparent Network Substrate) services.
The Listener service runs on the server and listens for requests from clients. By default it operates on TCP Port 1521 but can be reconfigured.
The database can still open if the listener service isn’t running, however it would only be able to handle local processes and not client requests. It is worth creating a backup listener service in order to maintain healthy communication between clients and servers.
If there’s a DNS server is operating in the environment, it needs to be configured with the oracle server host details. Running Windows Internet Name Service (WINS) would ease administration in environments where both Linux and Microsoft systems operate.
Saving the servers information in its own host file would also be helpful.
lsnrctl.ora & tnsnames.ora are located within the ORACLE_HOME/network/admin server directory. tnames.ora needs to be located on a client and its contents need to be identical on other instances. (An Oracle client needs to be running on the client machine. TOAD (Tool for Oracle Application Developers) and other management tools require access to the Oracle client.)
The tnsnames.ora file on the server is a copy of the file on the Oracle instance.
(ADDRESS = (PROTOCOL = TCP)(HOST = db.xx.local)(PORT = 1521))
(CONNECT_DATA = (SERVER = DEDICATED)
(SERVICE_NAME = orcl)
It’s considered good practice to have a copy of the contents of tnsnames.ora on the client server. Please note that Linux/Unix systems may be case sensitive.
You may set any password in the client tnsnames.ora file. To connect to the server, login with your username in place of “orcl”.
SQL>conn sys/password@orcl as sysdba
127.0.0.1 db.xx.local db localhost.localdomain localhost
The servers should be registered in the client host
(On Microsoft systems “c:windowssystem32driversetc”, Linux systems “etc”)
The server’s firewall should be configured to respond to requests through TCP Port 1521.
If the server is a Linux system and uses iptables: The 1st rule should be allowing requests from x.y.z.w IP addresses
2-$IPTABLES -t nat -A PREROUTING -i $WAN -p tcp –dport 3389 -j DNAT –to 192.168.141.130:1521
3-$IPTABLES -A FORWARD -i $WAN -s x.y.z.w -p tcp –dport 1521 -m state –state NEW -j ACCEPT
2nd rule: If the firewall uses an iptable and the Oracle server has 192.168.141.130 as its IP address, TCP 1521 requests that arrive from x.y.z.w will be redirected to the Oracle server.
For security reasons both rules should only allow requests from x.y.z.w, allowing the Internet to directly access port 1521 would be risky.
The image below is a server’s netstat output, showing that the listener service is inactive.
LSNRCTL for Linux: Version 10.2.0.1.0 – Production on 03-JAN-2010 20:15:26
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait…
TNSLSNR for Linux: Version 10.2.0.1.0 – Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db.xx.local)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1))) STATUS of the LISTENER ————————Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.1.0 – Production Start Date 03-JAN-2010 20:15:26 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log Listening Endpoints Summary… (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db.xx.local)(PORT=1521))) Services Summary… Service “PLSExtProc” has 1 instance(s). Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service… The command completed successfully
Using the $netstat -ntlp command to view an active listener on port 1521 (3rd line in the Local Address column).