Wednesday, August 7, 2013

Create PDB with Sample schemas in DB12c

In Oracle Database 12c, Sample Schemas are delivered in an xml format as a template and at this point only dbca can use it.
This facilitates plugging and un-plugging into a CDB.

Invoke dbca, choose Manage Pluggable Databases.


Click Next to continue


Then select Create a Pluggable Database


Choose among the container database you have installed.


Now choose the option to Create Pluggable Database using PDB File Set.

Browse on Pluggable Database Metadata File and choose sampleschema.xml


Define the name for your Pluggable Database


Review the summary and click Install.


Installation is in progress


SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
PL/SQL Release 12.1.0.1.0 - Production
CORE    12.1.0.1.0      Production
TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
NLSRTL Version 12.1.0.1.0 – Production

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> select pdb_id, pdb_name, status from cdb_pdbs;

    PDB_ID PDB_NAME                  STATUS
---------- ------------------------- -------------
         3 PDB1                      NORMAL
         2 PDB$SEED                  NORMAL
         4 PDB_SAMPLE                NORMAL

SQL> alter session set container=pdb_sample;

Session altered.

SQL> select * from (
  2  select username, account_status from dba_users order by created desc)
  3  where rownum <=7;

USERNAME                  ACCOUNT_STATUS
------------------------- --------------------------------
SCOTT                     EXPIRED & LOCKED
BI                        EXPIRED & LOCKED
SH                        EXPIRED & LOCKED
IX                        EXPIRED & LOCKED
PM                        EXPIRED & LOCKED
OE                        EXPIRED & LOCKED
HR                        EXPIRED & LOCKED

7 rows selected.

2 comments:

  1. HOW TO CONNECT TO HR SCHEMA? PLEASE CONTINUE THE STEPS

    ReplyDelete
    Replies
    1. alter user hr account unlock;
      alter user hr identified by hr;
      conn hr/hr

      Delete