1

I just installed Oracle 12c and I'm trying to connect to the default HR database.

When I open a command prompt and type connect hr/hr@pdborcl; I get the following:

ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0

To connect to HR, I have to do this first:

connect / as sysdba;

alter pluggable database all open;

Only then can I run hr/hr@pdborcl; and connect successfully

This is a bit of a pain... having to connect as sysdba and alter the database just to connect. Is there a better way?

As a side note, all of this is on my development laptop. I don't keep Oracle running when it's not needed as that's a waste of CPU and RAM.

1 Answer 1

0

Check out this from Oracle-Base about starting and stopping pluggable DBs.

First, they provide a trigger to auto-start your PDB:

CREATE OR REPLACE TRIGGER open_pdbs 
  AFTER STARTUP ON DATABASE 
BEGIN 
   EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN'; 
END open_pdbs;
/

And from Oracle 12.1.0.2 onward, we have this command to have Oracle restart the pluggable DB in whatever state it was in at that time (so open the PDBs then run this for each):

ALTER PLUGGABLE DATABASE pdb1 SAVE STATE;

But see the link for full details on both examples.

1
  • I use this trigger in my environments.
    – CaM
    Commented Feb 14, 2017 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.