I’m playing around with Oracle’s SQL Developer 4 EA3 and Database 12c. Using SQL Dev, I quickly created a Pluggable Database (PDB). I try to open it, and I get this (ORA-01033).
Then I remember reading that the Pluggable Databases don’t open automatically when the database services are started. Well that sucks because now I have to connect using my SYS account in the Container DB and issue the following command:
ALTER PLUGGABLE DATABASE [put your PDB name here] OPEN READ WRITE;
Now I can go back and open a worksheet connected to my PDB. Easy enough right? But I said I was playing around with SQL Developer and DB12c. So how can I not type this in every time I want to connect to my PDB? Simple, put that command in the SQLDev Start-up script. (Thanks +Jeff Smith for your post on the startup script gave me the idea.) For those that don’t know where to go, it’s right here:
Create an .SQL file with the command below:
ALTER PLUGGABLE DATABASE [put your PDB name here] OPEN READ WRITE;
save it, browse to it, and click OK. There you have it. Now you still have to at least connect to the SYS account in the CDB which will execute the Start-up Script, but that’s all. You can now open a connection to your PDB. I tested using a substitution variable, but it yielded some strange results, and I haven’t tried opening multiple PDBs within the start-up script. Maybe I’ll test that out in a later post.