解决 ORA-65096: invalid common user or role name问题

在oracle执行:create user tff identified by tff 的
时候报错了:ORA-65096: invalid common user or role name

SQL> create user tff identified by tff;
create user tff identified by tff
ERROR at line 1:
ORA-65096: invalid common user or role name

报错:ORA-65096: invalid common user or role name(公用用户名或角色名无效).

错误原因:用户想在PDBORCL中创建tff用户,却未设置会话container到PDB,而在CDB中创建公有用户因无法通过名称或角色验证出错.

解决方法:
1、查看Oracle 12c的版本

SQL> select * from v$version;
select sys_context ('USERENV', 'CON_NAME') from dual;

解决 ORA-65096: invalid common user or role name问题_第1张图片

2、我们可以通过ALTER SESSION SET CONTAINER 指定其他容器

SQL> alter pluggable database PDB19 open;

image.png
4、查看容器

SQL>select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

image.png
6、查看当前使用容器

SQL>select sys_context ('USERENV', 'CON_NAME') from dual;

image.png
7、创建用户

create user tff identified by tff;
grant dba to tff

解决 ORA-65096: invalid common user or role name问题_第2张图片

以上问题就可以解决了.

你可能感兴趣的:(oracle,数据库)