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. 乐固加固后windows下实现给apk签名

    遇到了这样一个问题:我们已经在centos下签名生成好的apk,拿到腾讯乐固上加固以后,签名没有了,就需要重新签名,我乐滋滋的想,既然原来是在centos下签名的,那再去centos上签名一次就好了, ...

  2. 过拟合VS欠拟合、偏差VS方差

    1. 过拟合 欠拟合 过拟合:在训练集(training set)上表现好,但是在测试集上效果差,也就是说在已知的数据集合中非常好,但是在添加一些新的数据进来训练效果就会差很多,造成这样的原因是考虑影 ...

  3. XML反序列化遇到数字型节点值为空导致反序列化异常

    实体类: [XmlRoot("stream")] public class _30320DuisiFukuanQueryResponseModel : ResponseModelB ...

  4. 突然pom.xml中引用的jar包出错。

    在你的本地仓库中,用window搜索包含.lastupdated的文件,全部删除!然后再去项目上maven ------update project

  5. C# - 匿名对象取值

    在new出匿名对象的函数内可以直接调用该匿名对象的属性取值. 可是在其它函数就无法调用匿名对象的属性或方法. 这时,我们可以通过c#的反射机制取值: 文章出处:https://www.cnblogs. ...

  6. Abp项目构建、swagger及代码生成器

    前段时间在学习abp,在配置swagger时踩了不少坑,特此整理一下,方便同行参考.幸运的是又发现了神奇的代码生成器,分享下亲身经验. 觉得此博客非常有用的朋友可以在右侧赞助打赏下,非常感谢大家支持. ...

  7. Nginx常用功能

    3.Nginx常用功能 3.1 反向代理服务器 3.1.1.demo2 a.我在tomcat下部署了一个javaweb项目,tomcat安装的服务器IP为:192.168.37.136,部署的项目在t ...

  8. innerText 与 innerHtml的区别

    j基本语法类似: innerHTML/innerText ->给除了表单元素的标签赋值内容 document.getElementById("div1").innerHTML ...

  9. 20155228 实验三 敏捷开发与XP实践

    20155228 实验三 敏捷开发与XP实践 实验内容 1. XP基础 2. XP核心实践 3. 相关工具 实验要求 1.没有Linux基础的同学建议先学习<Linux基础入门(新版)>& ...

  10. 宏和函数的区别(一个BUG的总结)

    [1]BUG简单示例代码 主要代码如下: #include <QCoreApplication> #include <QDebug> #define ADD(a, b, c) ...