This method is useful for logging in to native or remote Oracle under CMD command-line windows and PL/SQL landing Oracle. 1, first guarantee on the current host set up
Oracle_homeEnvironment variables: For example: oracle_home=d:\oracle\product\10.2.0\db_2, typically set automatically when an ORACLE client is installed. 2, edit%oracle_home%\network\admin under the
Tnsnames.oraFile, examples are as follows:
MYORCL = (DESCRIPTION = ( address_list = ( ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.130.100) (PORT = 1521))
) (Connect_data = (service_name = ORCL) ) ) localhost= (DESCRIPTION = (address_list = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521 )) (Connect_data = (service_name = ORCL) ) )
The purpose of the file is to resolve the access address when the command line is logged on, and PL/SQL will also read the file by default to connect. MYORCL is an alias, which is used in the command line, and can be defined more than once.
3, the command line landing two ways, (landing this machine and landing remote are the same):
A, the first way:
Sqlplus Username/[email Protected][tnsnames.ora The alias that is already defined in the file]-- do not add a semicolon after
Note that the above format, in addition to sqlplus behind a space, other places do not add spaces. Sqlplus User01/[email protected]--can be landed successfully. Sqlplus User01/[email Protected] Another example of B, the second way:
①sqlplus/nolog--has not landed at this time. do not add semicolons to the back
②conn Username/[email Protected][tnsnames.ora The alias that is already defined in the file]-- do not add a semicolon after
Example: Sqlplus/nolog conn User01/[email protected]
Command line login Oracle (including remote login)