Oracle Database 12c : Common User x Local User

In this post I will be showing you how to create an user in the CDB, what are called “Common Users” (users using the COMMON_USER_PREFIX parameter to set the user prefix at creation time) and then afterwards an user in a PDB called TECHDATABASKET , which are the “Local Users”.

1- Creating Common User in a CDB:

SQL> select instance_name, status from v$instance;

INSTANCE_NAME	 STATUS
---------------- ------------
cdb4		 OPEN

SQL> show parameters COMMON_USER_PREFIX

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
common_user_prefix		     string	 C##


SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE USER c##techdatabasket IDENTIFIED BY my_password 
   DEFAULT TABLESPACE USERS
   QUOTA UNLIMITED ON USERS
   CONTAINER = ALL;  2    3    4  

User created.

2- Creating Local User in a PD

SQL> select name from v$pdbs;

NAME
------------------------------
PDB$SEED
PDBCDB4
CDBSEED
CDBSEED2
MIG
NONCDB
TECHDATABASKET
TECHDATABASKET2

8 rows selected.

SQL> alter session set container=TECHDATABASKET;

Session altered.


SQL> CREATE USER techpdb IDENTIFIED BY my_password 
   DEFAULT TABLESPACE USERS
   QUOTA UNLIMITED ON USERS
   CONTAINER = CURRENT;
  2    3    4  
User created.

Neste post estarei mostrando simplificamente como criar um usuário no CBD, o que chamados de “Common Users” (usuários que utilizam o parâmetro COMMON_USER_PREFIX para definir o prefixo do usuário no momento da criação) e posteriormente a criação de um usuário em um PDB chamado TECHDATABASKET, o que chamamos de “Local Users”.

1- Criando o usuário no CDB:

SQL> select instance_name, status from v$instance;

INSTANCE_NAME	 STATUS
---------------- ------------
cdb4		 OPEN

SQL> show parameters COMMON_USER_PREFIX

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
common_user_prefix		     string	 C##


SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE USER c##techdatabasket IDENTIFIED BY my_password 
   DEFAULT TABLESPACE USERS
   QUOTA UNLIMITED ON USERS
   CONTAINER = ALL;  2    3    4  

User created.

2- Criando um usuário local no PDB:

SQL> select name from v$pdbs;

NAME
------------------------------
PDB$SEED
PDBCDB4
CDBSEED
CDBSEED2
MIG
NONCDB
TECHDATABASKET
TECHDATABASKET2

8 rows selected.

SQL> alter session set container=TECHDATABASKET;

Session altered.


SQL> CREATE USER techpdb IDENTIFIED BY my_password 
   DEFAULT TABLESPACE USERS
   QUOTA UNLIMITED ON USERS
   CONTAINER = CURRENT;
  2    3    4  
User created.

Related posts

Leave a Comment