2.10 Accessing Databases
Use the following commands to access and copy data between tables on different databases:
CONN[ECT] [{<logon>| / |proxy} [AS {SYSOPER | SYSDBA | SYSASM}] [edition=value]]
where logon
has the following syntax:
username[/password] [@connect_identifier]
where proxy
has the following syntax:
proxyuser[username] [/password] [@connect_identifier]
Note:
The brackets around username
in proxy
are required syntax.
Connects a given username to the Oracle Database. If you omit connect_identifier
, SQLcl connects you to the default database. If you omit username
and/or password
, SQLcl prompts you for them. CONNECT followed by a slash (/) connects you using a default (OPS$) logon.
When you run a CONNECT
command, the site profile, glogin.sql, and the user profile, login.sql, are processed in that order. CONNECT
does not reprompt for username or password if the initial connection does not succeed.
DISC[ONNECT]
Commits pending changes to the database and logs the current user out of Oracle, but does not exit SQLcl. In SQLcl command line, use EXIT
or QUIT
to log out of Oracle and return control to your computer's operating system.
COPY {FROM database | TO database | FROM database TO database} {APPEND | CREATE | INSERT | REPLACE | APPEND_BYTE | CREATE_BYTE | REPLACE_BYTE} destination_table[(column, column, column, ...)] USING query
where database
has the following syntax:
username[/password]@connect_identifier
Copies data from a query to a table in the same or another database. APPEND
, CREATE
, INSERT
or REPLACE
specifies how COPY
treats the existing copy of the destination table (if it exists). USING query
identifies the source table and determines which rows and columns COPY
copies from it. COPY
supports CHAR
, DATE
, LONG
, NUMBER
and VARCHAR2
datatypes.
PASSW[ORD] [username]
Allows you to change a password without displaying it on an input device.
XQUERY xquery_statement
Allows you to run an XQuery from SQLcl.