A couple of weeks ago, I installed Oracle 12c on my Debian amd64 system. It is pretty easy to do, all you have to do is create a few symlinks that fuck up your 32/64 lib dirs and hack the makefiles ... another story for another blog post.
Today, I would like to talk about Oracle's new CDB & PDB architecture.
SID is Viciously dead, they say, but instance name is not - this is crazy, I need the address of Larry's pharmacist, he must have good stuff.
So, I have an Oracle instance named myinstance, it contains the CDB and a few PDB's.
Now, I connect to Oracle using user sys, I immediately end up in the CDB. Usernames/schemas in a CDB require a silly prefix, WTF, this is not the case in a PDB and it gets worse ...
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
myinstance
So I change to a PDB:
SQL> alter session set container=MyPDB;
Session altered.
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
myinstance
Now, this makes sense, one instance with multiple DB's.
So, Oracle says we are on the same instance as the CDB. When I connect to the instance_name, I will always end up in the CDB .... to reach a PDB, I must connect with the service name, the service name is the name of the PDB, in my case MyPDB.
Now, why, why did they not deprecate connecting with instance_name ?
Always use the service name when you connect to Oracle, this is what they said in the ojdbc drivers for 10g, iirc.
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@//localhost:1521/MyPDB", "scott", "tiger");
However, they removed that recommendation in the 12c jdbc driver docs, do they need help or are they stupid ?
Aucun commentaire:
Enregistrer un commentaire