分类: Oracle

oracle 12c 解决pdb中用户无法登录的问题

oracle12c在cdb中只能创建c##或者C##开头的用户,称为Common User,只有在pdb数据库中才能创建我们习惯性命名的用户,oracle称之为Local User,切换到pdb模式以后,创建好用户,已经授权了,但是就是不能登录,老提示账号密码错误,解决方法如下:
先查询pdb的service_name

SQL> select name,pdb from v$services;
NAME                     PDB
-------------------- --------------------
brcpdb.168.121.71        BRCPDB

vim $ORACLE_HOME/network/admin/tnsnames.ora


LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.121.71)(PORT = 1521))


BRCPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.121.71)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = brcpdb.168.121.71)   #把查询到pdb对应的service_name写到这里
    )
  )

保存以后就可以登录了

SQL> conn ysbrc/brcyueworld1017@BRCPDB
Connected.
SQL> show user;
USER is "YSBRC"

客户端也要对应设置。

相关文章

此处评论已关闭