Database Reference
In-Depth Information
e xeRCiSe 12.1
Connecting to a CDB Using SQl*Plus
In this exercise, you will connect to an existing CDB on a Windows 7 server and SQL*Plus
at the command line. For this CDB, the database name, Oracle SID, and Oracle net service
name are all
CONT
.
1.
Launch a command-line window:
a.
From the Windows 7 Start menu, search for “CMD,” or press the Windows com-
mand button and the R key simultaneously; then enter
CMD
.
b.
At the
C:\>
prompt, specify an instance identifier (SID), unique to this server and
database domain, for the container database you wish to connect to:
C:\ set ORACLE_SID=CONT
2.
Set the required environment variables.
ORACLE_HOME
is required on some operating
systems:
C:\ set ORACLE_HOME= C:\Oracle\product\12.1.0\dbhome_2
3.
Connect to the root of the CDB specified by the
ORACLE_SID
, with user
SYS
as
SYSDBA
,
using OS authentication. Use the SQL*Plus command
SHOW CON_NAME
to show the
name of the current container for the session:
C:\>sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Fri Nov 29 12:36:18 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing
options
SQL> SHOW USER
USER is "SYS"
SQL> SHOW CON_NAME
CON_NAME
---------
CDB$ROOT
SQL> EXIT
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 -
64bit Production
Search WWH ::
Custom Search