Local Service name (Tnsname)
The Oracle client-server connection is a connection request made through the client, a client connection request is legitimately checked by the server-side listener, and the connection is rejected if the connection request is valid.
The local service name is one of the Oracle client network configurations, plus the Oracle name server (Oracle Names server). Oracle's Common client configuration is the local service name, and is primarily based on the local service name configuration.
Oracle Network Connection Configuration Method
Configuring the Oracle Server side and client can be done in their own graphical Oracle Network Manager (Oracle Net Manager) (it is highly recommended to complete the configuration of the Oracle service side or client under this graphical tool). Under Windows, click "Start/program/oracle-orahome92/configuration and Migration Tools/net Manager" to launch the Oracle Network Manager tool, under Linux/unix, Use the Netmgr command to start the graphical Oracle network manager, such as: $ netmgr.
1. Oracle Listener Configuration (LISTENER)
Select the listener in the tree directory, and then click on the upper left "+" button to add listeners, click the Listener directory, the default new listener name is listener (the name can also be named by any legal characters). Select the name, select "Listening Location" in the drop-down option in the right column of the window, and click the Add Address button. Select "TCP/IP" in the Protocol drop-down option in the network address bar that appears, enter the host name or the address in the Host text box (if the host is used as the server as the client, one of the two entries is valid; If the host is a server and requires a network connection, the IP address is recommended), Enter a digital port in the Port text box, which is 1521 by default, or you can customize any valid digital port.
Select "Database Service" in the drop-down option in the right column of the window and click the Add Database button. Enter the global database name in the database column that appears, such as MyOracle. Note that the global database name differs from the database SID, and the global database name actually controls the uniqueness of the global naming of the database within the same network segment, such as the domain controller under Windows, where you can enter myoracle.192.168.1.5. The Oracle home directory can be entered without filling in the SID, such as MyOracle.
Save the above configuration, the default is to find the listening profile under the Oracle installation directory (under Windows such as D:\oracle\ora92\network\admin\listener.ora,linux/unix $ oracle_home/ Network/admin/listerer.ora). At this point, the Oracle server-side listener configuration is complete.
2. Local Service name configuration (tnsnames)
The local service name is based on the Oracle client-side network configuration, so if the client needs to connect to the database server for operation, the client needs to be configured to be attached to any PC that wants to connect to the database server or to the database server itself. As described earlier, the Oracle client configuration can be completed using the graphical management tools Net Manager that comes with Oracle.
If the database server-side related services are started, you can click the Test button to test the connection. Oracle defaults to a test connection through the Scott/tiger user, and since the Scott user is a sample user with Oracle, the user may not be configured for a formal business database or a professional test database, so changing to a valid user login is likely to test successfully. If the test connection here is unsuccessful, it does not matter, first click Finish button to end the configuration.
Go back to the Oracle Network Manager (Oracle Net Manager) main window and save the configuration by default to locate the local Service name profile under the Oracle installation directory (Windows D:\oracle\ora92 \network\admin\ Tnsnames.ora;linux/unix under $ oracle_home/network/admin/tnsnames.ora).
Service naming under the tree directory can be changed to a service name consisting of any legal character by renaming the menu in the Edit menu, note that the service name must not have a space character before it may not connect to the database server.
3. Connect to the database server
(1) Start the server-side listener and database service:
Linux/unix, start listener: $ lsnrctl Start
Shutdown listener: $ lsnrctl Stop
View listening Status: $ LSNRCTL status
Sql>conn [email protected] as SYSDBA--here The myoracle is the client local service name configured previously.
Or
Sql>conn/as SYSDBA
Sql>startup
Under Windows, Start Listener: C:\lsnrctl start
Start Oracle Instance service: C:\oradim-startup-sid myoracle
Turn off Oracle Instance service: C:\oradim-shutdown-sid myoracle
The above services must be started at the same time for the client to connect to the database. Because the default configured listener name is listener, the above command starts the listener normally, and if the listener name is a different name, such as Alistener, it needs to be started in the following ways:
Linux/unix under: $ lsnrctl start Alistener
Under Windows: C:\lsnrctl start Alistener
(2) test the connection to the database server.
There are a variety of testing methods that can be tested with local service names configured above or third-party client tools, such as PL/SQL Developer, and most conveniently with Oracle's own Sqlplus tools, which are tested using Sqlplus:
C:\sqlplus/nolog
Sql>conn [email protected]
is connected.
Client Connection server-side FAQ Troubleshooting Method
To troubleshoot client-to-server connectivity issues, first check that the client configuration is correct (the client configuration must be consistent with the database server-side listener configuration), and then resolve it based on the error. Several common connectivity issues are listed below:
1, ORA-12541:TNS: No listener:
It is obvious that the server-side listener does not start, and check that the client IP address or port is filled in correctly. To start the listener:
$ lsnrctl Start or C:\lsnrctl start
2, ORA-12500:TNS: Listener failed to start the dedicated server process:
For Windows, the Oracle instance service is not started. Start Instance service: C:\oradim-startup-sid myoracle
3, ORA-12535:TNS: Operation timed out:
There are many reasons for this problem, but it is mainly related to the network. To solve this problem, first check whether the network of client and server is unblocked, if the network is connected, check whether the firewall on both sides is blocking the connection.
4, ORA-12154:TNS: Unable to process service name:
Check that the service name entered is consistent with the configured service name. Also note the generated local Service name file (under Windows such as D:\oracle\ora92\network \admin \tnsnames.ora,linux/unix under $oracle_home/network/admin/ Tnsnames.ora) There must be no space in front of the first line service name for each service.
5, ORA-12514:TNS: The listener process cannot resolve the Service_Name open net Manager given in the connection descriptor, check the service name and verify that the service name input is correct in the Service tab. The service name must be the same as the global database name configured by the server-side listener.
6. Start the Listening service prompt under Windows could not find the path:
You cannot find a path by using a command or starting a listener in the Services window, or listen for a service startup exception. Open the registry, enter the Hkey_local_machine/system/current Controlset/services/oracleorahome92tnslistener entry, and see if the ImagePath string entry exists. If not, the setting value is D:\oracle\ora92\BIN\TNSLSNR, and the different installation path setting values are changed accordingly. The same approach applies to Oracle instance services, as above, to find servicemyoracle items like Hkey_local_machine/system/current controlset/services/oracle, See if the ImagePath string entry exists, and if not, create a new set value of D:\oracle\ora92 \binoracle.exe myoracle.
These are some of the common problems with Oracle client connection servers, and certainly not all connection exceptions. The key to solving the problem lies in methods and ideas, not every question has a fixed answer.
This article is from the "focus on Java,linux Technology" blog, please be sure to keep this source http://wuqinglong.blog.51cto.com/9087037/1599178
Basics of Getting Started: An analysis of Oracle Listener installation and configuration