Oracle Appendix--Connecting Databases

Source: Internet
Author: User
Tags sqlplus

There are three ways to connect to a database, using Oracle's own Sql*plus and Sqldeveloper, and using third-party tools Pl/sqldeveloper.

I. Using Sql*plus to connect to a database

Sql*plus Connection also has three kinds of connection methods, can be divided into two categories, one needs to configure file Tnsnames.ora, another class does not need

1. Command format: sqlplus [Username]/[password] @sid

Use example: Sqlplus scott/[email protected]

This way is the most common way, this way requires configuration files, @sid can not write, do not write the default connection to the local database, and do not write @sid can not turn on the monitoring service.

2. Command format: sqlplus [Username]/[password]@[host]:[port]/[sid]

Use example: Sqlplus scott/[email PROTECTED]:1521/ORCL

This method does not require configuration files, because the connection has been the target of a simple description, where host is the destination server address, can write IP address,

Server name, localhost, and 127.0.0.1,port are the port numbers for the server's listener service.

3. Command format: sqlplus [username]/[password]@ ' (Description= (address_list= (address=) (Protocol=tcp])

(Port=[port]))) (Connect_data= (Service_name=[sid])) '

Use example: Sqlplus scott/[email protected] ' (Description= (address_list= (address=) (PROTOCOL=TCP)

(port=1521))) (Connect_data= (SERVICE_NAME=ORCL))) '

The configuration file is not required in this way, because the configuration information is described in detail in the connection, which is more flexible and cumbersome than the previous approach.

After three ways, you can add as [Sysdba|sysoper], which represents the role of the connected user, but only if the connected user is sys.

Second, connect the database with Sqldeveloper

Sqldeveloper is an Oracle-brought graphical connection tool that can be found within the Start menu-All Programs-->oracle--> application development.

When using Sqldeveloper for the first time, the path to configure Java.exe,java.exe is typically in the Oracle installation directory \product\oracle version \dbhome_1\jdk\bin.

After the configuration is complete, you will be prompted to associate the file type and select the desired.

After opening the Sqldeveloper, right-click on the left tree menu to select New Connection, you can see the New Connection window, the connection information is filled in correctly to connect the database (connection name does not have special provisions,

Can be arbitrarily taken, the role only when the login user is the SYS need to choose, before connecting can test the success of the connection, in the lower left corner will be prompted information.

Third, connect the database using Pl/sqldeveloper

Pl/sqldeveloper is a third-party graphical connection tool that has more features than Sqldeveloper (but charges apply ...). )。

After the installation, directly open to see the login prompt, fill in the login information (the database option is the local service name, as for the role selection as in the previous two ways).

Note that there are three ways to configure the local service name, and the server needs to turn on the listening service to connect (using Sql*plus and not using @).

Oracle Appendix--Connecting Databases

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.