contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = xifenfei)(PORT
= 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdb1)))OK
(20 msec)[oracle@xifenfei
~]$ sqlplus sys/xifenfei@pdb1 as
sysdba SQL*Plus:
Release 12.1.0.1.0 Production on
Sun May 12 08:08:02 2013 Copyright
(c) 1982, 2013, Oracle. All
rights reserved. Connected
to:Oracle
Database
12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith
the Partitioning, Automatic Storage Management, OLAP, Advanced Analyticsand
Real
Application Testing options SQL>
show con_name; CON_NAME------------------------------PDB1 [oracle@xifenfei
~]$ sqlplus / as
sysdba SQL*Plus:
Release 12.1.0.1.0 Production on
Sun May 12 08:09:14 2013 Copyright
(c) 1982, 2013, Oracle. All
rights reserved. Connected
to:Oracle
Database
12c Enterprise Edition Release 12.1.0.1.0 - 64bit ProductionWith
the Partitioning, Automatic Storage Management, OLAP, Advanced Analyticsand
Real
Application Testing options SQL>
alter
session set
container=pdb1; Session
altered. SQL>
show con_name; CON_NAME------------------------------PDB1
pdb可以通过alter session container进入也可以直接通过tns方式登录
创建用户
SQL>
show con_name; CON_NAME------------------------------CDB$ROOT SQL>
select
con_id,dbid,NAME,OPEN_MODE
from
v$pdbs; CON_ID
DBID NAME
OPEN_MODE----------
---------- ------------------------------ ---------- 2
4048821679 PDB$SEED READ
ONLY 3
3313918585 PDB1 READ
WRITE 4
3872456618 PDB2 MOUNTED SQL>
create
user
xff identified by
xifenfei;create
user
xff identified by
xifenfei *ERROR
at
line 1:ORA-65096:
invalid common user
or
role name SQL>
!oerr ora 6509665096,
00000, "invalid
common user or role name"//
*Cause: An attempt was made to
create
a common user
or
role with
a name//
that wass not
valid for
common users or
roles. In
addition to//
the usual rules for
user
and
role names, common user
and
role //
names must start with
C## or
c## and
consist only
of
ASCII //
characters.//
*Action:
Specify a valid common user
or
role name.// SQL>
create
user
c##xff identified by
xifenfei; User
created. SQL>
SELECT
USERNAME,CON_ID,USER_ID FROM
CDB_USERS WHERE
USERNAME='C##XFF'; USERNAME
CON_ID USER_ID----------
---------- ----------C##XFF
1 103C##XFF
3 104 SQL>
alter
session set
container=pdb1; Session
altered. SQL>
show con_name CON_NAME------------------------------PDB1SQL>
create
user
xff identified by
xifenfei; User
created. SQL>
create
user
c##abc identified by
xifenfei;create
user
c##abc identified by
xifenfei *ERROR
at
line 1:ORA-65094:
invalid local
user
or
role name