Oracle Network Configuration

Source: Internet
Author: User
Tags dedicated server

1,OracleNetwork System

For a network application, no matter whether it belongs to B/S or C/S, the model is the same. (1) shows that three processes are involved in this model: the working principle of the server listening process, Server service process, and client process is as follows:

  • First, the server starts the listening process, which listens to user requests on a fixed IP address and port.
  • Second, a user process sends a connection request to the specified IP address and port. If no error is entered, the request will eventually be sent to the listening process of the server over the network.
  • After receiving a user request, the listening process immediately derives a service process, either by creating a new service process or by selecting a service process from an existing Server process pool, the specific method depends on the server configuration.
  • The listening process forwards user requests to the derived service process. At this time, the mission of this listening process is over, and it will go back to listen to other user requests, and no longer participate in subsequent work.
  • After a connection is established between a service process and a user process, the service process starts to process the requests sent by the user process, and returns the results to the user process. The user process ends the connection.
  • Service process, terminate the operation, or return to the process pool, waiting for the next user to request service.

Figure (1)

2Listener(LISTENER)

The Oracle listener is a process running on the database, which is responsible for listening to user connection requests. Every time a user request is received, the listener Process creates a Shadow Process and forwards the user request to the Shadow Process. The Shadow Process continues to complete various commands submitted by the user. Once the listener transfers the user to the Shadow process, even if the task of the listener process is completed, it continues to listen to the request of the next user. Therefore, the listener role is like a man-in-the-middle. It is only responsible for connecting user processes and shadow processes.

3Listener Configuration(LISTENER)

To configure the Oracle server and client, you can use the built-in graphical Oracle Network Manager (Oracle Net Manager) (we strongly recommend that you configure the Oracle server or client with this graphical tool ). In Windows, click Start/Program/Oracle-OraHome92/Configuration and Migration Tools/Net Manager to start the Oracle network Manager tool. In Linux/Unix, run the netmgr command to start the graphical Oracle network Manager, for example, $ netmgr. The following figure shows how to start the Net Manager graph window in Windows:

Figure (2)

1. select the listener item in the tree directory, click "+" on the upper left side to add the listener, and click the listener directory, by default, the added LISTENER name is LISTENER (this name can also be named by any valid character ). Select the name, select "listener location" from the drop-down menu on the right of the window, and click the Add address button. Select "TCP/IP" from the Protocol drop-down option in the Network Address Bar, and enter the host name or IP address in the host text box (if the host is used as the server or as the client, either of the two items is valid. If the host acts as the server and needs to be connected over the network, we recommend that you enter an IP address), enter a number in the port text box, the default value is 1521, you can also customize any valid digital port. The configured listening location is shown as follows:

Figure (3)

Figure (4)

2. Select "Database Service" in the drop-down list on the right of the window and click "add Database. Enter the global database name, such as ORCL, In the displayed database column. Note that the global database name is different from the database SID here. The global database name actually controls the uniqueness of the global database name in the same network segment through the domain name, such as the domain name controller in Windows, for example, enter ORCL.192.168.2.51. Enter the SID, such as ORCL, if you do not enter the Oracle main directory. Shows the complete database service configuration:

Figure (5)

3. Save the preceding configuration. The default setting is enough. The listener works according to the configuration file. This file is called listener. ora, the above operation is actually the file operated, located in the $ ORACLE_HOME/network/admin directory, because the listener only works on the database server, so this file is only required by the server, the client does not need this file. The content of this file is as follows:

# listener.ora Network Configuration File: C:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\listener.ora# Generated by Oracle configuration tools.SID_LIST_LISTENER =  (SID_LIST =        (SID_DESC =      (GLOBAL_DBNAME = ORCL.192.168.2.51)      (SID_NAME = ORCL)    )  )LISTENER =  (DESCRIPTION_LIST =    (DESCRIPTION =      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))    )    (DESCRIPTION =      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.51)(PORT = 1521))    )  )
This file indicates that the listener listens on port 1521 of the IP address 192.168.2.51.

4Local service name(Tnsname)

The connection between the Oracle client and the server is a connection request sent by the client. The server listener checks the client connection request legally. If the connection request is valid, the connection is performed. Otherwise, the connection is rejected.

The local service name is a type of network configuration for the Oracle client, as well as the Oracle Names Server. The common client configuration in Oracle is the local service name. This article describes the configuration based on the local service name.

5, Local service name Configuration(Tnsnames)

The local service name is based on the network configuration of the Oracle client. Therefore, if the client needs to connect to the database server for operations, you need to configure the client, the attached object can be any PC to connect to the database server for operation, or the database server itself. As described earlier, you can use the Net Manager graphical management tool provided by Oracle to configure the Oracle client. Select the service name in (2), and click "+" in the upper left corner. The displayed dialog box is displayed:

Figure (6)

Enter the Net service name, such as myoracle, and click Next. The displayed dialog box is displayed:

Figure (7)

Select TCP/IP (Internet Protocol) and click Next, as shown in:

Figure (8)

Enter the host name and port number. Note that the host name and port number must be the same as the host name and port number configured by the listener on the database server. Click Next, as shown in:

Figure (9)

Select the service name (Oracle8i or later) and enter the service name. The service name here is actually the global database name in the Listener Configuration of the database server. The former must be the same as the latter. The connection type is usually a dedicated server, which depends on the configuration of the database server. If the shared database server is configured, the connection type here must be a shared server, otherwise, we recommend that you select a dedicated server (for more information about the dedicated server, see the relevant documentation ). After configuration, click Next, as shown in:

Figure (10)

If the related services on the database server are started, click the test button to test the connection. By default, Oracle uses scott/tiger users to test connections. Since scott is an example user of Oracle, this user may not be configured for formal business databases or professional Test Databases, therefore, you must change it to a valid user logon before the test is successful. If the connection fails, click "finish" to complete the configuration.

Go back to the main window of Oracle Network Manager (Oracle Net Manager) and save the configuration. By default, you can find the local service name configuration file in the Oracle Installation Directory (for example, C in Windows: /oracle/product/10.2.0/db_1/network/admin/tnsnames. ora, $ ORACLE_HOME/network/admin/tnsnames in Linux/Unix. ora ). The configured local service name is shown as follows:

Figure (11)

The service name in the tree directory can be changed to a service name composed of any valid characters by renaming the menu in the editing menu. Note that the service name cannot contain spaces before it; otherwise, the database server may not be connected.

# tnsnames.ora Network Configuration File: C:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\tnsnames.ora# Generated by Oracle configuration tools.MYORCL =  (DESCRIPTION =    (ADDRESS_LIST =      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.51)(PORT = 1521))    )    (CONNECT_DATA =      (SERVICE_NAME = ORCL.192.168.2.51)    )  )

6, Connect to the Database Server

(1)Start server listener and Database Service

In Linux/Unix, start the listener:

$ Lsnrctl start

Close the listener:

$ Lsnrctl stop

View the listening status:

$ Lsnrctl status

Start the database:

$ Sqlplus/nolog

SQL> conn sys @ myoracle as sysdba -- Here myoracle is the local service name of the client configured earlier

Or

SQL> conn/as sysdba

SQL> startup

In Windows, start the listener:

C: lsnrctl start

Start the Oracle instance service:

C: oradim? A href = "http://game.pchome.net/pcgame" class = "none" title = "cs" rel = "external"> cstartup-sid myoracle

Disable the Oracle instance service:

C: oradim-shutdown-sid myoracle

The above services must be started at the same time before the client can connect to the database. Because the Listener name configured by default is Listener, the above command can start the Listener normally. If the Listener name is another name, such as aListener, you need to start the Listener in the following ways:

In Linux/Unix:

$ Lsnrctl start aListener

Windows:

C: lsnrctl start aListener

(2)Test Database Connection Server

The test methods are diverse. You can perform the test when configuring the local service name or a third-party client tool, such as PL/SQL Developer. the most convenient way is to use the sqlplus tool that comes with Oracle, the following uses sqlplus for testing:

C: sqlplus/nolog

SQL> conn zgh @ myoracle

Connected.

7Troubleshooting methods for client connection to the server

To eliminate the connection problem between the client and the server, first check whether the client configuration is correct (the client configuration must be consistent with the database server listening configuration), and then solve the problem according to the error prompt. The following lists several common connection problems:

1,ORA-12541: TNS:No listener

Obviously, the server listener is not started, and check whether the client IP address or port is entered correctly. Start the listener:

$ Lsnrctl start

Or

C: lsnrctl start

2,ORA-12500: TNS:The listener cannot start the dedicated server process.

For Windows, the Oracle instance service is not started. Start the instance service:

C: oradim-startup-sid myoracle

3,ORA-12535: TNS:Operation timeout

There are many reasons for this problem, but it is mainly related to the network. To solve this problem, first check whether the network between the client and the server is smooth. If the network is connected, check whether the firewalls at both ends have blocked the connection.

4,ORA-12154: TNS:Unable to process service name

Check whether the entered service name is consistent with the configured service name. In addition, pay attention to the generated local service name file (for example, D: oracleora92networkadmin tnsnames in Windows. ora, Linux/Unix/network/admin/tnsnames. the name of the first line of each service in ora cannot contain spaces.

5,ORA-12514: TNS:The listener process cannot parseSERVICE_NAME

Open Net Manager, select the service name, and check whether the service name entered in the service ID column is correct. The service name must be consistent with the global database name configured by the server listener.

6,WindowsStartup listening service prompt cannot find path

You can run the command or start the listener in the service window. The system prompts that the path cannot be found, or the listening service has an exception. Open the registry, enter the HKEY_LOCAL_MACHINE/SYSTEM/Current ControlSet/Services/OracleOraHome92TNSListener item, and check whether the ImagePath string item exists. If not, set the value to D: oracleora92BINTNSLSNR, change the installation path values accordingly. This method is also applicable to Oracle instance Services. In the same way, find the items like HKEY_LOCAL_MACHINE/SYSTEM/Current ControlSet/Services/Oracle ServiceMYORACLE to check whether the ImagePath string item exists. If not, create a new one, set the value to d: oracleora92 binORACLE. exe myoracle.

The above are some common problems for Oracle clients to connect to the server. Of course, it cannot cover all connection exceptions. The key to solving the problem lies in the methods and ideas, rather than having fixed answers to each question.

Related Article

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.