8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Oracle】ユーザ作ろうとしたら、ORA-65096: invalid common user or role name って怒られたときの解決法

Posted at

解決法

99.9% of the time the error ORA-65096: invalid common user or role name means you are logged into the CDB when you should be logged into a PDB

stack overflowの回答によると、ORA-65096のエラーが出る原因の99.9%がCDBに接続しているかららしい:innocent:
ということで、CDBじゃなくて、PDBに接続してユーザを作る:muscle:

OK
# 今接続しているコンテナ名を確認する(CDBに接続してる状態)
SQL> show con_name;

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

# PDB名を調べる
SQL> select pdb_name from cdb_pdbs;

PDB_NAME
--------------------------------------------------------------------------------------------------------------------------------
ORCLPDB1
PDB$SEED

# PDBに接続する
SQL> alter session set container = ORCLPDB1;

Session altered.

# ユーザを作成する。
SQL> create user qiita identified by password default tablespace USERS temporary tablespace TEMP;

User created.

NG
# 今接続しているコンテナ名を確認する(CDBに接続してる状態)
SQL> show con_name;

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

# CDBに接続してるからユーザ作成しようとすると怒られる。
SQL> create user qiita identified by password default tablespace USERS temporary tablespace TEMP;
create user qiita identified by password default tablespace USERS temporary tablespace TEMP
            *
ERROR at line 1:
ORA-65096: invalid common user or role name

バージョン情報

  • Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0

参考

8
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?