Skip to content

Commit 41c7987

Browse files
Merge pull request #18 from thedatabaseme/develop
Merge 2.2.0 to Master
2 parents ba92a51 + 2a916ce commit 41c7987

18 files changed

+384
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
/roles/pythia/templates/18SE2_Database.rsp.j2
99
/roles/pythia/templates/19EE_Database.rsp.j2
1010
/roles/pythia/templates/19SE2_Database.rsp.j2
11+
/roles/pythia/templates/21EE_Database.rsp.j2
12+
/roles/pythia/templates/21SE2_Database.rsp.j2
1113
.idea

Changelog.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
Changelog of Pythia:
22

3+
Version 2.2.0
4+
- New Feature #17: Pythia now supports Oracle Database 21c as well as Multitenant / Container Databases
5+
6+
Especially the support for Multitenant Databases has brought some Changes.
7+
It's now necessary to provide the information if the Databases running on a
8+
specific RDBMS is a CDB or not. It's not a real good implementation to control
9+
this in the rdbms_dict.yml cause the fact if it is a CDB or not, is defined per
10+
database and not per RDBMS. But since 21c no longer supports any NON-CDB setups,
11+
we implemented it there. The fact if is a CDB or not is controlled by setting
12+
the variable container_database within rdbms_dict.yml.
13+
Second major adjustment can be found during the patching of a container database.
14+
You can control if you want to get all PDBs within a CDB started up after the
15+
patch has been applied to the RDBMS by using the variable patch_all_pdbs within
16+
the patch_dict.yml. Keep in mind, this variable is optional within the dictionary,
17+
so you can specify it but you don't have to. When the variable patch_all_pdbs is
18+
set to false, only PDBs that are started up during CDB startup (by using a trigger) are
19+
opened and therefore patched.
20+
When you missed the point for patching all PDBs while patching a CDB with Pythia,
21+
you have to patch the PDBs (by using datapatch) manually on your own. Pythia will
22+
not know if there are PDBs not patched.
23+
324
Version 2.1.0
425
- New Feature #1: Added documentation / instructions under docs/*.md for the most common tasks you can do with Pythia
526
- New Feature #13: Implemented Export / Import mechanism over Datapump Network_link

docs/02_INSTALL_RDBMS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Please also check the `vars/rdbms_dict.yml` and set the following Variables as y
2727
|oracle_base|Oracle Base Directory for the specified RDBMS|
2828
|oracle_home|Oracle Home Directory for the specified RDBMS|
2929
|oracle_inventory|Path to the Oracle Inventory Location|
30+
|container_database|Controls, if a database created for the specified<br> release, should be a CDB or not. NON-CDB<br> are desupported starting with 21c
3031
|additional_dir|You may specify an additional directory that should be<br> created / permission set when install RDBMS|
3132
|space_needed_gb|Space approximately in GB for installing the RDBMS. Respects,<br> that there is probably a Patch installed on top|
3233
|desc|Description of the RDBMS|

docs/03_CREATE_DB.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ During the Prerequisite Check that Pythia does everytime you let her go, the acc
2020
| Variable Name | Description | Default Value |
2121
|---------------|--------------------------|---------------|
2222
|oracle_version |The Version of the RDBMS and Database you want to deploy or change.<br>The Version String has to be existant within the RDBMS Dictionary (`rdbms_dict.yml` under vars folder)|`19EE`|
23-
|oracle_sid|The SID of the Oracle Database you want to install. Only needed when starting <br>the playbook with the `db` tag, for creating a Database|none|
23+
|oracle_sid|The SID of the Oracle Database you want to install. Only needed when starting <br>the playbook with the `db` tag, for creating a Database|`NONE`|
2424

2525
### Optional Variables
2626

2727

2828
| Variable Name | Description | Default Value |
2929
|---------------|--------------------------|---------------|
30+
|oracle_pdb_name|Name of the Plugable Database you want to get created<br> during Database creation. Needs to be set in order to get it created.|`NONE`|
3031
|sga_max_size |Size of the SGA in GB of the Oracle Database to be created. Both Parameters <br>sga_max_size and sga_target will be set to this value for your Instance Configuration|`2`|
3132
|pga_aggregate_target|Size of the PGA in GB of the Oracle Database to be created. Will be set as <br>Oracle Parameter pga_aggregate_target|`1`|
3233
|use_large_pages|Can be `TRUE` or `ONLY`. Will automatically be set to `ONLY` when the hugepage tag <br>is specified|`TRUE`|

docs/04_INSTALL_PATCH.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Please also check the vars/patch_dict.yml and set the following Variables as you
1919
|patch_id |Unique Patch ID|
2020
|patch_dir |Path where the patch is located, relative to the `local_stage_directory` variable. <br>Must reside under `local_stage_directory`|
2121
|patch_file|Filename of the Patch Archive|
22+
|patch_all_pdbs|Can be `true` or `false`. When defined and the according RDBMS is enabled<br> as `container_database` (see `rdbms_dict.yml`), all PDBs will get opened<br> and patched during patching.
2223
|opatch_dir|Path where the needed OPATCH for patch installation is located. Relative to the `local_stage_directory` variable. <br>Must reside under `local_stage_directory`|
2324
|oracle_inventory|Path to the Oracle Inventory Location|
2425
|opatch_file|Filename of the needed OPATCH archive|

roles/pythia/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ main.yml Variables (can be set when calling the playbook, see Examples):
4949
- oracle_version (Default 19EE): The Version of the RDBMS and Database you want to deploy or change. The Version String has to be existant within the RDBMS Dictionary (rdbms_dict.yml under vars folder)
5050
- client_version (Default 19CLNT): The Version of the Oracle Client you want to deploy. The Version String has to be existant within the Client Dictionary (client_dict.yml under vars folder)
5151
- oracle_sid (Default NULL): The SID of the Oracle Database you want to install. Only needed when starting the playbook with the "db" tag, for creating a Database.
52+
- oracle_pdb_name (Default NULL): Name of the Plugable Database you want to get created during Database creation. Needs to be set in order to get it created.
5253
- space_needed_gb: Space approximately in GB for installing the RDBMS. Respects, that there is probably a Patch installed on top. OVERLOADS rdbms_dict.yml space_needed_gb. SHOULD NOT BE SPECIFIED WITHIN HERE. SHOULD BE SPECIFIED AS EXTRA VARIABLE IN PLAYBOOK CALL.
5354
- nls_length_semantics (Default BYTE): Oracle Parameter NLS_LENGTH_SEMANTICS, can be BYTE or CHAR. When set, it will be placed in the Database creation Response Files
5455
- character_set (Default AL32UTF8): Character Set of the Database when creating.
@@ -106,6 +107,7 @@ patch_dict.yml (a Dictionary File for Patches that can be installed by Pythia):
106107
- patch_id: Unique Patch ID of the Patch
107108
- patch_dir: Path where the Patch is located on the Stage Directory, relative to the local_stage_directory Variable
108109
- patch_file: Filename of the Patch Archive
110+
- patch_all_pdbs: Can be true or false. When defined and the according RDBMS is enabled as container_database (see rdbms_dict.yml), all PDBs will get opened and patched during patching.
109111
- opatch_dir: Path where the needed OPatch Version is located on the Stage Directory, relative to the local_stage_directory Variable
110112
- opatch_file: Filename of the OPatch Archive
111113
- desc: Description of the Patch
@@ -116,6 +118,7 @@ rdbms_dict.yml (a Dictionary File for RDBMS that can be installed by Pythia):
116118
- oracle_base: Oracle Base Directory for the specified RDBMS
117119
- oracle_home: Oracle Home Directory for the specified RDBMS
118120
- oracle_inventory: Path to the Oracle Inventory Location
121+
- container_database: Controls, if a database created for the specified release, should be a CDB or not. NON-CDB are desupported starting with 21c
119122
- space_needed_gb: Space approximately needed in GB for installing the RDBMS. This value is checked in precheck_fsfree.yml before installing a RDBMS. The value should respect, that you are planning to install a Patchset on Top of the RDBMS. Good initial Value are 12GB of Free Space.
120123
- desc: Description of the RDBMS
121124

roles/pythia/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# - oracle_version (Default 19EE): The Version of the RDBMS and Database you want to deploy or change. The Version String has to be existant within the RDBMS Dictionary (rdbms_dict.yml under vars folder)
99
# - client_version (Default 19CLNT): The Version of the Oracle Client you want to deploy. The Version String has to be existant within the Client Dictionary (client_dict.yml under vars folder)
1010
# - oracle_sid (Default NULL): The SID of the Oracle Database you want to install. Only needed when starting the playbook with the "db" tag, for creating a Database.
11+
# - oracle_pdb_name (Default NULL): Name of the Plugable Database you want to get created during Database creation. Needs to be set in order to get it created.
1112
# - nls_length_semantics (Default BYTE): Oracle Parameter NLS_LENGTH_SEMANTICS, can be BYTE or CHAR. When set, it will be placed in the Database creation Response Files
1213
# - character_set (Default AL32UTF8): Character Set of the Database when creating.
1314
# - national_character_set (Default AL16UTF16): National Character Set of the Database when creating
@@ -77,6 +78,7 @@ sqlscriptoutput: false
7778
# Control Variables for Installation
7879
oracle_version: 19EE
7980
oracle_sid: ""
81+
oracle_pdb_name: ""
8082
install_patch: ""
8183
install_rpm: ""
8284
reboot_required: false

roles/pythia/tasks/install_db.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
- name: Create Database {{ oracle_sid }} with dbca
7979
become: yes
8080
become_user: "{{ oracle_user }}"
81-
shell: "{{ rdbms[oracle_version|string].oracle_home }}/bin/dbca -silent -createDatabase -templateName {{ rdbms[oracle_version|string].oracle_home }}/assistants/dbca/templates/{{ oracle_version }}_Database.rsp -sid {{ oracle_sid }} -gdbName {{ oracle_sid }} -createAsContainerDatabase false -sysPassword {{ sys_user_password }} -systemPassword {{ system_user_password }} -emConfiguration {{ emexpress }} -ignorePreReqs -honorControlFileInitParam"
81+
shell: "{{ rdbms[oracle_version|string].oracle_home }}/bin/dbca -silent -createDatabase -templateName {{ rdbms[oracle_version|string].oracle_home }}/assistants/dbca/templates/{{ oracle_version }}_Database.rsp -sid {{ oracle_sid }} -gdbName {{ oracle_sid }} -createAsContainerDatabase {{ rdbms[oracle_version|string].container_database }} -sysPassword {{ sys_user_password }} -systemPassword {{ system_user_password }} -emConfiguration {{ emexpress }} -ignorePreReqs -honorControlFileInitParam"
8282
register: result
8383
failed_when: ("ERROR" in result.stdout) or ("FATAL" in result.stdout)
8484
environment:
@@ -88,6 +88,20 @@
8888
tags:
8989
- db
9090

91+
- name: Create plugable Database {{ oracle_pdb_name }} with dbca
92+
become: yes
93+
become_user: "{{ oracle_user }}"
94+
shell: "{{ rdbms[oracle_version|string].oracle_home }}/bin/dbca -silent -createPluggableDatabase -pdbName {{ oracle_pdb_name }} -sourceDB {{ oracle_sid }} -configureTDE false -createPDBFrom DEFAULT -pdbAdminUserName pdmadm_{{ oracle_pdb_name }} -pdbAdminPassword {{ sys_user_password }} -pdbDatafileDestination {{ data_dest }}/{{ oracle_pdb_name }}"
95+
register: result
96+
failed_when: ("ERROR" in result.stdout) or ("FATAL" in result.stdout)
97+
when: (rdbms[oracle_version|string].container_database|bool) and (oracle_pdb_name|length > 0)
98+
environment:
99+
ORACLE_HOME: "{{ rdbms[oracle_version|string].oracle_home }}"
100+
ORACLE_BASE: "{{ rdbms[oracle_version|string].oracle_base }}"
101+
ORACLE_SID: "{{ oracle_sid }}"
102+
tags:
103+
- db
104+
91105
###################################################################################
92106
# Reset Database Users Passwords and Print them out to the User
93107
# Tag: db

roles/pythia/tasks/install_patch.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@
196196
become: yes
197197
become_user: "{{ oracle_user }}"
198198
shell: "{{ rdbms[oracle_version|string].oracle_home }}/OPatch/opatch apply -silent -oh {{ rdbms[oracle_version|string].oracle_home }}"
199+
environment:
200+
ORACLE_BASE: "{{ rdbms[oracle_version|string].oracle_base }}"
199201
args:
200202
chdir: "{{ remote_stage_directory }}/{{ patch[install_patch|int].patch_id }}"
201203
register: result
@@ -242,6 +244,19 @@
242244
- patch
243245
- patchonly
244246

247+
- name: Start all PDBs for patching
248+
become: yes
249+
become_user: "{{ oracle_user }}"
250+
shell: "echo -e \"alter pluggable database all open;\" | {{ rdbms[oracle_version|string].oracle_home }}/bin/sqlplus -s / as sysdba"
251+
environment:
252+
ORACLE_HOME: "{{ rdbms[oracle_version|string].oracle_home }}"
253+
ORACLE_SID: "{{ item }}"
254+
when: (sid_list.stdout_lines|length > 0) and (patch[install_patch|int].patch_all_pdbs is defined) and (patch[install_patch|int].patch_all_pdbs|bool) and (rdbms[oracle_version|string].container_database|bool)
255+
with_items: "{{ sid_list.stdout_lines }}"
256+
tags:
257+
- patch
258+
- patchonly
259+
245260
###################################################################################
246261
# The Database itself is not patched with datapatch.
247262
# Tag: patch, patchonly
@@ -254,6 +269,7 @@
254269
environment:
255270
ORACLE_HOME: "{{ rdbms[oracle_version|string].oracle_home }}"
256271
ORACLE_SID: "{{ item }}"
272+
ORACLE_BASE: "{{ rdbms[oracle_version|string].oracle_base }}"
257273
when: (sid_list.stdout_lines|length > 0)
258274
with_items: "{{ sid_list.stdout_lines }}"
259275
tags:

roles/pythia/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
##################################################################################
33
# Main Task File for Pythia
4-
# Version 2.1.0
4+
# Version 2.2.0
55
# Author: Philip Haberkern
66
# For more Details view README.md
77
##################################################################################

0 commit comments

Comments
 (0)