Pages

Wednesday, November 27, 2013

ORA-65085 - After Converting a Non-PDB to PDB


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:

SQL> alter pluggable database nonpdb close;

And then:

SQL> alter pluggable database nonpdb open read only;

Only problem is I encountered this error:

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

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:


SQL> alter pluggable database nonpdb open read only;

Pluggable database altered.

Easy! (After 16 hours).

Saturday, November 23, 2013

ORA-65149 - Conflicting With Non-Existent DBs


Continuing from my previous post, I was trying to clone a PDB that was originally created through
DBCA, (a non-PDB) and 'converted' into a PDB. Converted in the loosest sense, since it was more
'cloned' into a pluggable database, and plugged in to the root container DB, but for simplicitity's sake we'll just say converted :).

Anyway, just to do a quick recap on the situation thus far:
  • Create database with DBCA. 
  • Convert into PDB. 
  • Plug into CDB. 
  • Try and clone said PDB. 
So without any fancy options on storage, tempfile usage, admin, etc, we'll try and clone using the most minimal (oxymoron?) statement:

SQL> create pluggable database pdb2 from nonpdb;
create pluggable database pdb2 from nonpdb
*
ERROR at line 1:
ORA-65149: PDB name conflicts with existing service name in the CDB or the 
PDB

Huh. That doesn't seem right. Well let's check anyway:

SQL> select name, open_mode from v$pdbs;

NAME                           OPEN_MODE
------------------------------ ----------
PDB$SEED                       READ ONLY
NONPDB                         MOUNTED

Nothing there either. Maybe in oratab?

[oracle@localhost ~]$ more /etc/oratab
...
HOME:/u01/app/oracle/product/12.1.0/dbhome_1:N 
BASEDB:/u01/app/oracle/product/12.1.0/dbhome_1:N
NONPDB:/u01/app/oracle/product/12.1.0/dbhome_1:N

That's weird. Maybe changing the name of the database that we want to create?

SQL> create pluggable database "PDB2" from pdb3;
create pluggable database "PDB2" from pdb3
*
ERROR at line 1:
ORA-65149: PDB name conflicts with existing service name in the CDB or the 
PDB

SQL> create pluggable database "ASDASDASDASD" from pdb3;
create pluggable database "ASDASDASDASD" from pdb3
*
ERROR at line 1:
ORA-65149: PDB name conflicts with existing service name in the CDB or the 
PDB

So something definitely wrong there, I'm pretty sure that's a unique enough database name that it's not
some coincidence that it conflicts with an already existing database and/or service. After finally getting access to Metalink, what do you, know it's a bug listed under Doc ID 1569267.1 with plans to be fixed in 12c R2.