DEV Community

technonotes-hacker
technonotes-hacker

Posted on

Network in Database

  • Listener --> server side configuration file --> listener.ora
  • TNSnames --> Client side configuration file --> tnsnames.ora

listener.ora

  • it contains port.
  • on which port the database is listening.
  • protocol --> TCP ( on which protocol its running )
  • hostname or IP address
  • All these can assigned to Listener name, so that we can start and stop the listener ( Alias Name )
  • location --> TNS admin ? --> network configuration location.
  • This network location will be in $ORACLE_HOME/network/admin
  • Listener Base --> Listener related logs will go here, its like a base directory.
  • lsnrctl --> listener Control

lsnrctl start name_of_the_listener
lsnrctl status name_of_the_listener

  • Change the listener port , now the scenario will be like --> Listener is running in 1522 but the LREG takes the details of DB and then search for 1521 port. Even if you wait for 60 secs it wont happen . So your Listener will never get the update of DB details. " The Listener supports no service " --> That means Listener doesn't have any DB details.
  • show parameter local_listener;
  • alter system set local_listener = ' ( Address = ... ) ' ;
  • Now my LREG is aware where my listener is running.

Static Registration

  • Static registration with SID OR Service name.
  • Forcing the listener to register the DB details ( don't worry about the status of the DB , but just register )
  • UNKNOWN is the static registration.
  • What is the purpose of registering with Static registration ? --> Its used in Data Guard Build for online mode is one of the use case.

tnsnames.ora

  • Its a client side configuration file.
  • The client may connect from any application.
  • Inside the file we need : Port , protocol , hostname or IP address , service name ( name of the DB will be equal to service name , most of the time )
  • All these 4 details are required.
  • The client will connect with these parameters along with username and password. -Each time all these details to be passed , to avoid this , Oracle came up with ALIAS NAME in the tnsnames.ora file which is inside the network admin file.

sqlnet.ora

  • Both server and client side file.
  • It can be used for many purposes.
  • If there is any miss-match in version at any side , client or server side , at that time this HERO will come into picture. OR at TDE / Wallet usage.
  • In simple terms , its used in : ( search in internet "sqlnet.ora" )

lower client version
wallet location
AD/LDAP
Connect Timeout ( Client to server connectivity )
40 or > 40 parameters can be defined.

Image description

NOTE

  1. Oracle_home will be more or less like --> /u01/app/oracle/product/19.0.0.1/dbhome_1
  2. Listener supports no service.
  3. For every 60 secs these pmon goes to listener and registers its details. what details ? DB details . This is as per 11g.
  4. LREG in 12c --> Listener register , every 60 secs it registers the DB details with the LISTENER. This registration happens only when the DB is running with 1521 PORT.
  5. Listener is a dynamic parameter.
  6. What is UNKNOWN ? when we check the listener status ? [TBD] --> Ready or Unknown. READY --> Dynamic Registration , UNKNOWN --> Static Registration --> we have the DB details in the listener configuration file and forcing the listener to register the DB details and don't worry about the DB status.

Commands

su - oracle
. oraenv
env | grep ORA
ps -ef|grep tns
ps -ef|grep lreg
sqlplus / as sysdba
telnet host 1521
netstats -anp | grep 1521
ps -ef|grep smon
startup
sqlplus user/password
sqlplus user/password@"(DESCRIPTION ...)
select instance_name from v$instance;
show user;
sqlplus user/password@alias_name;

Issues

  1. Firewall Issues.
  2. Listener may be wrong.
  3. Port may be wrong.
  4. Listener may be down.

Questions

  1. Can we setup a secured listener ? This can be done at the Protocol parameter.
  2. what is the difference between SID or service name ?
  3. TNS_ADMIN --> location of the network configuration files.
  4. What are the network configuration files ?

listener.ora
tnsnames.ora
sqlnet.ora

  1. Client software's like Oracle Client download , netca , netmgr , OEM , JDBC , ODBC , toad app , sql developer , linux , windows etc

Image description

Image description

  1. Backup & Recovery software's --> rubrik , Tivoli Storage Manager database - IBM.

Reference

https://docs.oracle.com/en/database/oracle/oracle-database/19/netrf/parameters-for-the-sqlnet.ora.html

https://www.oracle.com/in/database/technologies/instant-client/downloads.html

Top comments (0)