My First Five Minutes with Oracle Database 12c

Jul 3, 2013 / By Rene Antunez

Tags: , ,

As many of you know, Oracle Database 12cR1 was released last week, and it did something that I haven’t seen before from an Oracle database release: it caused a blogging storm. According to Steve Karam a.k.a Oracle Alchemist, in less than a week we have had 91 articles from 47 authors regarding this release. For me, an active member of the community, this is one of the coolest things because you could feel that day how the gates had been lifted. Everyone was trying to give you their take on it and transmit their knowledge to you.

Here are my first impressions on my first 5 minutes of handling Oracle 12c:

You need to get familiar with the words container, PDB (Pluggable Database) and CDB (Container Database). This is how Oracle is tackling the multi-tenant environment, so here are the first things I saw in my first 5 minutes with 12c.

Get used to using the con_name and con_id to identify where you are working in and get to know the meaning of the following table

Value in CON_ID Column Description
0 The data pertains to the entire CDB
1 The data pertains to the root
2 The data pertains to the seed
3 – 254 The data pertains to a PDBEach PDB has its own container ID.
SQL> SHOW CON_NAME

CON_NAME

------------------------------

PDBTEST1

SQL> SHOW CON_ID

CON_ID

------------------------------

3

When creating a user, it is best to use the word container to specify that the user will belong to the current container, instead of across the whole CDB.


SQL> show con_id

CON_ID

------------------------------

3

SQL> CREATE USER test

IDENTIFIED BY test

DEFAULT TABLESPACE users

TEMPORARY TABLESPACE temp

CONTAINER = CURRENT;

User created.

Get used to including in your queries v$database CDB,CON_ID and CON_DBID


SQL> select name,dbid,cdb,con_id,con_dbid from v$database;

NAME DBID CDB CON_ID CON_DBID
--------- ---------- --- ---------- ----------
TEST 2117570486 YES 0 2117570486

When you create a Pluggable database CDB, you define a Seed for your future PDB’s, so now creating a new Pluggable Database is as easy as pie. Just be sure to have either OMF or PDB_FILE_NAME_CONVERT defined.

SQL> alter system set PDB_FILE_NAME_CONVERT ='/u01/oracle/oradata/test/pdbseed/','/u01/oracle/oradata/test/testpdb/' scope=both;

System altered.

SQL> CREATE PLUGGABLE DATABASE TESTPDB ADMIN USER TESTADMIN IDENTIFIED BY TESTADMIN ROLES=(DBA);

Pluggable database created.

Get used to opening and shutting down your pluggable databases with this new command.

SQL> SELECT NAME,OPEN_MODE FROM GV$PDBS WHERE CON_ID > 2;

NAME OPEN_MODE
------------------------------ ----------
TESTPDB MOUNTED

SQL> ALTER PLUGGABLE DATABASE testpdb OPEN READ WRITE;

Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE FROM GV$PDBS WHERE CON_ID > 2;

NAME OPEN_MODE
------------------------------ ----------
TESTPDB READ WRITE

SQL> ALTER PLUGGABLE DATABASE testpdb CLOSE IMMEDIATE;

Pluggable database altered.

SQL> SELECT NAME,OPEN_MODE FROM GV$PDBS WHERE CON_ID > 2;

NAME OPEN_MODE
------------------------------ ----------
TESTPDB MOUNTED

Get used to using the catcon.pl perl script for running your $ORACLE_HOME/rdbms/admin scripts.

[oracle@oracleenespanol trace]$ cd $ORACLE_HOME/rdbms/admin/
[oracle@oracleenespanol admin]$ perl catcon.pl -u SYS -d $ORACLE_HOME/rdbms/admin -b catblock_output catblock.sql
Enter Password: oracle

[oracle@oracleenespanol admin]$ perl catcon.pl -u SYS -d $ORACLE_HOME/rdbms/admin -b catblock_output -l /tmp catblock.sql
Enter Password: oracle

[oracle@oracleenespanol admin]$ ls -ltr /tmp/catblock_output*
-rw-r--r--. 1 oracle oinstall 3487 Jul 2 21:45 /tmp/catblock_output0.log
-rw-r--r--. 1 oracle oinstall 2020 Jul 2 21:45 /tmp/catblock_output1.log

[oracle@oracleenespanol ~]$ cat /tmp/catblock_output1.log

SQL*Plus: Release 12.1.0.1.0 Production on Tue Jul 2 21:45:02 2013

Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> Connected.
SQL> 2
Session altered.

SQL> 2
Session altered.

SQL> 2
Session altered.

SQL> 2
Session altered.

SQL> SQL>
SQL> Connected.
SQL> 2
Session altered.

SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> SQL> 2
Session altered.

SQL> 2
Session altered.

SQL> 2
NOW_CONNECTED_TO
--------------------------------------------------------------------------------
==== Current Container = TESTPDB ====

SQL> 2
CATCONSECTION
-----------------------------------
==== CATCON EXEC IN CONTAINERS ====

SQL> 2
BEGIN_RUNNING
--------------------------------------------------------------------------------
==== @/u01/oracle/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catblock.sql ==
==
SQL> 2
Session altered.

SQL> 2
Session altered.

SQL>
View created.
Synonym created.
Grant succeeded.

drop synonym DBA_LOCKS
 *
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist
drop view DBA_LOCKS
*
ERROR at line 1:
ORA-00942: table or view does not exist

 

View created.
Synonym created.
Grant succeeded.
Synonym created.
View created.
Synonym created.
Grant succeeded.
View created.
Synonym created.
Grant succeeded.
View created.
Synonym created.
Grant succeeded.
View created.
Synonym created.
Grant succeeded.
View created.
Synonym created.
Grant succeeded.

SQL> 2
END_RUNNING
--------------------------------------------------------------------------------
==== @/u01/oracle/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catblock.sql ==
==
SQL> SQL>
SQL> SQL>
SQL> ========== PROCESS ENDED SUCCESSFULLY ==========
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

These are just a couple of things that you need to get used to when you are managing an Oracle 12c Database, so start reading the official  documentation to learn how to manage your 12c Database. Don’t forget to read and create your blog entries for your experiences with this new release.

2 Responses to “My First Five Minutes with Oracle Database 12c”

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>