Saturday 14 March 2015

Oracle Network Configuration

Oracle uses three files for network configuration files to connect from one server  to another server remotely. 

1) Listener.ora 
2Tnsnames.ora 
3) Sqlnet.ora 

1) Listener.ora:
The listerner.ora file contains server side network configuration parameters.
 It can be found in the "$ORACLE_HOME/network/admin" directory on the server. Here is an example of a listener.ora file 
.
Eg:
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
      )
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCL.WORLD)
      (ORACLE_HOME = /u01/app/oracle/product/9.2.0)
      (SID_NAME = ORCL)
    )
  )
After the "listener.ora" file is amended the listener should be restarted or reloaded to allow the new configuation to take effect.
1) To know the status of the listener.
]$ lsnrctl status <listener_name>
2) To start the listener.

]$ lsnrctl start <listener_name>  
3) To stop the listener.
]$ lsnrctl stop <listener_name>
2) Tnsnames.ora:
The "tnsnames.ora" file contains client side network configuration parameters. 
It can be found in the "$ORACLE_HOME/network/admin" or "$ORACLE_HOME/net80/admin" directory on the client. This file will also be present on the server if client style connections are used on the server itself. Here is an example of a "tnsnames.ora" file.
Eg:
ORCL.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL.WORLD)
)
                   (or)
                             
Eg:
ORCL.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = ORCL)
)
Sqlnet.ora:
The "sqlnet.ora" file contains client side network configuration parameters. It can be found in the "$ORACLE_HOME/network/admin" or "$ORACLE_HOME/net80/admin" directory on the client. This file will also be present on the server if client style connections are used on the server itself. Here is an example of an "sqlnet.ora" file.
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT_DOMAIN = WORLD
# The following entry is necessary on Windows if OS authentication is required.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
Testing :
Once the files are present in the correct location and amended as necessary the configuration can be tested using SQL*Plus by attempting to connect to the database using the appropriate username (SCOTT), password (TIGER) and service (ORCL).
Eg:
$ sqlplus scott/tiger@orcl

No comments:

Post a Comment