Sqlplus Connecting a remote database Zhou__zhou **************sqlplus connecting a remote database system **********************
Mode one: Simple connection, without network configuration, is actually Tnsname.ora file, but only support oracle10g above.
Command: Sqlplus user name/password @ip address [: Port]/service_name [as SYSDBA]
Example: Sqlplus sys/[email protected]: 1521/test as Sysdba
Note: You can omit the input when using the default 1521 port
Mode two: Network configuration oracle9i and previous versions
2.1 Graphical operations: NET configuration assistant--> Local NET service name configuration--add------service name---Protocol (optional TCP)--complete with port, host name, and so on.
2.2 Textual operations: editing the $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 = service Name of the database)
)
)
Note: Red is the modified part
PROTOCOL: The client and server-side communication protocol, generally TCP, the content is generally not changed.
HOST: The machine name or IP address of the machine on which the database is listening, the database is listening generally to the same machine as the database, so when I say that the database is listening to the machine, it is also the machine where the database is located. Under UNIX or WINDOWS, you can have the hostname command get the machine name by the command prompt on the machine on which the database is listening, or get the IP address through the ipconfig (for WINDOWS) or ifconfig (for UNIX) command. Note that, regardless of the machine name or IP address, the client must ping the database to listen to the machine name on the machine, otherwise you need to add the machine name of the machine on which the database listens in the Hosts file.
Port: The database listens on the port on which it is listening. You can view the server-side Listener.ora file or the command on the machine where the database is listening.
Below the LNSRCTL status [listener name] command. The value of port here must be with the database listening on the port that is listening
Sample.
SERVICE_NAME: On the server side,,sqlplus> show parameter service_name command after logging in with system user.
======================================================================
How do you ensure that the client machine connects to the Oracle database?
A Client
1. Install Oracle's Oracle NET communication software on client machines, which is included in Oracle's client software.
2. Sqlnet.ora files are configured correctly
3. Tnsname.ora files are configured correctly
B Server-side
1. Ensure listener has started lsntctl start
2. Ensure that the database is started. Sql>startup
Sqlplus connecting to a remote database