How to Install Example Schemas in 12c by Using Templates and Creating a New PDB

In another post “How to Install Example Schemas in 12c Database?“, It shows detail steps of how to install example schemas manually through SQL command line.

Here we use another way to install example schemas by creating a PDB with example schemas and plug this PDB into a current CDB .

1) Start up DBCA, select “Manage Pluggable Databases”

Capture1

 

2) Select “Create a Pluggable Database”

Capture2

3)Select CDB database to create a PDB in

Capture3

4)select “Create pluggable database using PDB file set”

 

Capture4

5) Select example schemas file set under $ORACLE_HOME/assitants/dbca/templates/

 

Capture5

 

6) Specify PDB name and PDB datafiles location

Capture6   7)Review the template summary

Capture7

8) Start to create PDB of example schemas

Capture8

9) PDB creation is complete

Capture9

 

Verify PDB creation and connect to example schemas

1) connect to CDB

$ sqlplus sys as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Sat Dec 6 22:47:48 2014
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter password: 
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics, Real Application Testing
and Unified Auditing options

SQL> select CON_ID,NAME,OPEN_MODE from v$pdbs where name='PDB_SAMPLES';
CON_ID NAME OPEN_MODE
---------- ------------------------------ ----------
 7 PDB_SAMPLES READ WRITE

2) Create an entry in TNSNAMES.ora for PDB_SAMPLES

PDB_SAMPLES =
 (DESCRIPTION =
 (ADDRESS_LIST =
 (ADDRESS = (PROTOCOL = TCP)(HOST =CDBSERVER)(PORT = 1521))
 )
 (CONNECT_DATA =
 (SERVICE_NAME = pdb_samples)
 )
 )

3) Connect to PDB , unlock example schemas and reset passwords.

SQL> connect sys@pdb_samples as sysdba
Enter password: 
Connected.


SQL> alter user hr account unlock identified by hr;
User altered.

SQL> connect hr/hr@pdb_samples
Connected.

SQL> select table_name from user_tables;

TABLE_NAME
----------------
REGIONS
COUNTRIES
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY

7 rows selected.

 

 

 

Advertisements
This entry was posted in 12c new features and tagged , , , . Bookmark the permalink.

One Response to How to Install Example Schemas in 12c by Using Templates and Creating a New PDB

  1. Bkanth says:

    Reblogged this on WatsupDBAz.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s