Oracle 12c创建用户时出现“ORA-65096: invalid common user or role name”的错误

在oracle中,引入了多租户概念,以前是一个instance对应一个database(单实例),或者多个instance对应一个database(RAC),现在一个实例可以对应多个database了,除了这个CDB(Container Database):数据库容器之外,还可以有很多个PD(Pluggable Database):可插拔数据库(一般来说大部分都是一个居多,测试环境除外),所有的操作都必须在特定的database之下,CDB只是维护了instance全局的数据字典。所以,需要切换到特定的上下文才能操作。

查看当前session所在的上下文:

查看所有的pdb也可以通过show pdbs:

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

SQL> show pdbs;

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
SQL>

切换PDB:

登录的时候指定PDB:

查看当前pdb:

SQL> show con_name;

CON_NAME
------------------------------
ORCLPDB

连接到PDB

当创建pdb之后,使用lsnrctl status命令可以看到多了一个以pdb为名的service,如下:

对于连接到PDB,只要指定service_name即可。

JDBC连接注意:

jdbc:oracle:thin:@//<host>:<port>/ServiceName,连接PDB就要使用这种。

jdbc:oracle:thin:@<host>:<port>:<SID>

可插接式数据库(PDB) 自动启动(这很重要,否则每次还要切换很麻烦)

默认情况下,在CDB 启动的时候,all 的PDB 都是mount状态。我们可以通过触发器来实现pdbs随cdb自动启动
[oracle@12c01 ~]$ sqlplus / as sysdba
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT
SQL>
CREATE OR REPLACE TRIGGER open_pdbs
AFTER STARTUP ON DATABASE
BEGIN
EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END open_pdbs;
/
Trigger created.

验证 PDB 自动启动:
SQL> startup;
SQL> show pdbs

CON_ID CON_NAME  OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED  READ ONLY  NO
3 PDB01  READ WRITE NO

12C cdb/pdb 配置监听

有时候动态注册不上,可以考虑静态注册:

接下来使用SID_LIST_LISTENER来进行静态注册服务。
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC =
(GLOBAL_DBNAME = ora12c) #该服务是我配置的cdb信息
(SID_NAME = ora12c)
) (SID_DESC =
(GLOBAL_DBNAME = pdborcl)#该服务是我配置的pdb信息
(SID_NAME = ora12c)
)
)
pl/sql developer连接Oracle 12c R2 PDB报错ORA-28040/ORA-01017  invalid username/password; logon denied
今日测试升到18c之后出现,我本机没有问题,经查只有11.2.0.3及以上的版本的客户端才能连接12.2版本的服务端。
Client
Version
Server Version
12.2.0#10 12.1.0 11.2.0 11.1.0 10.2.0 10.1.0 9.2.0
12.2.0 Yes Yes Yes No No No#3 No#3
12.1.0 Yes Yes Yes Was MDS #7 No#3 No#3
11.2.0 Yes#9 Yes Yes Was MDS #7 No Was #5
11.1.0 No Was Was Was Was #7 Was #6 Was #5
10.2.0 No MDS #7 MDS #7 Was #7 MDS Was Was #5
10.1.0#4 No No Was #6 Was #6 Was Was Was
9.2.0 No No#8 Was #5 Was #5 Was #5 Was Was

Key:

Yes Supported
ES Supported but fixes only possible for customers with Extended Support .
LES or MDS Supported but fixes only possible for customer with a valid Limited Extended Support or Market-Driven Support contract respectively.
Was Was a supported combination but one of the releases is no longer covered by any of Premier Support, Primary Error Correct support, Extended Support, nor Extended Maintenance Support. Fixes are no longer possible.
No Has never been Supported

Specific Notes:

#1 - See Note:207319.1#2 - An ORA-3134 error is incorrectly reported if a 10g client tries to connect to an 8.1.7.3 or lower server. See Note:3437884.8 .#3 - An ORA-3134 error is correctly reported when attempting to connect to this version.#4 - There are problems connecting from a 10g client to 8i/9i where one is EBCDIC based. See Note:3564573.8#5 - For connections between 10.2 (or higher) and 9.2 the 9.2 end MUST be at 9.2.0.4 or higher. Connections between 10.2 (or higher) and 9.2.0.1, 9.2.0.2 or 9.2.0.3 have never been supported.#6 - For connections between 11.1 (or higher) database server and 10.1 / 10.2 database server across a database link the 10g end MUST be at 10.1.0.5 / 10.2.0.2 (or higher) respectively in order to use PLSQL between those versions. (This does not apply to normal 11g clients to 10g database server only server to server and a few very specific client products, such as Oracle Forms). See Note:4511371.8 for more details.#7 - For database link connections between 11.1 (or higher) and 10.2 the 10g end MUST be at 10.2.0.2 (or higher) in order to use PLSQL between those versions. See Note:4511371.8 for more details.#8 - Attempting to connect from 9.2 to 12.1 will fail with an "ORA-28040: No matching authentication protocol" error.#9 - 11.2.0.3 or 11.2.0.4 only. We do not support any 11.2 client interoperability with Oracle Database Exadata Express Cloud Service#10 - Includes Oracle Database Exadata Express Cloud Service - see Note:2183770.1 for additional details

General Notes:

    1. For database links between different Oracle versions connections must be supported in BOTH directions in the matrix above.
      eg: As 11.2 -> 10.1 is not supported then database links between these version are not supported in either direction.

    2. Unsupported combinations may appear to work but can encounter errors for particular operations. The fact that they appear to work should not be relied upon - issues on unsupported combinations will not be investigated.

    3. Since new database servers are compatible with a limited set of older OCI clients, it may not be necessary to upgrade the client software when upgrading the database. However, some new features may not work without upgrading the client software. For example, an Oracle 10.2 client is able to connect to an 11.2 database, but is not able to take advantage of newer features such as Client Result Cache (introduced in 11.1).

    4. Oracle Applications , or other Oracle products, may have supported configurations not listed in the matrix above.

    5. The matrix above also applies between different platforms and between 32/64 bit releases of Oracle client / server except where any Oracle platform desupport notice indicates otherwise .

    6. Unix BEQUEATH (BEQ) connections are NOT supported between different releases. eg: Client 10.2 is not supported to make an Oracle Net connection to a 11.2 server using the BEQ protocol adapter regardless of the interoperability support listed above. See Note:364252.1 for more details.

oracle 12c多租户下的日常操作变化的更多相关文章

  1. Oracle 12c多租户架构浅析

    Oracle数据库12c的一大创新即是其采用的多租户架构.对于多租户这项新功能,业内的评价褒贬不一.有的声音认为,这项功能的用处不是特别大,但在某些场景或特定的环境下,多租户依然有它的用处.其最大的用 ...

  2. Oracle 12c 多租户家族(12c 18c 19c)如何在 PDB 中添加 HR 模式

    Oracle 12c 多租户家族(12c [12.2.0.1].18c [12.2.0.2].19c [12.2.0.3])如何在 PDB 中添加模式:19c (19.3) 手工添加示例 HR 用户 ...

  3. PL/SQL Developer 登录 Oracle 12c和Win10下安装Oracle 11g

    安装了Oracle 12c 后使用PL/SQL Developer怎么也不能连接到Oracle 12c.网上找一下,按照fcflying所说的操作成功了,所以做个笔记: 1)安装Oracle 12c ...

  4. Oracle 12c 多租户 CDB 与 PDB 级别 expdb 与 impdb(表、用户、全库)

    Oracle 数据库 12 c 多租户下,如何在容器数据库 (CDB) 和可插拔数据库 (PDB) 中使用 expdb 与 impdp (数据泵) 呢? 我们一起探讨下PDB 下进行表级,用户级别,全 ...

  5. oracle 12c 多租户 pdb 恢复(单个pdb数据文件、非系统pdb表空间、整个pdb数据库)

    环境:数据库版本 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 实验准备:1.-- 数据库归 ...

  6. GoldenGate 12.2抽取Oracle 12c多租户配置过程

    linux下安装12c 重启linux之后,dbca PDB/CDB使用 SQL> select instance_name from v$instance; INSTANCE_NAME --- ...

  7. [转]Oracle 12c多租户特性详解:PDB 的创建、克隆与维护

    转自:http://chuansong.me/n/443660447865 PDB 的创建和访问 在使用 dbca 建库时,创建数据库之前,可以保存一下创建脚本,分析其具体执行过程.以自定义方式创建名 ...

  8. Oracle 12c 多租户在 CDB 中 Plug A PDB,Unplugging A PDB

    Oracle 数据库 12 c 中介绍了多租户选项允许单个容器数据库 (CDB) 来承载多个单独的可插拔数据库 (PDB).本文简单的演示了如何在 CDB 中 Plug A PDB,Unpluggin ...

  9. Oracle 12c 多租户 CDB 与 PDB 备份

    一.  CDB 备份 1.1  只备份CDB 只备份CDB数据库需要具有SYSDBA或SYSBACKUP权限用户连接到CDB的root环境下,执行backupdatabase root命令即可完成对C ...

随机推荐

  1. js计算最大公约数和最小公倍数

    一.计算最大公约数 1.小学时候一般采用质因数分解法,一般使用短除得到结果,下面用一种最初级的方法求最大公约数 function gcd2(a,b){ var result = 1; for(var ...

  2. Hybrid设计--核心交互

    普通网页中跳转使用a标签,这里我们要对跳转进行更多的干预,所以将全站的跳转收口到框架层,用forward去实现.拒绝用a和window.location.如果我想对所有跳转做一个处理,开动画或者对跳转 ...

  3. 关于事件循环机制event loop

    setTimeout(()=> { console.log('settimeout') },100) console.log('开始') console.log('结束') new Promis ...

  4. java基础(一) -语法

    基本语法 编写Java程序时,应注意以下几点: 大小写敏感:Java是大小写敏感的,这就意味着标识符Hello与hello是不同的. 类名:对于所有的类来说,类名的首字母应该大写.如果类名由若干单词组 ...

  5. C#将List<>转换为Json,将DataSet转成List<T>

    转换  参考:https://blog.csdn.net/u011176794/article/details/52670339 参考:https://blog.csdn.net/my98800/ar ...

  6. java.lang.NoClassDefFoundError: org/hibernate/QueryTimeoutException

    在做ssh整合的时候报错:java.lang.NoClassDefFoundError: org/hibernate/QueryTimeoutException org.springframework ...

  7. js控制元素隐藏和显示

    原生: 方法一: document.getElementById("idname").style.visibility="hidden"; document.g ...

  8. Sitecore CMS中删除项目

    如何删除项目以及如何在Sitecore CMS中恢复已删除的项目. 删除项目 有多种方便的方法可以删除Sitecore中的项目. 从功能区 在内容树中选择您要删除的项目. 单击功能区中“主页”选项卡的 ...

  9. sitecore系统教程之体验编辑器中创建一个项目

    您可以使用体验编辑器创建新项目并将其直接插入网页. 注意 如何在Sitecore中创建项目可能会有所不同,具体取决于您拥有的安全角色以及网站的设置方式. 要插入新项目: 在体验编辑器中,导航到要添加新 ...

  10. 获取数据库连接对象Connection

    2018-11-04  19:50:52 开始写 public Connection getConn() {//返回类型为Connection try { Class.forName("co ...