Skip Headers
SQL*Plus® User's Guide and Reference
Release 11.2

Part Number E16604-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

CONNECT

Syntax

CONN[ECT] [{logon | / | proxy} [AS {SYSOPER | SYSDBA | SYSASM}] [edition=value]]

where logon has the syntax:

username[/password] [@connect_identifier]

where proxy has the syntax:

proxyuser[username] [/password] [@connect_identifier]

Note:

The brackets around username in proxy are required syntax, not an indication of an optional term. For example, to connect to scott through proxy user hr with password welcome1.

CONNECT hr[scott]/welcome1

Connects a given username to the Oracle Database. When you run a CONNECT command, the site profile, glogin.sql, and the user profile, login.sql, are executed.

CONNECT does not reprompt for username or password if the initial connection does not succeed.

Warning:

Including your password in plain text is a security risk. You can avoid this risk by omitting the password, and entering it only when the system prompts for it.

To connect to a database using an enterprise user proxy, you must first configure the proxy. For information about configuring an enterprise user proxy, see the Oracle Database Enterprise User Security Administrator's Guide.

Terms

username[/password]

The username and password you use to connect to Oracle Database. If you omit username and password, SQL*Plus prompts you for them. If you enter a slash (/) or enter Return or click Execute when prompted for username, SQL*Plus logs you in using a default logon. See / (slash) for more information.

If you omit only password, SQL*Plus prompts you for password. When prompting, SQL*Plus does not display password on your terminal screen.

See the PASSWORD command for information about changing your password in SQL*Plus.

connect_identifier

An Oracle Net connect identifier. The exact syntax depends on the Oracle Net configuration. For more information, refer to the Oracle Net manual or contact your DBA. SQL*Plus does not prompt for a service name, but uses your default database if you do not include a connect identifier.

edition=value

The value for the Oracle Session Edition. An edition enables two or more versions of an object in a database. It provides a staging area where changed objects can be loaded into the database, compiled, and executed during uptime. This is particularly useful to reduce downtime associated with patching an application. edition=value overrides any edition value specified in the ORA_EDITION environment variable. For more detailed information, see Oracle Database Advanced Application Developer's Guide.

/ (slash)

Represents a default logon using operating system authentication. You cannot enter a connect_identifier if you use a default logon. In a default logon, SQL*Plus typically attempts to log you in using the username OPS$name, where name is your operating system username. See the Oracle Database Administrator's Guide for information about operating system authentication.

In SQL*Plus command line, where applications use password credentials to connect to databases, it is possible to store the credentials in a client-side Oracle wallet. When you configure a client to use the Oracle wallet, applications can use the following syntax to connect to databases that use password authentication:

CONNECT /@database_alias

For information about configuring your client to use secure external password store and for information about managing credentials in it, see the Oracle Database Security Guide.

AS {SYSOPER | SYSDBA | SYSASM}

The AS clause enables privileged connections by users who have been granted SYSOPER, SYSDBA or SYSASM system privileges. You can use any one of these privileged connections with the default logon, /.

For information about system privileges, see the Oracle Database Administrator's Guide.

Usage

CONNECT commits the current transaction to the database, disconnects the current username from Oracle Database, and reconnects with the specified username.

If you log on or connect as a user whose account has expired, SQL*Plus prompts you to change your password before you can connect.

If an account is locked, a message is displayed and connection into that account (as that user) is not permitted until the account is unlocked by your DBA.

For more information about user account management, refer to the CREATE USER, ALTER USER and the CREATE PROFILE commands in the Oracle Database SQL Language Reference.

Examples

To connect across Oracle Net with username HR, to the database known by the Oracle Net alias as FLEETDB, enter

CONNECT HR@FLEETDB

For more information about setting up your password file, refer to the Oracle Database Administrator's Guide.

To connect to an instance on the current node as a privileged user named HR, enter

CONNECT HR AS SYSDBA

To connect to an instance on the current node as a privileged default user, enter

CONNECT / AS SYSDBA

In the last two examples, your default schema becomes SYS.