This repository has been archived by the owner on Jun 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from CruGlobal/rac_upgrade
Rac Database Upgrade
- Loading branch information
Showing
12 changed files
with
953 additions
and
34 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
|
||
- name: Template db_unique_name.sql | ||
template: | ||
src: db_unique_name.j2 | ||
dest: "{{ oracle_stage }}/db_unique_name.sh" | ||
mode: 0744 | ||
tags: always | ||
|
||
- name: Run db_unique_name.sql | ||
shell: ./db_unique_name.sh | ||
args: | ||
chdir: "{{ oracle_stage }}" | ||
creates: db_unique_name.log | ||
environment: "{{ env_old }}" | ||
tags: always | ||
|
||
- name: Register Unique name | ||
shell: cat db_unique_name.log | ||
args: | ||
chdir: "{{ oracle_stage }}" | ||
register: db_unique_name_out | ||
tags: always | ||
|
||
- name: Set db_unique_name variable | ||
set_fact: | ||
db_unique_name: "{{ db_unique_name_out.stdout_lines[0] }}" | ||
tags: always | ||
|
||
- debug: var=db_unique_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
|
||
- name: fail if required variables are not defined | ||
fail: msg="{{ item }} is not defined for {{ ansible_hostname }}" | ||
when: "{{ item }} is not defined" | ||
tags: always | ||
with_items: | ||
- oracle_install_type | ||
- oracle_version | ||
- db_name | ||
- database_parameters[db_name] | ||
- database_parameters[db_name].log_mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
#Steps to run 1 Week after upgrading Database | ||
- name: Drop restore point and set compatible parameter | ||
shell: echo "{{ item }};" | sqlplus / as sysdba | ||
register: sqlplus_result | ||
failed_when: "'ERROR' in sqlplus_result.stdout or sqlplus_result.rc != 0" | ||
environment: "{{ env }}" | ||
when: master_node | ||
with_items: | ||
- DROP RESTORE POINT before_upgrade | ||
- alter system set compatible='{{ oracle_version }}' scope=spfile | ||
|
||
- name: Shutdown database | ||
shell: srvctl stop database -d {{ db_name }} | ||
environment: "{{ env }}" | ||
when: master_node | ||
|
||
- name: Disable Archivelog Mode | ||
shell: echo "{{ item }};" | sqlplus / as sysdba | ||
register: sqlplus_result | ||
failed_when: "'ERROR' in sqlplus_result.stdout or sqlplus_result.rc != 0" | ||
environment: "{{ env }}" | ||
when: master_node and database_parameters[db_name].log_mode == 'noarchivelog' | ||
with_items: | ||
- startup mount | ||
- alter database flashback off | ||
- alter database noarchivelog | ||
- shutdown immediate | ||
|
||
- name: Start database | ||
shell: srvctl start database -d {{ db_name }} | ||
environment: "{{ env }}" | ||
when: master_node | ||
|
||
- name: Gather fixed object stats | ||
shell: echo "exec DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;" | sqlplus / as sysdba | ||
register: sqlplus_result | ||
failed_when: "'ERROR' in sqlplus_result.stdout or sqlplus_result.rc != 0" | ||
environment: "{{ env }}" | ||
when: master_node | ||
|
||
## Backup Database | ||
- name: template final upgrade backup (level 0) | ||
template: | ||
src: final_upgrade_backup_0.j2 | ||
dest: "{{ oracle_stage }}/final_upgrade_backup_0.rman" | ||
when: master_node and database_parameters[db_name].log_mode == 'archivelog' | ||
tags: final_upgrade_backup | ||
|
||
- name: final upgrade backup (level 0) | ||
shell: rman @{{ oracle_stage }}/final_upgrade_backup_0.rman | ||
environment: "{{ env }}" | ||
async: 7200 | ||
poll: 10 | ||
when: master_node and database_parameters[db_name].log_mode == 'archivelog' | ||
tags: final_upgrade_backup | ||
register: final_upg | ||
|
||
- debug: var=final_upg | ||
tags: final_upgrade_backup |
File renamed without changes.
Oops, something went wrong.