Oracle 12c Create Pluggable Database Example
Select Create Pluggable Database and click on Next to continue...
Specify Sys user credentials then click on Next to continue...
Select Create a new Pluggable Database option then click on Next to continue..
Specify your Pluggable database name and user credentials then click on Next to continue.. I specified hms for my Hospital Management System database application to give you an example:
It will show you the summary of installation, just click on Finish to create Pluggable database and after completion the following screen will appear:
Now your Pluggable database creation is complete and now you need to connect it to do this you must specify its connection information in TNSNAMES.ORA file because this Pluggable database would be consider as a new Oracle database service.
Add the following in your tnsnames.ora file:
HMS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = hms)
)
)
Replace hms, host and port information according to your database and machine information and then save.
Now this pluggable database must be start to connect to it, so log in with Sys user credentials to your database and give the following command:
SQL> Alter Pluggable Database hms open;
After that you can connect as following:
Type Connect and give the credentials:
SQL> conn
Enter user-name: hms/[email protected]
Connected.
SQL>
Now we have connected but our schema is empty because we don't have any objects in it, so we will import a database dump in this Oracle 12c Pluggable database which have been exported from Oracle 11g.
For this user must have proper privileges to do this task, so first we will give admin privileges to hms user to perform import task and for this you have to reconnect using Sys user then give the DBA privilege to hms as following:
SQL> conn
Enter user-name: sys/[email protected] as sysdba
Connected.
SQL> rem set session to hms to access this db from sys
SQL> alter session set container=hms;
Session altered.
SQL> grant dba to hms;
Grant succeeded.
SQL> connect
Enter user-name: hms/[email protected]
Connected.
SQL>
Now you run IMP command to import a database dump file (.dmp) into this hms user, to perform this task do the following:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Â All rights reserved.
C:UsersVinish>IMP USERID=hms/[email protected] file=d:vinishhms14may.dmp full=y
SQL> create user hmsuser1 identified by hmsuser1;
User created.
SQL> grant connect, resource to hmsuser1;
Grant succeeded.