Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected spool file name same as db name #665

Merged
merged 5 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_FILE }}
dest: "{{ lookup('env','GITHUB_WORKSPACE') | default('/tmp', true) }}/{{ ORACLE_DB_REFRESH_FILE }}"
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/{{ SOURCE_DB }}_control.txt"
- "/tmp/get_latest_backup_control_file.sql"
- "/tmp/{{ ORACLE_DB_REFRESH_FILE }}"
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_FILE }}
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
3 changes: 0 additions & 3 deletions ansible/roles/oracle-db-refresh/vars/main.yml

This file was deleted.

Loading