oracle pdb模式創建用戶連接


1.用sys用戶登錄orcl;
查詢pdb
show pdbs;

 

2.打開指定pdb
alter pluggable database PDBNAME open ;
 
3.這里修改tnsname.ora這個文件,添加一個pdb的記錄,就可以連接pdb:
 
# tnsnames.ora Network Configuration File: D:\app\yrh\virtual\product\12.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
 
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
 
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
 
 
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
 
#cdb
MYORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
# (SERVER = DEDICATED) #我的文件中這一行加上會報錯
(SERVICE_NAME = orcl) #cdb的db_name
)
)
 
#pdb 這里主要是加上pdb的記錄
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
# (SERVER = DEDICATED) #我的文件中這一行加上會報錯
(SERVICE_NAME = orclpdb) #與查詢的pdb對應
)
)
 
4.SQL> create user yrhtest identified by ******;
 
用戶已創建。
 
SQL> grant connect to yrhtest;
 
授權成功。
 
SQL> conn yrhtest/******@ orclpdb; #用創建的pdb記錄進行連接
已連接。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM