您好,登录后才能下订单哦!
Oracle PDB下本地用户无法使用本地连接的问题
模拟:
1.本地用户本地连接:
SQL> show con_name;
CON_NAME
CDB$ROOT
SQL> alter session set container=pdb1;
Session altered.
SQL> create user test identified by test;
User created.
SQL> grant connect,resource to test;
Grant succeeded.
使用test用户连接:
SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
解决办法:
给该PDB配置tnsname:
查出该PDB的service_name
select name,network_name,pdb from v$services where pdb=’PDB1’;
NAME NETWORK_NAME PDB
pdb1 pdb1 PDB1
tnsname.ora:
pdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.238.14)(PORT = 1529))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pdb1)
)
)
尝试连接:
SQL> alter session set container=pdb1;
SQL> conn test/test
@pdb1;
Connected.
问题解决。
2.公有用户本地连接:
SQL> show con_name
CON_NAME
CDB$ROOT
SQL> create user c##abc identified by c##abc;
SQL> grant connect,resource to c##abc;
进入PDB进行查看该公有用户:
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
2 PDB$SEED READ ONLY NO
3 ABC READ WRITE NO
5 SALESPDB MOUNTED
SQL> alter session set container=abc;
Session altered.
SQL> select username from dba_users where username=’C##ABC’;
USERNAME
C##ABC
SQL> conn c##abc/c##abc
Connected.
可以连接~
结论:
在PDB中创建的本地用户,无法使用本地连接该用户conn name/password
需要使用网络连接该用户conn name/password@tnsname
在CDB中创建的公有用户,会在PDB下自动创建,在PDB中可以使用本地连接该公有用户。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。