I was playing around with the pluggable databases in 12c, and had just converted a databases that I had created through DBCA to a PDB. And although the official documentation on the steps are pretty comprehensive, I still had to follow a lot of disparate links to get to my goal. So to summarise, the quick and dirty steps I took were:
- Create database nonpdb through DBCA.
- Create the .xml file using DBMS_PDB. This xml file contains a description of the physical structure of the database.
- Shut down nonpdb.
- Plug in the nonpdb database into my root container database, BASEDB.
SQL> create pluggable database NONPDB using '/u02/oradata/nonpdb.xml' nocopy tempfile reuse;
So for all intents and purposes, we now have our database created through DBCA, converted and plugged into the CDB. I then wanted to clone this (now) pdb into another pdb, which required me to put it into read only mode. So no biggie, right?
From our root container database, we just go:
And then:
Only problem is I encountered this error:
Right. Several blogs suggested that they were able to circumvent this by connecting to the PDB itself, doing a shutdown immediate and then doing an open read only from there. I tried it on my server, and no dice.
After a few hours of hair pulling, it turns out I should've read further into the docs. A post-plug script needed to be executed; noncdb_to_pdb.sql. This removes any objects that relates to the database's previous existence as a non-PDB. Apparently this is what was preventing the database from opening read only, as after I had ran the script:
Easy! (After 16 hours).
SQL> alter pluggable database nonpdb close;
SQL> alter pluggable database nonpdb open read only;
SQL> alter pluggable database nonpdb open read only;
alter pluggable database nonpdb open read only
*
ERROR at line 1:
ORA-65085: cannot open pluggable database in read only mode
After a few hours of hair pulling, it turns out I should've read further into the docs. A post-plug script needed to be executed; noncdb_to_pdb.sql. This removes any objects that relates to the database's previous existence as a non-PDB. Apparently this is what was preventing the database from opening read only, as after I had ran the script:
SQL> alter pluggable database nonpdb open read only;
Pluggable database altered.
Thanks really helped...
ReplyDelete