19c RAC : Dynamic Cluster Services

High-availability of database services has been a feature of Oracle Real Application Servers since many versions. Basically, when a database instance fails, a service which has got this instance as a preferred instance, fails over to another available instance.
Unfortunately, the service did not fail back to the original instance as soon as the instance is up again.

The administrator had to relocate the service

OR Needs to configure the fan callout script

You can refer my old blog post – fan-callouts-for-rac

This has changed with Oracle Database 19c.

Starting with Oracle Database release 19.3, if you specify yes for the -failback attribute of a service,
then, after failing over to an available instance when the last preferred instance went down, the service
transfers back to a preferred instance when one becomes available. For earlier releases, you can automate
fail back to the preferred instance by using FAN callouts.

Dynamic Services Fallback Option
For a dynamic database service that is placed using “preferred” and “available” settings,
you can now specify that this service should fall back to a “preferred” instance when it becomes
available if the service failed over to an available instance.

The Dynamic Services Fallback Option allows for more control in placing dynamic database services
and ensures that a given service is available on a preferred instance as long as possible.

#Create serv19c Service inside the acs pluggable database.

srvctl add service -db cdb -pdb acs -service serv19c -preferred cdb1 -available cdb2 -failback YES

#Review the configuration of pdb

-bash-4.2$ srvctl config service -db cdb -service serv19c
Service name: serv19c
Server pool:
Cardinality: 1
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
Failover retries:
Failover delay:
Failover restore: NONE
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name: acs
Hub service:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Failback : true
Replay Initiation Time: 300 seconds
Drain timeout:
Stop option:
Session State Consistency: DYNAMIC
GSM Flags: 0
Service is enabled
Preferred instances: cdb1
Available instances: cdb2
CSS critical: no

#Review the status of service

-bash-4.2$ srvctl status service -db cdb -service serv19c
Service serv19c is not running.

#Starting the service
-bash-4.2$ srvctl start service -db cdb -service serv19c

#Review the status of service

-bash-4.2$ srvctl status service -db cdb -service serv19c
Service serv19c is running on instance(s) cdb1

#From Node1 we will reboot the machine1

#reboot

#From Node2 review the status of service

-bash-4.2$ srvctl status service -db cdb -service serv19c
Service serv19c is running on instance(s) cdb2

#Once Node1 is comes back in Cluster Service are automatically failback. 🙂

-bash-4.2$ srvctl status service -db cdb -service serv19c
Service serv19c is running on instance(s) cdb1

Thank you for visiting this blog.

OCM 12c Preparation for General Database and Network Administration

General Database and Network Administration
Go back to OCM 12c Preparation Project 

Thank you for visiting this blog 🙂

Preparation for Exam : Oracle Cloud Infrastructure 2018 Architect Associate

Below are the self study approach to start learning oracle OCI…

Study Guide for  Oracle Cloud Infrastructure 2018 Architect Associate | 1Z0-932

Chapter 1 Identity and Access Management (IAM) 10%

1.1 Apply core Identity and Access Management components
Users, groups and policies, instance principals and dynamic groups

1.2 Explain resource locations
IAM resource component

1.3 Design federation with various identity providers
ADFS, IDCS, SAML
Active Directory Federation Services
Oracle Identity Cloud Service
Security Assertion Markup Language (SAML) is a standard protocol for web browser Single Sign-On (SSO) using secure tokens.

1.4 Apply IAM, governance, and security best practices
Audit, encryption

Oracle Cloud Infrastructure Identity and Access Management FAQ
https://cloud.oracle.com/cloud-security/identity/faq

Chapter 2 Networking 30%

2.1 Apply design concepts related to VCN components
Including subnets, route tables, security lists,and DNS options

2.2 Describe Public and Private IP addresses and virtual NICs
Reserved Public and Private IP

2.3 Apply VCN connectivity options
Internet gateway, remote peering connections,and local peering gateways, NAT and service gateway

2.4 Understand remote network connectivity
VPN and FastConnect using Dynamic Routing Gateway (DRG), connecting to on-premises
environments

2.5 Apply OCI Load Balancer concepts
Listeners, backend sets, health checks, public and private load balancers, high availability design practices

2.6 Understand OCI Edge services
DNS service and internet intelligence

2.7 Apply OCI networking best practices
Load balancing, VCN peering, VPN, FastConnect, fault tolerance

Oracle Cloud Infrastructure VCN – FAQ
https://cloud.oracle.com/en_US/bare-metal-network/vcn/faq

Chapter 3 Compute 15%

3.1 Understand compute and sizing
Best practices, available OCI shapes, network bandwidth, SLA, NVMe, performance

3.2 Troubleshoot options using console connections and boot volume
Console connection options and boot volume management

3.3 Architect High Availability and Disaster Recovery solutions
Fault domain, availability domains, cross regions

3.4 Describe image options
Oracle provided, customer provided, custom images, BYOI

Oracle Cloud Infrastructure Compute FAQ
https://cloud.oracle.com/compute/faq

Chapter 4 Storage 20%
4.1 Understand OCI Storage options
Storage best practices, storage performance metrics, block volumes, object storage, file storage service

4.2 Designing storage solutions for applications and database
Based on use case, performance, scalability

https://cloud.oracle.com/storage/archive-storage/faq
https://cloud.oracle.com/storage/object-storage/faq
https://cloud.oracle.com/storage/block-volume/faq
https://cloud.oracle.com/storage/file-storage/faq

https://cloud.oracle.com/en_US/storage/data-transfer-disk/faq
https://cloud.oracle.com/en_US/storage/data-transfer-appliance/faq

Chapter 5 Database 25%

5.1 Describe OCI Database options
Best practices, sizing, Autonomous Transaction Processing (ATP), Database
Systems, Autonomous Data Warehouse(ADW)

5.2 Explain OCI Database Operations
Backup/restore, patching and Migration, Data Loading for ATP and ADW

5.3 Architect HA and DR solutions
RAC, Data Guard

5.4 Managing Autonomous Database
ATP, ADW

http://www.oracle.com/technetwork/database/bi-datawarehousing/adw-technical-faq-public-5069016.pdf

 

Training by  Deepak Brahmbhatt

https://www.udemy.com/oracle-cloud-infrastructure-associate-arch-part-i-1z0-932/

https://www.udemy.com/oracle-cloud-infrastructure-associate-arch-part-ii-1z0-932/

Finally I cleared the exam 🙂

My badge 🙂

 

Create and manage pluggable databases 

Go back to OCM 12c Preparation Project

The multitenant option introduced in Oracle Database 12c allows a single container database (CDB) to host multiple separate pluggable databases (PDB). This article covers the various major operations possible with PDBs.

  1. Create a pluggable database
  2. Unplug a pluggable database
  3. Plugin a pluggable database
  4. Clone a pluggable database
  5. Delete a pluggable database
  6. Configure a pluggable database

With GUI there are 4 tools to perform these tasks

1.) Oracle Universal Installer (OUI)
2.) Database Configuration Assistant (DBCA)
3.) SQL Developer
4.) Cloud Control

Without GUI / CLI Method we can use below 2 tools to perform the same tasks

5.) Manual (SQL*Plus)
6.) DBCA Command Line

  1. Oracle Universal Installer (OUI)

OUI1

OUI allows you to create a CDB during the software installation. The “Typical Install Configuration” screen has a checkbox to indicate the database is a container database. You can optionally create a PDB in this screen also.

OUI2

The advanced configuration option provides the same ability on the “Database Identifiers” screen.

DB Identifier

In both cases the creation of a PDB is optional, so you can create an empty container database and create the pluggable database later.

2. Database Configuration Assistant (DBCA)

DBCA gives similar options to the OUI. The “Creation Mode” page allows you to enter the default installation configuration details directly.

creation mode

If you chose the “Advanced Mode” option, you can create a CDB and multiple PBDs in one go.

Advanced Mode

The DBCA includes a new option on the opening “Database Operation” screen that allows you to manage the pluggable databases of an existing container database. Select the “Manage Pluggable Databases” option and click the “Next” button.

Manage PDBs

You can see from the resulting screen what operations are possible with pluggable databases.

PDB Options

The following sections describe some of these options.

Create a Pluggable Database (PDA) using the DBCA

Manage Pluggable Database –> Create a Pluggable Database –> select the container database to house the new pluggable database

Create PDB Using DBCA

PDBs Status Before

Select the “Create a new Pluggable Database” option and click the “Next” button. If you were plugging in a previously unplugged database, you would select the PDB Archive or PDB File Set options to match the format of the files containing the unplugged PDB.

Create PDB Using DBCA_New PDB

Enter the pluggable database name, database location and admin credentials, then click the “Next” button.

Create PDB Using DBCA_New PDB_NAME

Check the summary information, click the “Finish” button.

PDB_CREATION_Summary

Wait while the pluggable database is created. Once complete, click the “OK” button on the message dialog and the “Close” button on the main screen.

PDB_CREATION_Summary_INProgress

The new pluggable database has been created as a clone of the seed database.

PDB_CREATION_Summary_Completed

PDBs Status After

Unplug a Pluggable Database (PDB) using the DBCA

Manage Pluggable Databases –> Unplug a Pluggable Database –> select the container database that houses the pluggable database to be unplugged

unplug_PDB

Select the PDB to unplug, decide whether to use a pluggable database archive or a file set and enter the appropriate location details. Click the “Next” button.

unplug_PDB_Into_PDB_Archive

Check the summary information, click the “Finish” button.

unplug_PDB_Into_PDB_Archive_Summary

Wait while the pluggable database is unplugged. Once complete, click the “OK” button on the message dialog and the “Close” button on the main screen.

unplug_PDB_Into_PDB_Archive_Summary_InPrg

The pluggable database has now been unplugged.

unplug_PDB_Into_PDB_Archive_Summary_Completed

Plugin a Pluggable Database (PDB) using the DBCA

Manage Pluggable Databases–>Create a Pluggable Database–>select the container database to house the new pluggable database.

Plug_PDB_1

Select the “Create Pluggable Database From PDB Archive” or “Create Pluggable Database using PDB File Set” option and enter the location of the required files. You can browse for the files using the “Browse” button.

Plug_PDB_2

Enter the pluggable database name, database location and admin credentials, then click the “Next” button.

Plug_PDB_3

Check the summary information, click the “Finish” button.

Plug_PDB_4

Wait while the pluggable database is created. Once complete, click the “OK” button on the message dialog and the “Close” button on the main screen.

Plug_PDB_5

The pluggable database has been plugged into the container database.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
4 PDB2 READ WRITE NO
5 PDB3 READ WRITE NO

Delete a Pluggable Database (PDB) using the DBCA

Manage Pluggable Databases–>Delete a Pluggable Database–>select the container database that houses the pluggable database

Delete PDB

  • Check the summary information, click the “Finish” button.
  • Wait while the pluggable database is deleted. Once complete, click the “OK” button on the message dialog and the “Close” button on the main screen.
  • The pluggable database has been deleted from the container database.
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
5 PDB3 READ WRITE NO

Configure a Pluggable Database (PDB) using the DBCA

Manage Pluggable Databases–>Configure a Pluggable Database–>select the container database that houses the pluggable database to be configured

Configure_PDB_1.PNG

Select the PDB to configure and click the “Next” button.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 PDB3 READ WRITE NO
SQL>
SQL> select dbms_xdb_config.gethttpsport () from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
0

Select any additional options you would like to configure, then click the “Next” button.

Configure_PDB_2.PNG

  • Check the summary information, click the “Finish” button.
  • Wait while the pluggable database is configured. Once complete, click the “OK” button on the message dialog and the “Close” button on the main screen.

Configure_PDB_3The pluggable database has been configured.

SQL> select dbms_xdb_config.gethttpsport () from dual;

DBMS_XDB_CONFIG.GETHTTPSPORT()
------------------------------
5501

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
5 PDB3 READ WRITE NO

3. SQL Developer

SQL_DEV_Connection.PNG

Open Menu -> View -> DBA

SQL_DEV_PDB

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
5 PDB3 READ WRITE NO

Create Pluggable Database

SQL_DEV_CREATE_PDB

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
4 SD_PDB MOUNTED
5 PDB3 READ WRITE NO

Clone Pluggable Database

SQL_DEV_CLONE_PDB

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
4 SD_PDB READ WRITE NO
5 PDB3 READ WRITE NO
6 NEW_PDB READ WRITE NO

4. Cloud Control

Oracle Cloud Control 12cR3 onward supports pluggable database functionality.

Container database, the “Oracle Database > Control > Open/Close Pluggable Database

29-cloud-control-1

The “Oracle Database > Provision > Provision Pluggable Database

30-cloud-control-2

5. Manual (SQL*Plus)

  • You must be connected to a CDB and the current container must be the root.
  • You must have the CREATE PLUGGABLE DATABASE system privilege.

Create a Pluggable Database (PDB) Manually

To create a new pluggable database from the seed database, all we have to do is tell Oracle where the file should be placed.

There are three methods to tell oracle where the file should be placed.

1. Oracle Managed Files (OMF) 

SQL> show parameter db_create_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string

SQL> create pluggable database pdb1 admin user pdb_adm identified by Oracle_4U;
create pluggable database pdb1 admin user pdb_adm identified by Oracle_4U
*
ERROR at line 1:
ORA-65016: FILE_NAME_CONVERT must be specified

SQL> alter system set db_create_file_dest='/u01/app/oracle/oradata';
System altered.

SQL> create pluggable database pdb1 admin user pdb_adm identified by Oracle_4U;
Pluggable database created.

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
4 SD_PDB READ WRITE NO
5 PDB3 READ WRITE NO
6 NEW_PDB READ WRITE NO
7 PDB1 MOUNTED
SQL> alter pluggable database pdb1 open;

Pluggable database altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
4 SD_PDB READ WRITE NO
5 PDB3 READ WRITE NO
6 NEW_PDB READ WRITE NO
7 PDB1 READ WRITE NO

2. OMF location for the new PDB using CREATE_FILE_DEST clause onwards 12.1.0.2

SQL> alter system set db_create_file_dest='';
System altered.

SQL> show parameter db_create_file_dest
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string

SQL> CREATE PLUGGABLE DATABASE PDB2 ADMIN USER PDB2_ADM IDENTIFIED BY Oracle_4U
2 CREATE_FILE_DEST='/u01/app/oracle/oradata';
Pluggable database created.

SQL> ALTER PLUGGABLE DATABASE PDB2 OPEN;
Pluggable database altered.

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB READ WRITE NO
4 SD_PDB READ WRITE NO
5 PDB3 READ WRITE NO
6 NEW_PDB READ WRITE NO
7 PDB1 READ WRITE NO
8 PDB2 READ WRITE NO

3. FILE_NAME_CONVERT clause

SQL> CREATE PLUGGABLE DATABASE PDB4 ADMIN USER PDB4_ADM IDENTIFIED BY Oracle_4U
2 FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb/pdbseed/','/u01/app/oracle/oradata/cdb/pdb4/');
Pluggable database created.

OR

SQL> ALTER SESSION SET PDB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/cdb/pdbseed/','/u01/app/oracle/oradata/cdb/pdb5/';
Session altered.

SQL> CREATE PLUGGABLE DATABASE PDB5 ADMIN USER PDB5_ADM IDENTIFIED BY Oracle_4U;
Pluggable database created.

Commands to verify the details of PDBs

COLUMN pdb_name FORMAT A20
SELECT pdb_name, status
FROM dba_pdbs
ORDER BY pdb_name;

COLUMN name FORMAT A20
SELECT name, open_mode
FROM v$pdbs
ORDER BY name;

SHOW PDBS;

The PDBs are created with the status of 'NEW'. They must be opened in READ WRITE mode at least once for the integration of the PDB into the CDB to be complete.

 

Unplug a Pluggable Database (PDB) Manually

  • Before attempting to unplug a PDB, you must make sure it is closed.
  • To unplug the database use the ALTER PLUGGABLE DATABASE command with the UNPLUG INTO clause to specify the location of the XML metadata file.

We will Unplug the pluggable database (pdb1) from Container database (cdb)

SQL> ALTER PLUGGABLE DATABASE PDB1 CLOSE IMMEDIATE;
Pluggable database altered.

SQL> ALTER PLUGGABLE DATABASE PDB1 UNPLUG INTO '/u01/app/oracle/oradata/cdb/pdb1/pdb1.xml';
Pluggable database altered.

SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name;
NAME OPEN_MODE
------------------------------ ----------
NEW_PDB READ WRITE
PDB$SEED READ ONLY
PDB1 MOUNTED
PDB2 READ WRITE

SQL> DROP PLUGGABLE DATABASE PDB1 KEEP DATAFILES;
Pluggable database dropped.

SQL> SELECT name, open_mode FROM v$pdbs ORDER BY name; 
NAME OPEN_MODE
------------------------------ ----------
NEW_PDB READ WRITE
PDB$SEED READ ONLY
PDB2 READ WRITE

 

Plugin a Pluggable Database (PDB) Manually

  • Plugging in a PDB into the CDB is similar to creating a new PDB.
  • First check the PBD is compatible with the CDB by calling the DBMS_PDB.CHECK_PLUG_COMPATIBILITY function,
  • passing in the XML metadata file and the name of the PDB

We will plug the PDB1 from Container Database(cdb) into Container Database (cdb2) with name CDB_PDB1. (Plug something from a different charset and convert it.)

SET SERVEROUTPUT ON
DECLARE
l_result BOOLEAN;
BEGIN
l_result := DBMS_PDB.check_plug_compatibility(
pdb_descr_file => '/u01/app/oracle/oradata/cdb/pdb1/pdb1.xml',
pdb_name => 'cdb_pdb1');
IF l_result THEN
DBMS_OUTPUT.PUT_LINE('compatible');
ELSE
DBMS_OUTPUT.PUT_LINE('incompatible');
END IF;
END;
/SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14
incompatible
PL/SQL procedure successfully completed.

If the PDB is not compatible, violations are listed in the 
PDB_PLUG_IN_VIOLATIONS view. If the PDB is compatible, 
create a new PDB using it as the source. If we were creating 
it with a new name we might do something like this.

SQL> select NAME,MESSAGE from PDB_PLUG_IN_VIOLATIONS;
NAME MESSAGE
--------------------------------------------------------------------------------
PDB$SEED Character set mismatch: PDB character set WE8MSWIN1252. CDB character set AL32UTF8.

SQL> select property_name,property_value from database_properties where property_name='NLS_CHARACTERSET';
PROPERTY_NAME PROPERTY_VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET WE8MSWIN1252

SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string cdb2
SQL> exit

-bash-4.1$ . oraenv
ORACLE_SID = [cdb2] ? cdb
The Oracle base remains unchanged with value /u01/app/oracle
-bash-4.1$ sqlplus / as sysdba
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string cdb

SQL> select property_name,property_value from database_properties where property_name='NLS_CHARACTERSET';
PROPERTY_NAME PROPERTY_VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET AL32UTF8

SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string cdb2
SQL>
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup restrict
ORACLE instance started.
Total System Global Area 939524096 bytes
Fixed Size 2931088 bytes
Variable Size 348128880 bytes
Database Buffers 583008256 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
SQL>
SQL> select property_name,property_value from database_properties where property_name='NLS_CHARACTERSET';
PROPERTY_NAME PROPERTY_VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET WE8MSWIN1252

SQL> Alter database character set internal_use AL32UTF8;
Database altered.

SQL> Alter database character set AL32UTF8;
Database altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 939524096 bytes
Fixed Size 2931088 bytes
Variable Size 348128880 bytes
Database Buffers 583008256 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
SQL> SELECT value$ FROM sys.props$ WHERE name = 'NLS_CHARACTERSET';

VALUE$
--------------------------------------------------------------------------------
AL32UTF8

SQL> select property_name,property_value from database_properties where property_name='NLS_CHARACTERSET';

PROPERTY_NAME PROPERTY_VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET AL32UTF8

SQL> SET SERVEROUTPUT ON
DECLARE
l_result BOOLEAN;
BEGIN
l_result := DBMS_PDB.check_plug_compatibility(
pdb_descr_file => '/u01/app/oracle/oradata/cdb/pdb1/pdb1.xml',
pdb_name => 'cdb_pdb1');
IF l_result THEN
DBMS_OUTPUT.PUT_LINE('compatible');
ELSE
DBMS_OUTPUT.PUT_LINE('incompatible');
END IF;
END;
/SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14
compatible
PL/SQL procedure successfully completed.
SQL>

SQL> CREATE PLUGGABLE DATABASE CDB_PDB1 USING '/u01/app/oracle/oradata/cdb/pdb1/pdb1.xml' NOCOPY
TEMPFILE REUSE; 2
Pluggable database created.

SQL> ALTER PLUGGABLE DATABASE CDB_PDB1 OPEN READ WRITE;
Pluggable database altered.

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 CDB_PDB1 READ WRITE NO

 

Clone a Pluggable Database (PDB) Manually

In Cloning we have to use the any source pluggable database instead of seed PDB, which we have to identify using the FROM clause.

SQL> ALTER PLUGGABLE DATABASE PDB2 CLOSE;
Pluggable database altered.

SQL> ALTER PLUGGABLE DATABASE PDB2 OPEN READ ONLY;
Pluggable database altered.

SQL> CREATE PLUGGABLE DATABASE PDB3 FROM PDB2
2 create_file_dest='/u01/app/oracle/oradata/cdb/';
Pluggable database created.

SQL> alter pluggable database pdb3 open;
Pluggable database altered.

SQL> alter pluggable database pdb2 close;
Pluggable database altered.

SQL> alter pluggable database pdb2 open read write;
Pluggable database altered.

SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB3                           READ WRITE NO
         6 NEW_PDB                        READ WRITE NO
         8 PDB2                           READ WRITE NO

Clone a Remote PDB or Non-CDB

Coming soon

Clone a Pluggable Database (PDB) Manually (Metadata Only : NO DATA)

-bash-4.1$ export ORACLE_SID=orcl12c
-bash-4.1$
-bash-4.1$ sql
SQL> startup
Database opened.
SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB10 READ WRITE NO
6 MYPDB4 READ WRITE NO

SQL> CREATE PLUGGABLE DATABASE PDB1 ADMIN USER myadmin identified by 
oracle_4U  file_name_convert=('pdbseed','pdb1');

Pluggable database created.

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB10 READ WRITE NO
4 PDB1 MOUNTED
6 MYPDB4 READ WRITE NO
SQL>
SQL> alter pluggable database pdb1 open;
Pluggable database altered.

SQL> alter session set container=pdb1;
Session altered.

SQL> show con_name
CON_NAME
------------------------------
PDB1

SQL> create tablespace users 
datafile '/u01/app/oracle/oradata/orcl12c/pdb1/users.dbf' size 19m 
autoextend on;

Tablespace created.

SQL> alter database default tablespace users;
Database altered.

SQL> grant unlimited tablespace to myadmin;
Grant succeeded.

SQL> create table myadmin.test as select * from dba_objects;
Table created.

SQL> select count(*) from myadmin.test;
COUNT(*)
----------
90924

SQL> alter session set container=cdb$root;
Session altered.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB10 READ WRITE NO
4 PDB1 READ WRITE NO
6 MYPDB4 READ WRITE NO

SQL> create pluggable database pdb2 from pdb1
file_name_convert=('pdb1','pdb2') no data

Pluggable database created.

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB10 READ WRITE NO
4 PDB1 READ WRITE NO
5 PDB2 MOUNTED
6 MYPDB4 READ WRITE NO

SQL> alter pluggable database pdb2 open;
Pluggable database altered.

SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MYPDB10 READ WRITE NO
4 PDB1 READ WRITE NO
5 PDB2 READ WRITE NO
6 MYPDB4 READ WRITE NO

SQL> alter session set container=pdb2;
Session altered.

SQL> show con_name
CON_NAME
------------------------------
PDB2

SQL> select count(*) from myadmin.test;
COUNT(*)
----------
0
SQL> exit

6. DBCA Command Line

REFERENCE
=========
-bash-4.1$ dbca -createdatabase -help
Create a database by specifying the following parameters:
-createDatabase
-templateName <name of an existing template in default location or the complete template path>
[-cloneTemplate]
-gdbName <global database name>
[-ignorePreReqs] <ignore prerequisite checks for current operation>
[-sid <database system identifier>]
[-createAsContainerDatabase <true|false>]
[-numberOfPDBs <Number of Pluggable databases to be created, default is 0>]
[-pdbName <New Pluggable Database Name>]
[-pdbAdminPassword <PDB Administrator user Password, required only when creating new PDB>]
[-sysPassword <SYS user password>]
[-systemPassword <SYSTEM user password>]
[-emConfiguration <DBEXPRESS|CENTRAL|BOTH|NONE>]
-dbsnmpPassword <DBSNMP user password>
[-omsHost <EM management server host name>
-omsPort <EM management server port number>
-emUser <EM Admin username to add or modify targets>
-emPassword <EM Admin user password>
-emExpressPort <EM Database Express port number>]]
[-dvConfiguration <true | false Specify "true" to configure and enable Database Vault
-dvUserName <Specify Database Vault Owner user name>
-dvUserPassword <Specify Database Vault Owner password>
-dvAccountManagerName <Specify separate Database Vault Account Manager >
-dvAccountManagerPassword <Specify Database Vault Account Manager password>]
[-olsConfiguration <true | false Specify "true" to configure and enable Oracle Label Security >
[-datafileDestination <destination directory for all database files.> |
-datafileNames <a text file containing database objects such as controlfiles, tablespaces, redo log files and spfile to their corresponding raw device file names mappings in name=value format.>]
[-redoLogFileSize <size of each redo log file in megabytes>]
[-recoveryAreaDestination <destination directory for all recovery files. Specify "NONE" for disabling Fast Recovery Area.>]
[-datafileJarLocation <location of the data file jar, used only for clone database creation>]
[-storageType < FS | ASM >
[-asmsnmpPassword <ASMSNMP password for ASM monitoring>]
-diskGroupName <database area disk group name>
-recoveryGroupName <recovery area disk group name>
[-characterSet <character set for the database>]
[-nationalCharacterSet <national character set for the database>]
[-registerWithDirService <true | false>
-dirServiceUserName <user name for directory service>
-dirServicePassword <password for directory service >
-walletPassword <password for database wallet >]
[-listeners <list of listeners to configure the database with>]
[-variablesFile <file name for the variable-value pair for variables in the template>]]
[-variables <comma separated list of name=value pairs>]
[-initParams <comma separated list of name=value pairs>]
[-sampleSchema <true | false> ]
[-memoryPercentage <percentage of physical memory for Oracle>]
[-automaticMemoryManagement <true | false> ]
[-totalMemory <memory allocated for Oracle in MB>]
[-databaseType <MULTIPURPOSE|DATA_WAREHOUSING|OLTP>]]

Create the container database without PDBs

-bash-4.1$ dbca -silent -createdatabase -createascontainerdatabase true 
-sid cdb2 -gdbname cdb2 -syspassword oracle_4U -systempassword oracle_4U 
-templatename General_Purpose.dbc 
-datafiledestination /u01/app/oracle/oradata/ 
-emconfiguration DBEXPRESS -memorypercentage 20 
-storagetype fs -databasetype oltp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
46% complete
47% complete
52% complete
57% complete
58% complete
59% complete
62% complete
Completing Database Creation
66% complete
70% complete
74% complete
85% complete
89% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb2/cdb20.log" for further details.
-bash-4.1$
-bash-4.1$ . oraenv
ORACLE_SID = [cdb] ? cdb2
The Oracle base remains unchanged with value /u01/app/oracle

-bash-4.1$ sqlplus / as sysdba
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO

SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string cdb2

Create the container database with PDBs

-bash-4.1$ ./dbca -silent -createdatabase -gdbname cdb -sid cdb -createascontain erdatabase true -numberofpdbs 2 -pdbname mydb -pdbadminpassword oracle_4U -syspa ssword oracle_4U -systempassword oracle_4U -templatename General_Purpose.dbc -da tafiledestination /u01/app/oracle/oradata/ -emconfiguration dbexpress -character set al32utf8 -memorypercentage 20

Note: Monitor the progress using below command.

tail -100f /u01/app/oracle/cfgtoollogs/dbca/cdb/trace.log

 

Thank you for visiting our blog…

OCM 12c Preparation

Oracle OCM 12c Certification Study project.

Oracle Database 12c Certified Master Exam | 12cOCM

Exam Environment
  • Oracle Linux Release 6.5 64 bit
  • Mozilla Browser, Text (emacs, gedit) and vi editors
  • Shell environment: bash, csh
  • Use either CLI or GUI environment and tools when available
  • Oracle Database 12c Enterprise Edition Release 12.1.0.2.0  64 bit
  • Oracle Grid Infrastructure 12Release 1 (12.1.0.2)
  • Oracle Enterprise Manager Cloud Control 12c Rel 4
Notes about t he exam
  • Exam participants work through eight skillsets that are based on the exam objectives.
  • Tasks can be performed using CLI or GUI environment and tools when available

Minimum Skill-set wise Passing Scores:

Skillset1: Create Database and Network Configurations : 60.29%

Skillset2: Managing Database Availability : 46.93%

Skillset3: Data Warehouse Management : 34.14%

Skillset4: Data Management : 33.92%

Skillset5: Performance Management : 39.13%

Skillset6: Data Guard : 43.39%

Skillset7: Grid Infrastructure : 53.84%

Skillset8: Real Application Cluster Database : 37.83%

https://education.oracle.com/oracle-database-12c-certified-master-exam/pexam_12cOCM

General Database and Network Administration

Manage Database Availability

Data Management

Data Warehouse Management

Performance Management

Data Guard

  • Administer a Data Guard environment
  • Create a physical standby database
  • Configure a standby database for testing
  • Configure a standby database to apply redo
  • Configure a standby database to use for reporting
  • Configure fast start failover
  • Manage DDL in a Data Guard environment

Grid Infrastructure

  • Install Oracle Grid Infrastructure
  • Create ASM Disk Groups
  • Create and manage ASM instances
  • Configure ASM Cloud File System (ACFS)
  • Administer Oracle Clusterware
  • Manage Flex Clusters and Flex ASM

Real Application Cluster Database

  • Install Oracle Database software
  • Create a Real Application Clusters (RAC) database
  • Configure Database Services
  • Administer Oracle RAC databases on one or more cluster nodes

OTNYathra2017 @Mumbai

 

I have provided enough information about the OTN Yathra, In my previous artical “about-otnyatha”

In this artical I have decided to sharing my experiences about the sessions which i have been attended.

I have choose the Mumbai location because it is near to Ahmedabad.

I had attended below sessions at OTN Yathra 2017 @Mumbai organized by AIOUG / OUAG

1.)  “High Performance Database in Oracle Bare Metal Cloud Services” by Vivek Sharma

This session was mainly focus on Oracle Bare Metal Cloud Services offering and options by Oracle.

2.)   “Oracle and Docker – Everything you want to know to run your workload in docker container” by Umesh Tanna

I was really impress by Umesh, the way he is explaining the docker and oracle offering was quite good.

3.)  Oracle GoldenGate – IRCTC by Veeratteshwaran

This session has change my perception about the replication technology.

4.)  Building Private Cloud with Open Infrastructure by Nitin Gupta

This is the best session that actually I’m interested to know what is offering and differce option of oracle in Open Infrastructure.

5.)  12 things DBA’s will love about 12.2 by Connor McDonald

I’m feeling lucky that i choose this session because Connor is great presentation skills and sharing his experience with different examples

These all sessions were really helpful and it’s help me lots to to fill with new angle of thinking amount the upcoming technologies

I’m really greatfull to all the volunteers of AIOUG and specific to Mumbai Local Chepter volunteers who had nicely organized this event.

I’m also thankful to all the sponsors.

If you have any quesions or queries please comment here, I’m happy to share my own views and experiences about these new technologies.

Happy Learning …