Oracle19C PDB中普通用户可以通过sqlplus scott/tiger连接吗

 

Oracle19C PDB中普通用户可以通过sqlplus scott/tiger连接吗

 

先说结论,目前我还没找到方式。

研究了挺久,通过百度,通过mos上搜索,也想通过触发器来实现,发现都不行。

 

先说sys用户,是可以的。

通过设置ORACLE_PDB_SID这个环境变量,可以实现sys直接登录后连接到指定的PDB上。

复制代码
[oracle@oem13c ~]$ unset ORACLE_PDB_SID
[oracle@oem13c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 21 16:45:20 2023
Version 19.19.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

16:45:20 SYS@oemdb(25)> show con_name

CON_NAME
------------------------------
CDB$ROOT
16:45:23 SYS@oemdb(25)> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
[oracle@oem13c ~]$ export ORACLE_PDB_SID=empdbrepos
[oracle@oem13c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 21 16:45:45 2023
Version 19.19.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

16:45:45 SYS@oemdb(25)> show con_name

CON_NAME
------------------------------
EMPDBREPOS
复制代码

 

 

普通用户则不行会直接报错"ORA-01017: invalid username/password; logon denied"防偷防爬

复制代码
[oracle@oem13c ~]$ export ORACLE_PDB_SID=empdbrepos
[oracle@oem13c ~]$ sqlplus scott/tiger

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 21 16:46:57 2023
Version 19.19.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name: 
复制代码

 

 

 

MOS文档How to Connect to a Pluggable Database (PDB)? (文档 ID 2783729.1)明确提到了,当连接可插入数据库时,无论是本地或者远程,必须始终提供指向到PDB的services有效的连接字符串。

原话如下:

When connecting to a pluggable database, a valid service connection string that points to its service (previously configured and started) MUST always be provided, whether the connection is attempted locally or remotely

复制代码
[oracle@oem13c ~]$ sqlplus scott/tiger@oem13c/empdbrepos

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 21 16:48:04 2023
Version 19.19.0.0.0

Copyright (c) 1982, 2022, Oracle. All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.19.0.0.0

16:48:04 SCOTT@oem13c/empdbrepos(240)>
复制代码

 

 

不知道有没有其他方式可以不通过@connect_str来连接。

posted @   PiscesCanon  阅读(322)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2022-06-21 Oracle关于WINDOW SORT PUSHED RANK一些探究猜想
点击右上角即可分享
微信分享提示