Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
Additional testing done for RAC
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhollenberger committed Jan 12, 2016
1 parent c0a6f77 commit 43f7be1
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 59 deletions.
8 changes: 7 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
psu_name: July2015 # Should match psu dictionary variable defined in vars/main.yml
psu_name: OCT2015 # Should match psu dictionary variable defined in vars/main.yml

shutdown_listener: true # set to false if patching an empty oracle home (ie new 12c install)
rollback_psu: false # set to true if rolling back current PSU.
Expand All @@ -8,8 +8,14 @@ oracle_home: "/app/oracle/{{ oracle_version }}/dbhome_1"
oracle_base: /app/oracle
tns_admin: "{{ oracle_home }}/network/admin"

oracle_stage_install: /u01/stage
patch_directory: "{{ oracle_stage_install }}/{{ oracle_version }}/{{ psu_name }}"

env:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_BASE: "{{ oracle_base }}"
TNS_ADMIN: "{{ tns_admin }}"
PATH: "{{ oracle_home }}/bin:{{ oracle_home }}/OPatch:$PATH:/bin:/usr/bin::/usr/ccs/bin"

oracle_user: oracle # User that will own the Oracle Installations.
oracle_group: oinstall # Primary group for oracle_user.
15 changes: 8 additions & 7 deletions tasks/extract_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@

- name: Create Patch directory
file:
path: "{{ oracle_stage_install }}/{{ oracle_version }}"
path: "{{ patch_directory }}"
state: directory
run_once: true

- name: Unzip PSU
unarchive:
src: "{{ oracle_stage_install }}/{{ psu[oracle_version][psu_name][oracle_install_type].filename }}"
dest: "{{ oracle_stage_install }}/{{ oracle_version }}/"
dest: "{{ patch_directory}}/"
copy: no
creates: "{{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}/README.txt"
creates: "{{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}/README.txt"
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"
run_once: true

- name: Unzip oneoff patches
unarchive:
src: "{{ oracle_stage_install }}/{{ item.filename }}"
dest: "{{ oracle_stage_install }}/{{ oracle_version }}/"
dest: "{{ patch_directory }}/"
copy: no
creates: "{{ oracle_stage_install }}/{{ oracle_version }}/{{ item.patchid }}/README.txt"
creates: "{{ patch_directory }}/{{ item.patchid }}/README.txt"
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"
with_items: oneoff_patches[oracle_version]|default([])
Expand All @@ -30,9 +31,9 @@
- name: Unzip oneoff patches (PSU version specific)
unarchive:
src: "{{ oracle_stage_install }}/{{ item.filename }}"
dest: "{{ oracle_stage_install }}/{{ oracle_version }}/"
dest: "{{ patch_directory }}/"
copy: no
creates: "{{ oracle_stage_install }}/{{ oracle_version }}/{{ item.patchid }}/README.txt"
creates: "{{ patch_directory }}/{{ item.patchid }}/README.txt"
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"
with_items: oneoff_patches[ psu[oracle_version][psu_name].patchversion ]|default([])
Expand Down
12 changes: 6 additions & 6 deletions tasks/oneoff_apply.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Apply one-off patches that are not PSU version specific
- name: Oneoff conflict check
shell: "{{ oracle_home }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ oracle_stage_install }}/{{ oracle_version }}/{{ item.patchid }}"
shell: "{{ oracle_home }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ patch_directory }}/{{ item.patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
with_items: oneoff_patches[oracle_version]|default([])
Expand All @@ -11,7 +11,7 @@
- debug: var=oneoff_conflicts.results

- name: Apply one-off patches
shell: "opatch apply -silent -local -ocmrf {{ oracle_stage_install }}/ocm.rsp {{ oracle_stage_install }}/{{ oracle_version }}/{{ item.patchid }}"
shell: "opatch apply -silent -local -ocmrf {{ oracle_stage_install }}/ocm.rsp {{ patch_directory }}/{{ item.patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand All @@ -22,8 +22,8 @@
- debug: var=oneoff_apply.results

#Apply PSU version specific one-off patches
- name: Oneoff conflict check
shell: "{{ oracle_home }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ oracle_stage_install }}/{{ oracle_version }}/{{ item.patchid }}"
- name: PSU Version Specific Oneoff conflict check
shell: "{{ oracle_home }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ patch_directory }}/{{ item.patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
with_items: oneoff_patches[ psu[oracle_version][psu_name].patchversion ]|default([])
Expand All @@ -32,8 +32,8 @@

- debug: var=oneoff_conflicts_psu.results

- name: Apply one-off patches
shell: "opatch apply -silent -local -ocmrf {{ oracle_stage_install }}/ocm.rsp {{ oracle_stage_install }}/{{ oracle_version }}/{{ item.patchid }}"
- name: Apply PSU Version Specific one-off patches
shell: "opatch apply -silent -local -force -ocmrf {{ oracle_stage_install }}/ocm.rsp {{ patch_directory }}/{{ item.patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand Down
17 changes: 0 additions & 17 deletions tasks/oneoff_rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,3 @@
ignore_errors: true

- debug: var=oneoff_rollback.results

- name: SI | Rollback PSU
shell: "{{ oracle_home }}/OPatch/opatch rollback -silent -local -id {{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
register: opatch_rollback
when: oracle_install_type == 'si'

- debug: var=opatch_rollback.stdout_lines

- name: RAC | Rollback PSU
shell: "{{ grid_home }}/OPatch/opatch auto {{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -rollback -ocmrf {{ oracle_stage_install }}/ocm.rsp"
sudo_user: root
register: rac_psu_rollback
when: oracle_install_type == 'rac'

- debug: var=rac_psu_rollback.stdout_lines
27 changes: 20 additions & 7 deletions tasks/psu_rac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@
sudo_user: "{{ oracle_user }}"
environment: env
register: dblist
when: master_node

- debug: var=dblist.stdout_lines

- name: RAC | Generate srvctl state file
template:
src: srvctl_state.j2
dest: "{{ oracle_home }}/srvm/admin/psu_state.txt"
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"

- name: RAC | delete srvctl state file if it exists
file: path={{ oracle_home }}/srvm/admin/oneoffstop.txt state=absent

- name: RAC | Update opatch
unarchive:
src: "{{ oracle_stage_install }}/{{ opatch[oracle_version].filename }}"
Expand All @@ -35,7 +43,7 @@
- debug: var=lsinv_pre.results

- name: RAC | Check PSU for conflicts
shell: "{{ item }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
shell: "{{ item }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
register: opatch_conflicts
Expand All @@ -44,7 +52,7 @@
- "{{ grid_home|default(omit) }}"

- name: RAC | Apply patch to first node
shell: "{{ grid_home }}/OPatch/opatch auto {{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -ocmrf {{ oracle_stage_install }}/ocm.rsp"
shell: "{{ grid_home }}/OPatch/opatch auto {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -ocmrf {{ oracle_stage_install }}/ocm.rsp"
sudo: yes
sudo_user: root
when: master_node
Expand All @@ -61,7 +69,7 @@
when: master_node

- name: RAC | Startup Oracle Home on first node
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/oneoffstop.txt -n {{ ansible_hostname }}
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/psu_state.txt -n {{ ansible_hostname }}
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand All @@ -76,8 +84,11 @@

- debug: var=stat_res_t.stdout_lines

- name: RAC | Pause after first node
pause: prompt="Verify everything's running on the first node."

- name: RAC | Apply patch to second node
shell: "{{ grid_home }}/OPatch/opatch auto {{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -ocmrf {{ oracle_stage_install }}/ocm.rsp"
shell: "{{ grid_home }}/OPatch/opatch auto {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -ocmrf {{ oracle_stage_install }}/ocm.rsp"
sudo_user: root
when: not master_node

Expand All @@ -93,7 +104,7 @@
when: not master_node

- name: RAC | Startup Oracle Home on second node
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/oneoffstop.txt -n {{ ansible_hostname }}
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/psu_state.txt -n {{ ansible_hostname }}
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand All @@ -111,3 +122,5 @@
- "{{ oracle_home }}"
- "{{ grid_home|default(omit) }}"
register: lsinv_post

- debug: var=lsinv_post.results
26 changes: 23 additions & 3 deletions tasks/psu_rollback_rac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
sudo_user: "{{ oracle_user }}"
environment: env
register: dblist
when: master_node

- name: RAC | Generate srvctl state file
template:
src: srvctl_state.j2
dest: "{{ oracle_home }}/srvm/admin/psu_state.txt"
owner: "{{ oracle_user }}"
group: "{{ oracle_group }}"

- name: RAC | delete srvctl state file if it exists
file: path={{ oracle_home }}/srvm/admin/oneoffstop.txt state=absent
Expand All @@ -23,8 +29,16 @@
include: oneoff_rollback.yml
when: master_node

- name: RAC | Rollback PSU
shell: "{{ grid_home }}/OPatch/opatch auto {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -rollback -ocmrf {{ oracle_stage_install }}/ocm.rsp"
sudo_user: root
register: rac_psu_rollback
when: master_node

- debug: var=rac_psu_rollback.stdout_lines

- name: RAC | Startup Oracle Home on first node
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/oneoffstop.txt -n {{ ansible_hostname }}
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/psu_state.txt -n {{ ansible_hostname }}
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand All @@ -50,8 +64,14 @@
include: oneoff_rollback.yml
when: not master_node

- name: RAC | Rollback PSU on second node
shell: "{{ grid_home }}/OPatch/opatch auto {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }} -rollback -ocmrf {{ oracle_stage_install }}/ocm.rsp"
sudo_user: root
register: rac_psu_rollback
when: not master_node

- name: RAC | Startup Oracle Home on first node
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/oneoffstop.txt -n {{ ansible_hostname }}
shell: srvctl start home -o {{ oracle_home }} -s {{ oracle_home }}/srvm/admin/psu_state.txt -n {{ ansible_hostname }}
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand Down
4 changes: 2 additions & 2 deletions tasks/psu_si.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
group: "{{ oracle_group }}"

- name: SI | check for conflicts
shell: "{{ oracle_home }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
shell: "{{ oracle_home }}/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
register: opatch_conflicts
Expand Down Expand Up @@ -38,7 +38,7 @@
ignore_errors: true

- name: SI | opatch apply
shell: "opatch apply -silent -ocmrf {{ oracle_stage_install }}/ocm.rsp {{ oracle_stage_install }}/{{ oracle_version }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
shell: "opatch apply -silent -ocmrf {{ oracle_stage_install }}/ocm.rsp {{ patch_directory }}/{{ psu[oracle_version][psu_name][oracle_install_type].patchid }}"
sudo: yes
sudo_user: "{{ oracle_user }}"
environment: env
Expand Down
5 changes: 0 additions & 5 deletions tasks/run_catbundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
chdir: "{{ oracle_home }}/rdbms/admin"
when: oracle_version == '11.2.0.4'


# - debug: var=catbundle.results # too much output to be useful

- name: 12.1 - Load Modified SQL Files into the Database
shell: "export ORACLE_SID={{ item }}; ./datapatch -verbose"
sudo: yes
Expand All @@ -26,5 +23,3 @@
failed_when: datapatch.rc == 1
when: oracle_version == '12.1.0.2'
ignore_errors: true

- debug: var=datapatch
3 changes: 3 additions & 0 deletions templates/srvctl_state.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for item in dblist.stdout_lines %}
db-{{ item }}
{% endfor %}
36 changes: 25 additions & 11 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
# PSU information for RAC and Single Instance (11.2 and 12.1)
psu:
12.1.0.2:
July2015:
OCT2015:
patchversion: 12.1.0.2.5
rac:
filename: p21523234_121020_Linux-x86-64.zip
patchid: 21523234
si:
filename: p21359755_121020_Linux-x86-64.zip
patchid: 21359755
JUL2015:
patchversion: 12.1.0.2.4
rac:
filename: p20996835_121020_Linux-x86-64.zip
Expand All @@ -13,7 +21,15 @@ psu:
patchid: 20831110

11.2.0.4:
July2015:
OCT2015:
patchversion: 11.2.0.4.8
rac:
filename: p21523375_112040_Linux-x86-64.zip
patchid: 21523375
si:
filename: p21352635_112040_Linux-x86-64.zip
patchid: 21352635
JUL2015:
patchversion: 11.2.0.4.7
rac:
filename: p20996923_112040_Linux-x86-64.zip
Expand All @@ -26,13 +42,13 @@ psu:
# Files should exist in path defined by oracle_stage_install.
opatch:
12.1.0.2:
version: 12.1.0.1.8
version: 12.1.0.1.10
filename: p6880880_121010_Linux-x86-64.zip

11.2.0.4:
version: 11.2.0.3.11
version: 11.2.0.3.12
filename: p6880880_112000_Linux-x86-64.zip


oneoff_patches:
12.1.0.2:
- patchid: 21091518
Expand All @@ -41,10 +57,6 @@ oneoff_patches:
filename: p21800251_121020_Linux-x86-64.zip
- patchid: 20879889
filename: p20879889_121020_Linux-x86-64.zip
# # 17890099: ORA-2072 AND ORA-2063 ON QUERY VIA DBLINK
# - patchid: 17890099
# filename: p17890099_121020_Linux-x86-64.zip
# 21821738: Merge patch for bug 19509982, 'Select Statement Throws ORA-01792 Error (Doc ID 1951689.1)'
- patchid: 21821738
filename: p21821738_121020_Linux-x86-64.zip

Expand All @@ -53,7 +65,9 @@ oneoff_patches:
- patchid: 13542050
filename: p13542050_121024_Linux-x86-64.zip

11.2.0.4.8:
- patchid: 17890099 # ORA-2072 AND ORA-2063 ON QUERY VIA DBLINK
filename: p17890099_112048_Linux-x86-64.zip
11.2.0.4.7:
# ORA-2072 AND ORA-2063 ON QUERY VIA DBLINK
- patchid: 17890099
- patchid: 17890099 # ORA-2072 AND ORA-2063 ON QUERY VIA DBLINK
filename: p17890099_112047_Linux-x86-64.zip

0 comments on commit 43f7be1

Please sign in to comment.