CONNECT

Start a user session.

Syntax:

Connecting from an SQL Prompt:

   CONNECT "username"
   CONNECT "username/password"
   CONNECT "username/password@connect_string"
   CONNECT "username/password@connect_string AS SYSDBA"
   CONNECT / AS SYSDBA

Starting SQL*Plus:

   SQLPLUS  [option] "<username>" [<start>]
   SQLPLUS  [option] "username/password" [<start>]
   SQLPLUS  [option] "username/password@connect_string" [<start>]
   SQLPLUS  [option] "username/password@connect_string AS SYSDBA" [<start>]
   SQLPLUS                     -- Interactive logon
   SQLPLUS /NOLOG [<start>]    -- Don't login to a database
   SQLPLUS -H                  -- Display SQL*Plus Help
   SQLPLUS -V                  -- Display SQL*Plus version

  Options
     "-L"      Attempt log on just once
     "-M <o>"  Use HTML markup options <o>
     "-R <n>"  Use restricted mode <n>
     "-S"      Use silent mode
     /         Login without using TNS (i.e on the server) ORACLE_SID
     /NOLOG    Don't login to a database

  <start>  ::=
      @<filename>[.<ext>] [<parameter> …]
      @<URI>

CONNECT can be abbreviated as CONN
To connect as System Operator rather than DBA, replace SYSDBA with SYSOPER in the syntax above.

Examples

SQL> sqlplus "system/manager@ss64.com"

SQL> sqlplus
SQL> connect "system/manager@ss64.com"

SQL> sqlplus "sys/manager@ss64.com AS SYSDBA"

C:\> Set oracle_sid=ss64
C:\> Set LOCAL=%oracle_sid%
SQL> sqlplus
SQL> connect "system/manager"

Passing a username/password on the command line will (on many operating systems) make the password visible in the list of active processes. To minimise the chance of any third party seeing this, use a here string as follows:

Windows:

@echo off
Set oracle_sid=ss64
Set LOCAL=%oracle_sid%
(
Echo connect system/manager;
Echo @sql_update.sql;
Echo Exit;
) | Sqlplus /nolog

Bash:

#! /bin/bash
ORACLE_SID=ss64
Sqlplus -s /nolog <<eof
Connect system/manager;
@sql_update.sql;
Exit;
eof

“Everything is connected to everything else” - Barry Commoner (Three laws of Ecology)

Related:

COMMIT
DISCONNECT
ROLLBACK
Show user - display the username currently connected
ALTER SYSTEM ENABLE RESTRICTED SESSION
SET TRANSACTION
Editing SQL scripts in SQL*Plus

Related Views:

DBA_PENDING_TRANSACTIONS
USER_RESOURCE_LIMITS
V$SESSION
V$SESSION_CONNECT_INFO
V$SESSION_LONGOPS


© Copyright SS64.com 1999-2013
Some rights reserved