Priority of using TNSNAMES. ORA file in ORACLE

Source: Internet
Author: User

ORACLE uses TNSNAMES. for UNIX platforms, ORACLE first looks for the environment variable TNS_ADMIN. If the environment variable exists, it goes to the directory specified by the environment variable to find tnsnames. ora file. Otherwise, go to the $ ORACLE_HOME/network/admin directory and find it. On a WINDOWS platform, if the rule is not met, ORACLE will first find TNSNAMES in the current directory. ORA file. If this file does not exist, search for the TNS_ADMIN environment variable. If the environment variable does not exist, go to $ ORACLE_HOME/network/admin. C: \ Documents and Settings \ htaix> type C: \ oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN \ tnsnames. ora # tnsnames. ora Network Configuration File: c: \ u01 \ oracle \ product \ 11.2.0 \ client_1 \ network \ admin \ tnsnames. ora # Generated by Oracle configuration tools. dev2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.192.30.28) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jtcmdb ))) c: \ Docu Ments and Settings \ htaix> type C: \ tnsnames. oradev2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.192.30.29) (PORT = 1521) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jtcmdb ))) c: \ Documents and Settings \ htaix> note that there is a TNSNAMES under drive C and directory C: \ oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN. ORA file, but the IP address of the HOST is different. One is 10.192.30.29 and the other is 10.192.30.28. Note that the current directory is C: \ Documents ents and Settings \ htaix>. C: \ Documents ents and Settings \ htaix> tnsping dev2 TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0-Production on-2013 16:34:41 Copyright (c) 1997,200 5, Oracle. all rights reserved. used parameter file: c: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ sqlnet. ora has used the TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.192.30.28) (PORT = 1521) (CONNECT_DATA = (SERVE R = DEDICATED) (SERVICE_NAME = jtcmdb) OK (30 ms) You Can See That ORACLEL takes precedence over TNSNAMES in the $ ORACLE_HOME/network/admin directory. ORA (the TNS_ADMIN environment variable is not configured ). Next, I will switch the current path to the C root directory and execute tnsping. C: \ Documents ents and Settings \ htaix> cd c: \ C: \> tnsping dev2 TNS Ping Utility for 32-bit Windows: version 10.2.0.1.0-Production on-2013 16:37:05 Copyright (c) 1997,200 5, Oracle. all rights reserved. used parameter file: c: \ oracle \ product \ 10.2.0 \ db_1 \ network \ admin \ sqlnet. ora has used the TNSNAMES adapter to parse the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.192.30.29) (PORT = 1521) (CONNECT_DA TA = (SERVER = DEDICATED) (SERVICE_NAME = jtcmdb) OK (30 ms) You can see that this IP address is changed to 10.192.30.29, using TNSNAMES. ORA under the C root directory.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.