Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle12c solves plsql login CDB and PDB problems

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

I have nothing to do today. I installed oracle12c on win10, thinking that it can be operated normally. During the installation, there is a check box that is created as a container database. Although I don't know what it means, I checked it.

Later, when logging in using plsql, I found that there were no scott users, what? Did 12c cancel scott users? The Internet turned around and found that the original 12c introduced the concept of CDB and PDB, the specific content can be understood on its own, and then explained in detail here. The problem now is that the database I normally connect to is CDB, but scott users are under PDB, and I don't want to re-create scott users and related tables under CDB, so I try to understand how to log in to PDB directly with plsql. The online method is basically to switch between CDB and PDB under sqlplus. I tried the online method:

1. Add to the tns file

PDBORCL =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = pdborcl.microdone.cn)

)

)

two。 Go to sqlplus to execute alter session set container = PDBORCL; and then log in to sqlplus to find scott users, but we must use plsql more frequently. Plsql login will report an error: ORA-12514: TNS: the listener currently does not recognize the service requested in the connection descriptor. In accordance with the method said on the Internet, thank a trigger, let pdb automatically open: CREATE OR REPLACE TRIGGER open_all_pdbs AFTER STARTUP ON DATABASE BEGIN EXECUTE IMMEDIATE 'alter pluggable database all open'; END open_all_pdbs; login or report 12514, all right, let's see if this error can be solved.

So the cmd window checks the monitoring status, and the lsnrctl status result is that there is no pdborcl monitoring. What should I do? Continue to look for answers, and finally found that when I installed the database, the global database name used the form of database name + domain name, such as mine is orcl.microdone.cn, but the pdborcl I added is pdborcl, so it is also changed to pdborcl.microdone.cn, and finally log in with plsql, perfect, perfect login, query scott users, found! Then I also deleted the trigger, there is no problem logging in to pdb, indicating that the direct cause is still the problem of tns configuration. Conclusion: I was inspired by http://www.itpub.net/thread-1847024-1-1.html this article. Personally, I think the ultimate reason is when building an instance. The global db name of CDB uses the form of db name+domain, while the global db name of PDB uses db name. As a result, only db name is used when adding tns configuration, and domain should be added. But the article said to configure the listener.ora file, I do not have the configuration, or the original configuration, whether the need to configure here is not very clear, we will study later. SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = C:\ app\ oracle12c\ product\ 12.1.0\ dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:C:\ app\ oracle12c\ product\ 12.1.0\ dbhome_1\ bin\ oraclr12.dll") LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521)) (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report