ora-65096解决方案
创建用户命令:
create user newuser identified by newuser;
报错:ORA-65096: invalid common user or role name(公用用户名或角色名无效).
错误原因:
用户想在PDBORCL中创建newuser用户,却未设置会话container到PDB,而在CDB中创建公有用户因无法通过名称或角色验证出错.
1.解决方案一
a.创建用户的时候用户名以c##或者C##开头
命令:create user c##newuser identified by newuser;(此时创建的用户名称在表user$中为: ##newuser),不是我们需要的newuser;
b.在表user$中查找新建的表对应的user#;
命令:select * from user$ t where t.name like '%newuser%';
取出user#的值,这里假设为108;
c.手动将用户名称##newuser修改为newuser;
命令:update user$ set name='newuser' where user#=108;
commit;
d.强制刷新
alter system checkpoint;
alter system flush shared_pool;
d.重新设置密码newuser
alter user newuser identified by newuser;
2.解决方案二(http://blog.itpub.net/29357786/viewspace-1995055/),摘抄如下:
ORA65096的相关处理流程如下:
1、查看数据库CDB名
select name,cdb from v$database;
2、查看数据库PDB名
col pdb_name for a30
select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
select con_id,dbid,NAME,OPEN_MODE from v$pdbs;
3、设置会话PDB指定的容器库
alter session set container=pdborcl;
4、创建PDBORCL库用户
--注意需要先确定数据库中有users表空间、temp临时表空间
create user ajao identified by ajao default tablespace users temporary tablespace temp;
5、授权
grant create user,drop user,alter user,create any view,connect,resource,dba,create session,create any sequence to AJAO;
至此,ORACLE 12C PDB的PDBORCL中创建AJAO用户完成!