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”.
2) Select “Create a Pluggable Database”.
3)Select CDB database to create a PDB in.
4)Select “Create pluggable database using PDB file set”.
5) Select example schemas file set under $ORACLE_HOME/assitants/dbca/templates/
6) Specify PDB name and PDB datafiles location.
7)Review the template summary.
8) Start to create PDB of example schemas.
9) PDB creation is complete.
Verify PDB Creation and Connect to Example Schemas
1) Connect to CDB.
$ sqlplus sys as sysdba SQL*Plus: Release 126.96.36.199.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 188.8.131.52.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics, Real Application Testing and Unified Auditing options SQL> select CON_ID,NAME,OPEN_MODE
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.
One thought on “How to Install Example Schemas in 12c by Using Templates and Creating a New PDB”
Reblogged this on WatsupDBAz.