Connect sqlplus to a remote database

Source: Internet
Author: User

********************* *

Method 1: Simple connection. network configuration is not required. It is actually a tnsname. ora file, but only Oracle10g or above is supported.
Command: sqlplus user name/password @ IP Address [: Port]/SERVICE_NAME [as sysdba]
Example: sqlplus sys/pwd @ IP: 1521/test as sysdba
Note: You can omit the input when using the default port 1521.

Method 2: perform network configuration for Oracle9i and earlier versions
2.1 graphical operation: Net configuration assistant --> Local net service name configuration --> Add-> service name-> protocol (select TCP)-> host name-> port-> complete.

2.2 regionalization operation: Edit $ ORACLE_HOME/Network/admin/tnsnames. ora file
test =
(description =
(address_list =
(address = (Protocol = TCP ) (host = ip or host name ) (Port = 1521 )
(CONNECT_DATA =
(SERVICE_NAME = Database Service name)
)
Note: red indicates the modified part.
protoc OL: the protocol for communication between the client and the server, which is generally TCP. You do not need to change the content.
HOST: The name or IP address of the machine on which the database listens. The database listens on the same machine as the database, so when I say that the machine where the database listens is generally the machine where the database is located. In Unix or windows, you can run the hostname command at the command prompt of the machine where the database listens to, or use ipconfig (for Windows) or ifconfig (for UNIX) command to obtain the IP address. Note that, whether using the machine name or IP address, you must ping the Host Name of the machine where the database is listening on the client, otherwise, the host name of the machine where the database listening is located must be added to the hosts file.
port: the port on which the database listens. You can view the listener. ora file on the server or the command of the machine on which the database listens.

Run the lnsrctl status [listener name] command to view the information. The port value must be Port 1 that the database listens on.

Sample.
SERVICE_NAME: on the server side, run the "sqlplus> show parameter SERVICE_NAME" command after logging on to the system.
========================================================== ====================================

How can I ensure that the client machine is connected to the Oracle database? Reference: http://www.cnoug.org/viewthread.php? Tid = 15661
A. Client
1. Install Oracle's Oracle Net Communication Software on the client machine, which is included in the Oracle client software.
2. The sqlnet. ora file is correctly configured.
3. The tnsname. ora file is correctly configured.

B. Server Side
1. Ensure that the listener has enabled lsntctl start
2. Make sure that the database has been started. SQL> startup

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.