Skip to content

Commit fb0dd36

Browse files
Merge pull request #40 from thedatabaseme/develop
Fixed #3: Pythia now checks if there are running instances before adjusting the sysctl.conf
2 parents 38240b9 + 9702b28 commit fb0dd36

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

Changelog.txt

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

3+
Version 2.3.6
4+
- Fixed #3: Pythia now checks if there are running instances before adjusting the sysctl.conf
5+
36
Version 2.3.5
47
- New Feature #34: using the shell command with sqlplus has been replaced by the oracle_sql
58
module

roles/pythia/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ main.yml Variables (can be set when calling the playbook, see Examples):
7676
- sles15_packages, sles12_packages, rhel7_packages: A list of Packages that will be installed before installing the Oracle RDBMS Software. The list can be found in the Oracle Installation Guide Documentation for each OS.
7777
- shmall (Default 2097152): Will be calculated during Playbook Runtime. Will be included to the sysctl Configuration when deploying a Database
7878
- shmmax (Default 4294967295): Will be calculated during Playbook Runtime. Will be included to the sysctl Configuration when deploying a Database
79-
- current_shmall (Default 0): Just for initializing the Variable. Must not be modified
80-
- current_shmmax (Default 0): Just for initializing the Variable. Must not be modified
81-
- current_hugepages (Default 0): Just for initializing the Variable. Must not be modified
8279
- hugepages (Default 0): Will be calculated during Playbook Runtime. Will be included to the sysctl Configuration when deploying a Database
8380
- client_install_type (Default Administrator): Choose Which Client Install Type you want to install. Can be Administrator, Runtime, InstantClient or Custom
8481
- datapump_source_host (Default NULL): The source host on which the datapump_source_sid is running. Only needed when starting the playbook with the "datapump" tag, for doing an Datapump Export / Import a Database.

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.3.5
4+
# Version 2.3.6
55
# Author: thedatabaseme / Philip Haberkern
66
# For more Details view README.md
77
# ####################################################################

roles/pythia/tasks/prerequisites.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,29 @@
202202
- hugepage
203203
- converttohugepage
204204

205+
# Fixes #3
206+
- name: Check if there are already Oracle instances
207+
become: true
208+
shell: "cat /etc/oratab 2> /dev/null | grep -v '#' | grep -v -e '^$' | wc -l"
209+
changed_when: false
210+
register: instance_count
211+
when: sysctl_stable | default(false) | bool
212+
tags:
213+
- db
214+
- rdbms
215+
- prepare
216+
- hugepage
217+
- converttohugepage
218+
219+
- debug:
220+
var: instance_count
221+
tags:
222+
- db
223+
- rdbms
224+
- prepare
225+
- hugepage
226+
- converttohugepage
227+
205228
- name: Check if Transparent Hugepages are configured
206229
shell: grep -w transparent_hugepage=never /etc/default/grub
207230
changed_when: false
@@ -216,15 +239,15 @@
216239
become: true
217240
shell: "sysctl -a | grep -w vm.nr_hugepages | grep -o [0-9]*"
218241
register: current_hugepages
219-
when: (sysctl_stable | bool)
242+
when: (sysctl_stable | bool) and (instance_count.stdout | int > 0)
220243
tags:
221244
- hugepage
222245

223246
- name: Getting current shmall Value
224247
become: true
225248
shell: "cat /etc/sysctl.d/97-oracle-db-sysctl.conf | grep shmall | awk -F \"=\" {'print$2'}"
226249
register: current_shmall
227-
when: (sysctl_stable | bool)
250+
when: (sysctl_stable | bool) and (instance_count.stdout | int > 0)
228251
tags:
229252
- db
230253
- prepare
@@ -233,7 +256,7 @@
233256
become: true
234257
shell: "cat /etc/sysctl.d/97-oracle-db-sysctl.conf | grep shmmax | awk -F \"=\" {'print$2'}"
235258
register: current_shmmax
236-
when: (sysctl_stable | bool)
259+
when: (sysctl_stable | bool) and (instance_count.stdout | int > 0)
237260
tags:
238261
- db
239262
- prepare
@@ -251,8 +274,8 @@
251274
# Only when sysctl is stable
252275
- name: Calculating OS Kernel Parameter Settings shmall
253276
set_fact:
254-
shmall: "{{ (((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|int)|int }}"
255-
when: ((sysctl_stable | bool) and (shmall|int < ((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|int))
277+
shmall: "{{ (((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|default(0)|int)|int }}"
278+
when: ((sysctl_stable | bool) and (shmall|int < ((sga_max_size|int * 1024 * 1024 * 1024 / 4096) * 1.01) + current_shmall.stdout|default(0)|int))
256279
tags:
257280
- db
258281
- prepare
@@ -266,8 +289,8 @@
266289

267290
- name: Calculating OS Kernel Parameter Settings shmmax
268291
set_fact:
269-
shmmax: "{{ (((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|int)|int }}"
270-
when: ((sysctl_stable | bool) and (shmmax|int < ((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|int))
292+
shmmax: "{{ (((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|default(0)|int)|int }}"
293+
when: ((sysctl_stable | bool) and (shmmax|int < ((sga_max_size|int * 1024 * 1024 * 1024) * 1.01) + current_shmmax.stdout|default(0)|int))
271294
tags:
272295
- db
273296
- prepare
@@ -281,7 +304,7 @@
281304

282305
- name: Calculating Number of Hugepages
283306
set_fact:
284-
hugepages: "{{ (((sga_max_size|int * 1024 / 2) * 1.01) + current_hugepages.stdout|int)|int }}"
307+
hugepages: "{{ (((sga_max_size|int * 1024 / 2) * 1.01) + current_hugepages.stdout|default(0)|int)|int }}"
285308
reboot_required: true
286309
when: (sysctl_stable | bool)
287310
tags:
@@ -459,7 +482,7 @@
459482
changed_when: false
460483
register: check_selinux_configuration
461484
become: true
462-
when: (not molecule_run | bool | default(false))
485+
when: (not molecule_run | default(false) | bool)
463486
tags:
464487
- autostart
465488
- db
@@ -488,7 +511,7 @@
488511
state: "{{ selinux_desired_state }}"
489512
register: selinux_configuration_change
490513
become: true
491-
when: '((not molecule_run | bool | default(false)) and ("SELinux state changed" in check_selinux_configuration.msg))'
514+
when: '((not molecule_run | default(false) | bool) and ("SELinux state changed" in check_selinux_configuration.msg))'
492515
tags:
493516
- autostart
494517
- db

roles/pythia/vars/main.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,13 @@
2828
# sysctl Configuration when deploying a Database
2929
# - shmmax (Default 4294967295): Will be calculated during Playbook Runtime. Will be included to the
3030
# sysctl Configuration when deploying a Database
31-
# - current_shmall (Default 0): Just for initializing the Variable. Must not be modified
32-
# - current_shmmax (Default 0): Just for initializing the Variable. Must not be modified
33-
# - current_hugepages (Default 0): Just for initializing the Variable. Must not be modified
3431
# - hugepages (Default 0): Will be calculated during Playbook Runtime. Will be included to the sysctl
3532
# Configuration when deploying a Database
3633

3734
# OS Kernel Parameter Variables. Will be calculated during Playbook Run. Must not be set here
3835
shmall: 2097152
3936
shmmax: 4294967295
40-
current_shmall: 0
41-
current_shmmax: 0
4237
hugepages: 0
43-
current_hugepages: 0
4438

4539
# Stage and Script Directories
4640
local_stage_directory: /mnt/oracle_stage

0 commit comments

Comments
 (0)