错误:ORA-65096:oracle 中的通用用户名或角色名无效

2021-12-06 00:00:00 oracle12c oracle

我刚刚安装了 Oracle,但缺少 Scott 架构.所以我想自己生成它.我得到了 Scott 模式的 sql 脚本,但是当我尝试运行查询时:

I just installed Oracle, and it was missing the Scott schema. So i am trying to generate it myself. I got the sql script of Scott schema, but when i try to run the query:

create user Scott identified by tiger; 

它显示以下错误:

ORA-65096:oracle 中的通用用户名或角色名无效.

ORA-65096: invalid common user or role name in oracle.

基本上它不允许我创建用户 Scott.

Basically it is not allowing me to create a user Scott.

这是为什么,我该如何解决我的问题?

Why is that, and how can I fix my problem?

推荐答案

99.9% 的错误 ORA-65096: invalid common user or role name 意味着您在登录 CDB 时应该登录到 PDB.例如,如果您使用默认的 19c 安装设置,您应该登录 ORCLPDB(PDB)而不是 ORCL(CDB).

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. For example, if you used the default 19c installation settings, you should login to ORCLPDB (the PDB) instead of ORCL (the CDB).

危险 - 如果您坚持以错误的方式创建用户,请按照以下步骤操作.

DANGER - If you insist on creating users the wrong way, follow the steps below.

像这样设置未记录的参数(如前导下划线所示)只能在 Oracle Support 的指导下完成.在没有此类指导的情况下更改此类参数可能会使您的支持合同无效.因此,请自行承担风险.

Setting undocumented parameters like this (as indicated by the leading underscore) should only be done under the direction of Oracle Support. Changing such parameters without such guidance may invalidate your support contract. So do this at your own risk.

具体来说,如果您设置 "_ORACLE_SCRIPT"=true,则将在 ORACLE_MAINTAINED 列设置为Y"的情况下进行一些数据字典更改.这些用户和对象将被错误地从某些 DBA 脚本中排除.并且它们可能被错误地包含在某些系统脚本中.

Specifically, if you set "_ORACLE_SCRIPT"=true, some data dictionary changes will be made with the column ORACLE_MAINTAINED set to 'Y'. Those users and objects will be incorrectly excluded from some DBA scripts. And they may be incorrectly included in some system scripts.

如果您对上述风险没有问题,并且不想以正确的方式创建普通用户,请在创建用户之前运行此命令:

If you are OK with the above risks, and don't want to create common users the correct way, run this command before creating the user:

alter session set "_ORACLE_SCRIPT"=true;  

我在这里找到了答案

相关文章