Oracle Client Connection Server Precautions:
1. Through the SQL * NET protocol, Oracle clients generally need to configure SQLNET.ORA and TNSNAMES. ORA.
They default directory in $ oracle_home / network / admin directory
You can also set the environment variable TNS_ADMIN to point to SQLNET.ORA and TNSNAMES. ORA directories you want.
E.g:
TNS_ADMIN = / Home / Oracle / Config / 9.0.1; Export TNS_ADMIN
SQLNET.ORA file determines how to find database server alias
The default parameter is
Names.default_domain = world
Names.directory_Path = (Tnsnames, onames, hostname)
If your Oracle client and server default domain name are different, you need to use ## 号 第一
# Names.default_domain = world
Make it does not work.
Names.directory_path Specifies the order of the server alias (local TNSNAMES.ORA file, named server, host name)
The server's SQLNET.ORA can set the time interval for checking if the client is Alive
SQLNET.EXPIRE_TIME = 10
The details of the database server alias in the TNSNames.ora file have the following ways:
# 一般 写法
Appdb =
(Description =
(Address_list =
(Address = (protocol = TCP) (Host = 192.168.0.35) (port = 1521))))
)
(Connect_data =
(Service_name = appdb)
)
)
# 明 明 标 的 d 方式 的 方式 连接
APPD =
(Description =
(Address = (protocol = TCP) (Host = 192.168.0.35) (port = 1521))))
(Connect_data =
(Service_name = appdb)
(Server = DEDICATED)))))))))
# Connect to multiple Listener ports to connect to a balanced load
Apps =
(Description =
(Address_list =
(Address = (protocol = TCP) (Host = 192.168.0.35) (port = 1521))))
(Address = (protocol = TCP) (Host = 192.168.0.35) (port = 1856)))
)
(Connect_data =
(Service_name = appdb)
)
)
# Note: If the database server uses MTS, the client program needs to use Database Link, it is best to clearly indicate the client's Dedicated direct connection.
# Otherwise encounter a lot of Oracle bugs related to distributed environments.
#Nerstanding that the database server will be better in direct connections unless your real-time database connection is close to 1000.
2. / etc / hosts (unix)
Or Windows / Hosts (Win98) Winnt / System32 / Drivers / etc / Hosts (Win2000)
The client needs to write the correspondence between the database server IP address and the hostname.
127.0.0.1 Localhost
192.168.0.35 OracleDb ORACLEDB
192.168.0.45 Tomcat Tomcat
202.84.10.193 BJ_DB BJ_DB Some we have configured the first step, the TNSPING database server alias is successful,
But SQLPlus Username / Password @ServiceName is not passing, JDBC Thin Link does not pass,
Don't forget to make this step in the client, the reason may be that this server IP address and hostname are set in the DNS server.
If there is a private IP and Internet, there is a public IP, private IP is written in front, and the public IP is written behind.
It is best to leave a backup before editing, and it is best to use copy paste when you add a row to avoid editing the HOSTS time space or TAB character error.
3. Environment of Oracle Multi-Database Under UNIX, the OS client needs to configure the following two environment variables
Oracle_sid = appdb; export oracle_sid
Two_task = appdb; export two_task
To specify the default target database.