Sunteți pe pagina 1din 4

MANAGING COMMON USERS , LOCAL USERS

[oracle@DB12c ~]$ sqlplus / as sysdba


SQL*Plus: Release 12.1.0.1.0 Production on Fri Jun 13 21:33:47 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> col username format a20


SQL> select USERNAME,COMMON,CON_ID
2 from cdb_users;
USERNAME COM CON_ID
-------------------- --- ----------
SYS YES 4
SYSTEM YES 4
......
......

SQL> select USERNAME,COMMON,CON_ID


2 from cdb_users where username='SYSTEM';
USERNAME COM CON_ID
-------------------- --- ----------
SYSTEM YES 1
SYSTEM YES 2
SYSTEM YES 5
SYSTEM YES 3
SYSTEM YES 4

SQL> select distinct username from cdb_users


2 where common='YES';
USERNAME
--------------------
MDSYS
SYSTEM
AUDSYS
.....
.....
SQL> select username,con_id
2 from cdb_users where COMMON='NO';
USERNAME CON_ID
-------------------- ----------
LU 3
PDBADMIN 3
SCOTT 5
PDB2_1_ADMIN 4

SQL> create user C##_USER identified by x CONTAINER=ALL;


User created.

SQL> select distinct username from cdb_users


2 where username='C##_USER';
USERNAME
--------------------
C##_USER

SQL> GRANT CREATE SESSION TO c##_user CONTAINER=ALL;


Grant succeeded.

SQL> connect c##_user/x@localhost:1521/pdb1


Connected.

SQL> connect / as sysdba


Connected.

SQL> create user local_user identified by x


2 CONTAINER=CURRENT;
create user local_user identified by x *
ERROR at line 1:
ORA-65049: creation of local user or role is not allowed in CDB$ROOT

SQL> alter user sys identified by oracle_4U;


User altered.
SQL> connect sys/oracle_4U@localhost:1521/pdb1 as sysdba
Connected.

SQL> col username format a25


SQL> select USERNAME,COMMON,CON_ID
from cdb_users;
2
USERNAME COM CON_ID
------------------------- --- ----------
PDBADMIN NO 3
AUDSYS YES 3
.....
.....

SQL> select USERNAME,COMMON from dba_users;


USERNAME COM
------------------------- ---
PDBADMIN NO
AUDSYS YES
......
......

SQL> create user c##_user_pdb2 identified by x


2 CONTAINER=ALL;
create user c##_user_pdb2 identified by x
ERROR at line 1:
ORA-65050: Common DDLs only allowed in CDB$ROOT

SQL> create user local_user_pdb2 identified by x


2 CONTAINER=CURRENT;
User created.

SQL> select USERNAME,COMMON,CON_ID


2 from cdb_users order by username;
USERNAME COM CON_ID
------------------------- --- ----------
ANONYMOUS YES 3
APEX_040200 YES 3
.....
.....
SQL> conn local_user_pdb2/x@localhost:1521/pdb1
Connected.

SQL> conn local_user_pdb2/x@localhost:1521/pdb2_1


ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.

S-ar putea să vă placă și