SQL*Plus User's Guide and Reference

Contents Index Home Previous Next

Connecting to a Remote Database

Many large installations run Oracle on more than one computer. Such computers are often connected in a network, which permits programs on different computers to exchange data rapidly and efficiently. Networked computers can be physically near each other, or can be separated by large distances and connected by telecommunication links.

Databases on other computers or databases on your host computer other than your default database are called remote databases. You can access remote databases if the desired database has SQL*Net and both databases have compatible network drivers.

You can connect to a remote database in one of two ways:

Connecting to a Remote Database from within SQL*Plus

To connect to a remote database using CONNECT, include a SQL*Net database specification in the CONNECT command in one of the following forms (the username and password you enter must be valid for the database to which you wish to connect):

SQL*Plus prompts you for a password as needed, and connects you to the specified database. This database becomes the default database until you CONNECT again to another database, DISCONNECT, or leave SQL*Plus.

When you connect to a remote database in this manner, you can use the complete range of SQL and SQL*Plus commands and PL/SQL blocks on the database.

The exact string you enter for the database specification depends upon the SQL*Net protocol your computer uses. For more information, see CONNECT[*] and the SQL*Net manual appropriate for your protocol, or contact your DBA.

Connecting to a Remote Database as You Start SQL*Plus

To connect to a remote database when you start SQL*Plus, include the SQL*Net database specification in your SQLPLUS command in one of the following forms:

You must use a username and password valid for the remote database and substitute the appropriate database specification for the remote database. SQL*Plus prompts you for username and password as needed, starts SQL*Plus, and connects you to the specified database. This database becomes the default database until you CONNECT to another database, DISCONNECT, or leave SQL*Plus.

Once again, you can manipulate tables in the remote database directly after you connect in this manner.

Note: Do not confuse the @ symbol of the connect string with the @ command used to run a command file.


Contents Index Home Previous Next