Oracle Developers
Published in

Oracle Developers

DevOps Series: Deployment of Oracle 19c Container and Pluggable Database with Ansible [GITHUB]

Authors: Nassyam Basha (Oracle ACE Director, OCM), Monowar Mukul (OCM)

21c: Github Repo:

GITHUB Link: https://github.com/asiandevs/Oracle_CDBnPDB_19c

Introduction

Welcome back to DevOps Series, In the first article we have accomplished the installation of Oracle 19c Enterprise Edition using Ansible, and in this article, we will prepare the ansible roles to create the container database and then we will create another role to create a pluggable database. Wait, we will add few more steps to the master playbook on how to create the password file, listener creation and TNS updates with a full setup of CDB and PDB creation and everything through ansible automation.

Master Playbook

Plan: There are various cases for creating a Container Database or Pluggable database. For example, we can create Container and Pluggable databases together, even multiple pluggable databases. But In this example, we try to make it simple and easy to understand. Let’s first create an empty container database and then add a Pluggable database.

In this article we are creating container and pluggable database on the host ora-x1 and the control server where ansible installed hostname is oel75.

The first step of Ansible automation is to create a master playbook. In this master playbook, we will mention the hosts/groups and then user[root] which have already the SSH access to managed servers from the control server. To know which hosts we are targeting the deployment, we need to check the file /etc/ansible/hosts file which contains various groups or hosts — when the hosts value in playbook set to “ALL,” in that case, the deployment is applicable for all the groups.

If there are redundant hosts in various groups — how ansible deals? — Indeed, it skips the duplicate hostnames if available and continues with ansible deployment with unique hosts.

[root@oel75 ansible]# cat ansible.cfg | grep inventory
inventory = ./inventory
[root@oel75 ansible]# cat inventory
[ora-x1]
192.168.56.102
[ora-x2]
192.168.56.103
[dbservers]
192.168.56.102
192.168.56.103

In the top-level master playbook, we can set up many roles, but in this article, our goal is to create an empty Container database (CDB) and then create a pluggable database (PDB) with local undo. Accordingly, we can prepare two roles for each below.

Master Playbook

Let’s prepare the contents for the role “cdb_pdb_create.yml.” It has two roles, one “cdb_create_19c” to create an empty Container Database and the second one is “pcdb_create_19c” to create a pluggable database. In this article, we are not covering only the creation of the database, but we are covering all the pre and post activities of database creation as DBCA does. When using Ansible we are using the database, listener all the activities will be performed in silent mode. We will see each of the roles of how they are defined.

Container Database Role

Database creation is a very well known topic since decades, so in this article, our goal is to show how we can create a database using ansible playbooks and how it eases the business operations smoothly and in parallel.

Creation of Container Database

File: Oracle_CDBnPDB_19c/roles/cdb_create_19c/files/enable_dbarchlogs.sql

This file consists of the commands to enable archive log mode after the database creation.

shutdown immediate;
startup mount;
alter database archivelog;
alter database open;
shutdown immediate;
startup
/
exit;

File: Oracle_CDBnPDB_19c/roles/cdb_create_19c/files/tns_upd.sh

This file will create the TNS service for the database we are creating.

#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/19.2.0/db100
export TNSNAMES_FILE=tnsnames.ora
export ENTRY_NAME=$1
export HOST_ADDR=$2
export PORT_NUM=$3
export SRV_NAME=$4
export TNS_ADMIN_DIR=$5
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ] || [ -z $5 ]; then
echo “Missing one or more required parameters: [ENTRY_NAME] [HOST_ADDR] [PORT_NUM] [SERVICE_NAME] [TNS_ADMIN_DIR]”
exit;
fi
chk_entry=`cat $TNS_ADMIN_DIR/$TNSNAMES_FILE | grep “$ENTRY_NAME =” | wc -l`
if [ -n “$chk_entry” ] && [ “$chk_entry” = 0 ]; then
echo “Creating the required entry…”
echo “”
echo “
$ENTRY_NAME =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = $HOST_ADDR)(PORT = $PORT_NUM))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = $SRV_NAME)
)
)
“ >> $TNS_ADMIN_DIR/$TNSNAMES_FILE
elif [ “$chk_entry” != 0 ]; then
echo “”
echo “This entry already exists: [$ENTRY_NAME].”
echo “Nothing to do!”
echo “”
exit;
fi

Playbook: Oracle CDBnPDB_19c/roles/cdb_create_19c/tasks/main.yml

The main.yml file contains various below subtasks and also calls the dependent files under the CDB playbook. This single main.yml contains and extracts the data from all the files, templates and vars.

  • Export environment variables
  • Calls enable_dbarchivelog.sql
  • tns_upd.sh
  • Crosscheck if database name already exists
  • Creating a silent listener
  • Configuring Listener
  • Create silent database install file
  • Create container database
  • TNS updates to the container database
  • Check running databases
  • Modify oratab
  • Validating CDB
  • CDB violations

To create CDB and PDB, we will pass all the necessary variables (such as ORACLE_BASE,

ORACLE_HOME, PDB name, cdb name, file location, et.) into a variable file in Ansible. So we need to prepare another file vars/main.yml which consists of all the variables required for the Oracle Installations. These variables we are going to use in the tasks/main.yml during execution or deployment of CDB and PDB. We will discuss more tasks/main,yml in next steps.

File: Oracle_CDBnPDB_19c/roles/cdb_create_19c/templates/dbcadb.rsp.19.0.0.0.0.j2

This file prepared to create the container database using the dbca silent method. We can create a response file (dbca19cSI.rsp) by copying the response file under the ($ORACLE_HOME/assistants/dbca/dbca.rsp) and then modify as required and even this script is available in docs.oracle.com. Below is the sample of response file to create a CDB. For this article, we used two different roles for CDB and PDB. Normally PDB request comes as a separate and for that, we can run only PDB role to create the only pluggable database after modifying PDB variables.

[root@oel75 ansible]# cat roles/cdb_create_19c/templates/dbcacdb.rsp.19.0.0.0.0.j2
##############################################################################
## ##
## DBCA response file ##
## — — — — — — — — — ##
## Copyright(c) Oracle Corporation 1998,2019. All rights reserved. ##
## ##
##############################################################################
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v19.0.0
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
gdbName={{ item.0.cdb_name }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
sid={{ item.0.cdb_name }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
databaseConfigType={{ item.0.dbconfig_type }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
createAsContainerDatabase={{ item.0.container_db}}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
numberOfPDBs=
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
# Name : pdbName
# Datatype : String
# Description : Specify the pdbname/pdbanme prefix if one or more pdb need to be created
# Valid values : Check Oracle12c Administrator’s Guide
# Default value : None
# Mandatory : No
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
pdbName=
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
# Name : useLocalUndoForPDBs
# Datatype : boolean
# Description : Flag to create local undo tablespace for all PDB’s.
# Valid values : TRUE\FALSE
# Default value : TRUE
# Mandatory : No
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
useLocalUndoForPDBs=
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
pdbAdminPassword=
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
templateName={{ template_name }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
sysPassword={{dbpasswords[item.0.cdb_name][‘sys’]}}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
systemPassword={{dbpasswords[item.0.cdb_name][‘system’]}}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
emExpressPort=5500
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
datafileDestination={{ item.0.dbfile_path }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
recoveryAreaDestination={{ item.0.fra_path }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
storageType={{ item.0.db_storage_type }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
{% if item.0.characterset is defined %}
characterSet={{ item.0.characterset }}
{% else %}
characterSet=AL32UTF8
{% endif %}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
{% if item.0.ncharacterset is defined %}
nationalCharacterSet={{ item.0.ncharacterset }}
{% else %}
nationalCharacterSet=AL16UTF16
{% endif %}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
listeners={{ item.0.lsnr_name }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
sampleSchema=
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
memoryPercentage=
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
databaseType={{ item.0.oracle_database_type }}
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
automaticMemoryManagement=false
# — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -
totalMemory={{ item.0.totalMemory }}

File: Oracle_CDBnPDB_19c/roles/cdb_create_19c/templates/dbprofile.j2

dbprofile script contains all the environment profile of the database or we can say it as a database profile.

get_sid=$(ps -ef | grep “ora_pmon_$ORACLE_DBNAME” |grep -v grep | sed ‘s/^.*pmon_//g’)
# Set up the Oracle environment variables
umask 022
ORACLE_BASE={{ oracle_base }}
export ORACLE_BASE
ORACLE_HOME={{ oracle_home }}
export ORACLE_HOME
SHLIB_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH
SQLPATH=/home/oracle/.sql
export SQLPATH
export ORACLE_SID=${get_sid:-$ORACLE_DBNAME}
export NLS_DATE_FORMAT=’DD-MM-YYYY HH24:MI:SS’
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH:$SQLPATH

File: Oracle_CDBnPDB_19c/roles/cdb_create_19c/templates/orapwd.sh.j2

This file helps to create the password file as part of the Container database creation.

source ~/.bash_profile
export ORACLE_SID={{ cdb_name }}
export ORACLE_HOME={{ oracle_home }}
export PATH=$PATH:$ORACLE_HOME/bin
orapwd file=orapw{{ cdb_fname }} password={{ syspass }} force=y ignorecase=n

File: Oracle_CDBnPDB_19c/roles/cdb_create_19c/templates/listener.rsp.19.0.0.0.0.j2

[GENERAL]
RESPONSEFILE_VERSION=”19.0"
CREATE_TYPE=”CUSTOM”
[oracle.net.ca]
INSTALLED_COMPONENTS={“server”,”net8",”javavm”}
INSTALL_TYPE=””typical””
LISTENER_NUMBER=1
LISTENER_NAMES={“LISTENER”}
LISTENER_PROTOCOLS={“TCP;1523”}
LISTENER_START=””LISTENER””
NAMING_METHODS={“TNSNAMES”,”ONAMES”,”HOSTNAME”}
NSN_NUMBER=1
NSN_NAMES={“EXTPROC_CONNECTION_DATA”}
NSN_SERVICE={“PLSExtProc”}
NSN_PROTOCOLS={“TCP;HOSTNAME;1523”}

Playbook: Oracle_CDBnPDB_19c/roles/cdb_create_19c/vars/main.yml

oracle_user: “oracle”
root_user: “root”
oracle_install_group: “oinstall”
stage_dir: “/u01/stage”
root_directory: “/u01”
oracle_base: “{{ root_directory }}/app/oracle”
oracle_home: “{{ oracle_base }}/product/19.2.0/db100”
silent_database19c_config_file: “{{ stage_dir }}/silent_19cdb_config.rsp”
silent_database19c_config_file1: “{{ stage_dir }}/silent_19cdb_config1.rsp”
silent_database19c_config_file2: “{{ stage_dir }}/silent_19cdb_config2.rsp”
silent_listener_config_file: “{{ stage_dir }}/silent-lsnr19c-config.rsp”
dbfile_path: “/u01/app/oracle/oradata”
fra_path: “/u01/app/oracle/fra”
template_name: General_Purpose.dbc
cdb_name: “eaymp”
oracle_sid: “eaymp”
cdb_fname: “bingo”
cdb_sname: “mdpkb”
oracleuser_home: “/home/{{ oracle_user }}”
oracle_rsp_stage: “{{ stage_dir }}”
syspass: “Oracle123”
dbunq_name: eaymp
prihost: ora-x1
portnum: 1521
tns_path: “{{ oracle_home }}/network/admin”
tns_file: “{{ tns_path }}/tnsnames.ora”
db_properties:
— home: “OraDB19Home1”
oracle_dbversion: 19.0.0.0.0
oracle_edition: EE
cdb_name: eaymp
dbconfig_type: SI
container_db: true
db_storage_type: FS
totalMemory: 1200
oracle_database_type: MULTIPURPOSE
redolog_size_in_mb: 150
lsnr_name: LISTENER
state: present
dbfile_path: “/u01/app/oracle/oradata”
fra_path: “/u01/app/oracle/fra”
dbpasswords:
eaymp:
sys: Oracle123
system: Oracle123

We have completed all the required playbooks and scripts which required for the container database. After preparation of Pluggable database playbook then we will run the playbooks serially.

Creation of Pluggable Database

We have prepared the ansible code and required scripts for container database, and now we will prepare for the pluggable database. We don’t need additional steps to create a password file or creating a listener for PDB. Hence we directly move ahead by updating TNS entries for PDB, and we will create the pluggable database for the playbook pdb19c_create.

Pluggable Database Role

File: Oracle_CDBnPDB_19c/roles/pdb19c_create/files/tns_upd.sh

[root@oel75 ansible]# cat roles/pdb19c_create/vars/main.yml
oracle_user: “oracle”
root_user: “root”
oracle_install_group: “oinstall”
stage_dir: “/u01/stage”
root_directory: “/u01”
scripts_directory: “{{ root_directory }}/app/scripts”
base_directory: “{{ root_directory }}/app/oracle”
oracle_home: “{{ base_directory }}/product/19.2.0/db100”
cdb_name: “eaymp”
pdb_name: “kachu”
pdbadmpassword: “Oracle123”
prihost: ora-x1
portnum: 1521
tns_path: “{{ oracle_home }}/network/admin”
tns_file: “{{ tns_path }}/tnsnames.ora”

Playbook: Oracle_CDBnPDB_19c/roles/pdb19c_create/tasks/main.yml

In this playbook, we will perform main tasks related to creating the pluggable database on top of container database and then we will perform a few other post tasks.

  • Creating Directories
  • Pluggable Database with local undo and different character set
  • Modify oratab
  • Open a pluggable database in normal mode

Below is the complete code for the tasks/main.yml file for PDB and wrote code based on the above concept.

[root@oel75 ansible]# cat roles/pdb19c_create/tasks/main.yml
- name: pdb19c_create | display pre pdb create message
debug:
msg:
— ‘This Steps is relate to Create a Pluggable Database on server ora-x1 at {{ansible_date_time.iso8601}}:’
- name: pdb19c_create | Create Datafile Directories
remote_user: “{{ root_user }}”
when: inventory_hostname in groups[‘ora-x1’]
file:
path=/u01/app/oracle/oradata/{{ pdb_name }}
state=directory
owner=”{{ oracle_user }}”
group=”{{ oracle_install_group }}”
mode=0755
tags:
-pdbcreate_crdirs
- name: pdb19c_create | Copy required script to Primary database server
when: inventory_hostname in groups[‘ora-x1’]
copy:
src=roles/pdb19c_create/files/{{ item }}
dest={{ stage_dir }}
owner=”{{ oracle_user }}”
group=”{{ oracle_install_group }}”
mode=0775
remote_src=no
with_items:
— tns_upd.sh
- name: pdb19c_create | Create a Pluggable Database with local undo and different characterset
when: inventory_hostname in groups[‘ora-x1’]
remote_user: “{{ root_user }}”
become: yes
become_user: “{{ oracle_user }}”
action: shell export ORACLE_HOME={{ oracle_home }}; {{ oracle_home }}/bin/dbca -silent -createPluggableDatabase -sourceDB {{ cdb_name }} -pdbName {{ pdb_name }} -pdbAdminPassword {{ pdbadmpassword }} -useLocalUndoForPDBs TRUE -characterset WE8ISO8859P1
tags:
-pdbcreate_exepdb
- name: pdb19c_create | change oratab
when: inventory_hostname in groups[‘ora-x1’]
remote_user: “{{ root_user }}”
lineinfile: dest=’/etc/oratab’ regexp=’^{{ pdb_name }}:{{ oracle_home }}:N’ line=’{{ pdb_name }}:{{ oracle_home }}:Y’
tags:
-pdbcreate_updoratab
- name: pdb19c_create | Open pluggable database in normal mode
when: inventory_hostname in groups[‘ora-x1’]
remote_user: “{{ root_user }}”
become: yes
become_user: “{{ oracle_user }}”
shell: export ORACLE_HOME={{ oracle_home }}; export ORACLE_SID={{ cdb_name }}; echo “{{ item }};” | {{ oracle_home }}/bin/sqlplus / as sysdba
register: sqlplus_result
failed_when: “‘ERROR’ in sqlplus_result.stdout or sqlplus_result.rc != 0”
with_items:
— alter pluggable database all open
tags:
-pdbcreate_openpdb
- name: pdb19c_create | execute tns update for CDB database
when: inventory_hostname in groups[‘ora-x1’]
remote_user: “{{ root_user }}”
become: yes
become_user: “{{ oracle_user }}”
shell: ‘{{ stage_dir }}/tns_upd.sh {{ pdb_name }} {{ prihost }} {{ portnum }} {{ pdb_name }} {{ tns_path }}’
args:
executable: /bin/bash
- name: pdb19c_create | Remove stage directory
when: inventory_hostname in groups[‘ora-x1’]
file: path={{ stage_dir }} state=absent
tags:
— dbdelete_removestgdir
- name: pdb19c_create | validate PDB
remote_user: “{{ oracle_user }}”
when: inventory_hostname in groups[‘ora-x1’]
shell: export ORACLE_HOME={{ oracle_home }}; export ORACLE_SID={{ cdb_name }}; export PATH=$PATH:$ORACLE_HOME/bin; echo “{{ item }};” | {{ oracle_home }}/bin/sqlplus / as sysdba
register: sqlplus_pdbvalidate
with_items:
— select open_mode, cdb from v\$database
— show pdbs
— alter session set container={{ pdb_name }}
— select name, open_mode from v\$pdbs
- name: display PDB validation output message
when: inventory_hostname in groups[‘ora-x1’]
debug:
var: sqlplus_pdbvalidate.results
- name: pdb19c_create | display post PDB create message
when: inventory_hostname in groups[‘ora-x1’]
debug:
msg:
— ‘This Steps completed below task for Single Instance at {{ansible_date_time.iso8601}}:’
— ‘- Create a Pluggable Database on server ora-x1’
— ‘- END OF ALL: git repository “OracleDBAwithAnsible” will be updated’

Run the Playbook — To create CDB and PDB with one execution

The main playbooks/codes are already written in tasks/main.yml, and now we are going to execute the playbook using the command “ansible-playbook” as below. When using this command, we have various options in terms of debugging, validation, etc. It is always recommended to use verbose “ — v[v][v]” option and “ — check” for debugging or troubleshooting the script to ensure there are no errors in terms of syntax or execution. To list out examples, could be directory structure in the target is unavailable then ansible able to list out the issues in debug mode. Execute playbook from ansible home directory as below.

[root@oel75 ansible]# ansible-playbook cdb_pdb_create.ymlPLAY [ora-x1] ***************************************************************************************************************TASK [Gathering Facts] ******************************************************************************************************
ok: [192.168.56.102]
TASK [cdb_create_19c : validate oracle database is installed] ***************************************************************
ok: [192.168.56.102]
TASK [cdb_create_19c : debug] ***********************************************************************************************
ok: [192.168.56.102] => {
"msg": "oracle database software is already installed in this /u01/app/oracle/product/19.2.0/db100"
}
TASK [cdb_create_19c : create required directories] *************************************************************************
changed: [192.168.56.102] => (item=/u01/stage)
ok: [192.168.56.102] => (item=/u01/app/oracle/oradata/)
ok: [192.168.56.102] => (item=/u01/app/oracle/fra/)
TASK [cdb_create_19c : Check if database is already created] ****************************************************************
changed: [192.168.56.102]
. . .
. .
.
ok: [192.168.56.102] => (item=
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:12 2019
Version 19.2.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0
SQL>
NAME OPEN_MODE CDB
--------- -------------------- ---
EAYMP READ WRITE YES
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0) => {
"msg": "\nSQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:12 2019\nVersion 19.2.0.0.0\n\nCopyright (c) 1982 , 2018, Oracle. All rights reserved.\n\n\nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Product ion\nVersion 19.2.0.0.0\n\nSQL> \nNAME\t OPEN_MODE\t CDB\n--------- -------------------- ---\nEAYMP\t READ WRITE\t YES\n\nSQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.2.0.0.0"
}
ok: [192.168.56.102] => (item=
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:12 2019
Version 19.2.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0
SQL>
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO

. . .
. .
.
SQL>
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 KACHU READ WRITE NO

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0) => {
"msg": "\nSQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:40 2019\nVersion 19.2.0.0.0\n\nCopyright (c) 1982 , 2018, Oracle. All rights reserved.\n\n\nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Product ion\nVersion 19.2.0.0.0\n\nSQL> \n CON_ID CON_NAME\t\t\t OPEN MODE RESTRICTED\n---------- ------------------------------ ---------- ----------\n\t 2 PDB$SEED\t\t\t READ ONLY NO\n\t 3 KACHU\t\t\t READ WRITE NO\nSQL> Disconnected from Oracle Da tabase 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.2.0.0.0"
}
ok: [192.168.56.102] => (item=
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:40 2019
Version 19.2.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0
SQL>
Session altered.
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0) => {
"msg": "\nSQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:40 2019\nVersion 19.2.0.0.0\n\nCopyright (c) 1982 , 2018, Oracle. All rights reserved.\n\n\nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Product ion\nVersion 19.2.0.0.0\n\nSQL> \nSession altered.\n\nSQL> Disconnected from Oracle Database 19c Enterprise Edition Release 1 9.0.0.0.0 - Production\nVersion 19.2.0.0.0"
}
ok: [192.168.56.102] => (item=
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:40 2019
Version 19.2.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0
SQL>
NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY
KACHU
READ WRITE
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.2.0.0.0) => {
"msg": "\nSQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 16 17:52:40 2019\nVersion 19.2.0.0.0\n\nCopyright (c) 1982 , 2018, Oracle. All rights reserved.\n\n\nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Product ion\nVersion 19.2.0.0.0\n\nSQL> \nNAME\n--------------------------------------------------------------------------------\nOPE N_MODE\n----------\nPDB$SEED\nREAD ONLY\n\nKACHU\nREAD WRITE\n\n\nSQL> Disconnected from Oracle Database 19c Enterprise Editi on Release 19.0.0.0.0 - Production\nVersion 19.2.0.0.0"
}
TASK [pdb19c_create : pdb19c_create | display post PDB create message] ******************************************************
ok: [192.168.56.102] => {
"msg": [
"This Steps completed below task for Single Instance at 2019-04-16T07:08:03Z:",
"- Create a Pluggable Database on server ora-x1",
"- END OF ALL: git repository Oracle_CDBnPDB_19c will be updated"
]
}
PLAY RECAP ******************************************************************************************************************
192.168.56.102 : ok=26 changed=17 unreachable=0 failed=0

Summary

We’ve seen how to prepare the Ansible playbooks to create initially container database, and it’s just not database we included configuration of the listener, TNS and password file with full setup. Similarly for the pluggable database. Finally, we can see the validation of both the container and pluggable database.

Authors Bio

Nassyam Basha is a Database Administrator. He has around ten years of experience as a Production Oracle DBA, currently working as Database Expert with eProseed KSA. He holds a master’s degree in Computer Applications from the University of Madras. He is an Oracle 11g Certified master an Oracle ACE Director. He actively participates in Oracle-related forums such as OTN with a status of Super Hero, Oracle support awarded as “Guru” and acting as OTN Moderator and written numerous articles with OTN and on Toad World. He maintains an Oracle technology-related blog, www.oracle-ckpt.com and can be reached at https://www.linkedin.com/in/nassyambasha/

Monowar Mukul is currently working as a Principal Oracle Database Specialist. I am an Oracle certified Master (Oracle 12c Certified Master Administration, Oracle 12c Certified Master MAA, and Oracle 11g Certified Master Administration). He has been working as an Oracle DBA consultant over 17 years with Oracle MAA space for both Exadata and non-Exadata Systems, Oracle Cloud Space and SOA Middleware. He worked across various business sectors including tertiary education, energy, government, mining and transport in Australia. He demonstrated highly developed critical thinking and analytical skills working as a Principal Oracle Database Specialist. You can find more details about him and his work achievements at https://www.linkedin.com/in/monowarmukul/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Monowar Mukul

Monowar Mukul

128 Followers

Oracle (Oracle Certified Master OCM — 12c DBA, 12c HA, and 11g DBA)| OCI | AWS| Ansible | Kubernetes | OpenShift | PostgreSQL and Aspiring Data Scientists :)