Вы находитесь на странице: 1из 7

Configure Tnsnames.

ora
The "tnsnames.ora" file contains client side network configuration parameters. It can be
found in the "$ORACLE_HOME/network/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.

How do I generate a tnsnames.ora file to connect to an


Oracle Database
Su oracle
$netca

Click on Local Net Service Name Configuration.

Page 1 of 7

Clink on Add Button

Page 2 of 7

Enter your Database SID

Enter Your Server IP Address or HostName

Page 3 of 7

If you want to test , Click on Yes Perform Test


Otherwise No, Do not test

Page 4 of 7

Enter the Database SID One More time.

Click No

Page 5 of 7

Click Finish Button.

Now Tnsentry Configured for the Respective Database.


Check the tns entry in the below location

Cd $ORACLE_HOME/network/admin
$more tnsnames.ora

PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.105.32.41)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = PROD)
)
)

$ tnsping PROD
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 24-MAY-2007 08:55:13
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias

Page 6 of 7

Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)


(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD)))
OK (10 msec)

Question: I have just finished installing Oracle. I want to update mytnsnames.ora file,
but I cannot find a tnsnames.ora file on my system. I thought the tnsnames.ora file would
be created when I created the database. How do I create the tnsnames.ora?
Answer: The tnsnames.ora is a SQL*Net configuration file that normally resides in the
ORACLE_HOME/network/admin directory. Specifically, thetnsnames.ora defines
databases addresses so that connections can be made to them.
The creation of the database itself will not necessarily create the tnsnames.ora. It is
created along with the sqlnet.ora and listener.ora as part of the network configuration.
Normally, the Network Configuration Assistant (NETCA) is started at the end of the
installation process; however, if NETCA fails or you exit before completing,
the tnsnames.ora and the other files will not be created. Thetnsnames.ora and the other
NETCA created files are not necessary for connecting to the database locally from the
server. They are just for client access, so it is possible for the database to be created
properly and the files not exist. Thetnsnames.ora file is located on both the client and
server systems, but there will be only one tnsnames.ora on each server regardless of how
many database instances exist.

Page 7 of 7

Вам также может понравиться