Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandhya1874 committed Apr 5, 2024
1 parent 2b69159 commit c6f1cdf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Check if ORACLE_DB_REFRESH_DB_NAME is defined
- name: Check if SOURCE_DB is defined
fail:
msg: "ORACLE_DB_REFRESH_DB_NAME is not defined"
when: ORACLE_DB_REFRESH_DB_NAME == ""
msg: "SOURCE_DB is not defined"
when: SOURCE_DB == ""

- name: Install SQL Script
template:
Expand All @@ -24,8 +24,8 @@
- name: Copy the latest backup control file handle details to the runner
fetch:
src: "/tmp/{{ ORACLE_DB_REFRESH_DB_NAME }}_control.txt"
dest: "{{ lookup('env','GITHUB_WORKSPACE') | default('/tmp', true) }}/{{ ORACLE_DB_REFRESH_DB_NAME }}_control.txt"
src: "/tmp/{{ SOURCE_DB }}_control.txt"
dest: "{{ lookup('env','GITHUB_WORKSPACE') | default('/tmp', true) }}/{{ SOURCE_DB }}_control.txt"
flat: yes
fail_on_missing: yes

Expand All @@ -34,5 +34,5 @@
path: "{{ item }}"
state: absent
loop:
- "/tmp/{{ ORACLE_DB_REFRESH_DB_NAME }}_control.txt"
- "/tmp/{{ ORACLE_DB_REFRESH_DB_NAME }}"
- "/tmp/{{ SOURCE_DB }}_control.txt"
- "/tmp/get_latest_backup_control_file.sql"
7 changes: 6 additions & 1 deletion ansible/roles/oracle-db-refresh/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
- import_tasks: get_latest_backup_control_file.yml
tags:
- oracle_db_refresh
- oracle_db_refresh_get_latest_backup_control_file
- get_latest_backup_control_file

- import_tasks: oracle_db_restore.yml
tags:
- oracle_db_refresh
- refresh_db
18 changes: 18 additions & 0 deletions ansible/roles/oracle-db-refresh/tasks/oracle_db_restore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Check if TARGET_DB is defined
fail:
msg: "TARGET_DB is not defined"
when: TARGET_DB == ""

- name: Check if SOURCE_DB is defined
fail:
msg: "SOURCE_DB is not defined"
when: SOURCE_DB == ""

- name: Copy the latest backup control file handle details to the runner
fetch:
src: "{{ lookup('env','GITHUB_WORKSPACE') | default('/tmp', true) }}/{{ SOURCE_DB }}_control.txt"
dest: "/tmp/{{ TARGET_DB }}_control.txt"
flat: yes
fail_on_missing: yes

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
set head off echo off feedback off
spool /tmp/{{ ORACLE_DB_REFRESH_DB_NAME }}_control.txt
spool /tmp/{{ SOURCE_DB }}_control.txt
with controlfile_details as
(
select db_key, max(stamp) stamp from rcvcatowner.rc_backup_controlfile
where autobackup_date is NULL and db_name = '{{ ORACLE_DB_REFRESH_DB_NAME }}'
where autobackup_date is NULL and db_name = '{{ SOURCE_DB }}'
group by db_key
)
select a.HANDLE from rcvcatowner.rc_backup_piece a, controlfile_details b, rcvcatowner.rc_backup_controlfile c
Expand Down
2 changes: 0 additions & 2 deletions ansible/roles/oracle-db-refresh/vars/main.yml

This file was deleted.

0 comments on commit c6f1cdf

Please sign in to comment.