12c之后用户分为公共用户和本地用户
1.添加公共用户
# 公用用户的创建语法
create user c##lhr identified by lhr;
create user c##lhr identified by lhr default tablespace users temporary tablespace temp;
create user c##lhr identified by lhr container=all;
#给公用用户赋权
grant dba to c##lhr container=all;
#连接,可以连接到cdb,也可以连接到pdb
conn C##LHR/lhr@localhost/PDBPROD2.example.com
2.添加本地用户
create user xxt identified by lhr container=current;
grant dba to xxt container=current;
--视图查询
SELECT A.USERNAME,
A.CON_ID,
A.COMMON,
A.DEFAULT_TABLESPACE,
A.TEMPORARY_TABLESPACE
FROM CDB_users a
where a.username = 'XXT';
3.取消12C创建用户”c##”限制
alter system set common_user_prefix='' scope=spfile;
重启数据库