|
65 | 65 | - name: Check if Source Database is Open |
66 | 66 | become: true |
67 | 67 | become_user: "{{ oracle_user }}" |
68 | | - shell: "echo -e \"select status from v\\$instance;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" |
69 | | - changed_when: false |
| 68 | + oracle_sql: |
| 69 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 70 | + sql: "select status from v\\$instance;" |
70 | 71 | environment: |
71 | 72 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
72 | 73 | ORACLE_SID: "{{ duplicate_source_sid }}" |
|
78 | 79 |
|
79 | 80 | - name: Oracle SID to Duplicate is NOT in OPEN State |
80 | 81 | assert: |
81 | | - that: '"OPEN" | string in item.stdout' |
| 82 | + that: '"OPEN" | string in item.query_result' |
82 | 83 | fail_msg: The Source Database {{ duplicate_source_sid }} is not in OPEN State. |
83 | 84 | success_msg: Oracle SID {{ duplicate_source_sid }} is in OPEN State. Proceed with Duplicate. |
84 | 85 | become: true |
|
200 | 201 | - name: Check if Target Database is Open |
201 | 202 | become: true |
202 | 203 | become_user: "{{ oracle_user }}" |
203 | | - shell: "echo -e \"set heading off; \\n set feedback off; \\n select status from v\\$instance;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" # noqa line-length |
204 | | - changed_when: false |
| 204 | + oracle_sql: |
| 205 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 206 | + sql: "select status from v\\$instance;" |
205 | 207 | environment: |
206 | 208 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
207 | 209 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
213 | 215 |
|
214 | 216 | - name: Oracle SID on Target System is in OPEN State |
215 | 217 | assert: |
216 | | - that: '"OPEN" | string not in item.stdout' |
| 218 | + that: '"OPEN" | string not in item.query_result' |
217 | 219 | fail_msg: "The Source Database {{ duplicate_target_sid }} is in OPEN State. If you want to remove it prior to duplication, specify so in the duplicate_remove_target variable!" # noqa line-length |
218 | 220 | success_msg: "Oracle SID {{ duplicate_target_sid }} is not in OPEN State. Proceed with Duplicate." |
219 | 221 | become: true |
|
234 | 236 | environment: |
235 | 237 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
236 | 238 | ORACLE_SID: "{{ duplicate_target_sid }}" |
237 | | - register: target_controlfiles |
| 239 | + register: target_passwords |
238 | 240 | with_items: |
239 | 241 | - "{{ target_db_status }}" |
240 | 242 | delegate_to: "{{ duplicate_target_host }}" |
241 | 243 | run_once: true |
242 | | - when: (duplicate_preserve_passwords) and ("OPEN" | string in item.stdout_lines) |
| 244 | + when: (duplicate_preserve_passwords) and ("OPEN" | string in item.query_result) |
243 | 245 | tags: |
244 | 246 | - duplicate |
245 | 247 |
|
246 | 248 | - name: Gather Controlfiles from running Target Database |
247 | 249 | become: true |
248 | 250 | become_user: "{{ oracle_user }}" |
249 | | - shell: "echo -e \"set heading off; \\n set lines 500; \\n set feedback off; \\n select value from v\\$parameter where name = 'control_files';\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" # noqa line-length |
250 | | - changed_when: false |
| 251 | + oracle_sql: |
| 252 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 253 | + sql: "select value from v\\$parameter where name = 'control_files';" |
251 | 254 | environment: |
252 | 255 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
253 | 256 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
256 | 259 | - "{{ target_db_status }}" |
257 | 260 | delegate_to: "{{ duplicate_target_host }}" |
258 | 261 | run_once: true |
259 | | - when: (duplicate_remove_target) and ("OPEN" | string in item.stdout_lines) |
| 262 | + when: (duplicate_remove_target) and ("OPEN" | string in item.query_result) |
260 | 263 | tags: |
261 | 264 | - duplicate |
262 | 265 |
|
263 | 266 | - name: Gather Datafiles from running Target Database |
264 | 267 | become: true |
265 | 268 | become_user: "{{ oracle_user }}" |
266 | | - shell: "echo -e \"set heading off; \\n set lines 500; \\n set pages 500; \\n set feedback off; \\n select file_name from dba_data_files;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" # noqa line-length |
| 269 | + oracle_sql: |
| 270 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 271 | + sql: "select file_name from dba_data_files;" |
267 | 272 | environment: |
268 | 273 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
269 | 274 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
272 | 277 | - "{{ target_db_status }}" |
273 | 278 | delegate_to: "{{ duplicate_target_host }}" |
274 | 279 | run_once: true |
275 | | - when: (duplicate_remove_target) and ("OPEN" | string in item.stdout) |
| 280 | + when: (duplicate_remove_target) and ("OPEN" | string in item.query_result) |
276 | 281 | tags: |
277 | 282 | - duplicate |
278 | 283 |
|
279 | 284 | - name: Gather Tempfiles from running Target Database |
280 | 285 | become: true |
281 | 286 | become_user: "{{ oracle_user }}" |
282 | | - shell: "echo -e \"set heading off; \\n set lines 500; \\n set pages 500; \\n set feedback off; \\n select file_name from dba_temp_files;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" # noqa line-length |
| 287 | + oracle_sql: |
| 288 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 289 | + sql: "select file_name from dba_temp_files;" |
283 | 290 | environment: |
284 | 291 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
285 | 292 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
288 | 295 | - "{{ target_db_status }}" |
289 | 296 | delegate_to: "{{ duplicate_target_host }}" |
290 | 297 | run_once: true |
291 | | - when: (duplicate_remove_target) and ("OPEN" | string in item.stdout) |
| 298 | + when: (duplicate_remove_target) and ("OPEN" | string in item.query_result) |
292 | 299 | tags: |
293 | 300 | - duplicate |
294 | 301 |
|
295 | 302 | - name: Gather Redologs from running Target Database |
296 | 303 | become: true |
297 | 304 | become_user: "{{ oracle_user }}" |
298 | | - shell: "echo -e \"set heading off; \\n set lines 500; \\n set pages 500; \\n set feedback off; \\n select member from v\\$logfile;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" # noqa line-length |
| 305 | + oracle_sql: |
| 306 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 307 | + sql: "select member from v\\$logfile;" |
299 | 308 | environment: |
300 | 309 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
301 | 310 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
304 | 313 | - "{{ target_db_status }}" |
305 | 314 | delegate_to: "{{ duplicate_target_host }}" |
306 | 315 | run_once: true |
307 | | - when: (duplicate_remove_target) and ("OPEN" | string in item.stdout) |
| 316 | + when: (duplicate_remove_target) and ("OPEN" | string in item.query_result) |
308 | 317 | tags: |
309 | 318 | - duplicate |
310 | 319 |
|
|
319 | 328 | - "{{ target_db_status }}" |
320 | 329 | delegate_to: "{{ duplicate_target_host }}" |
321 | 330 | run_once: true |
322 | | - when: (duplicate_remove_target) and ("OPEN" | string in item.stdout) |
| 331 | + when: (duplicate_remove_target) and ("OPEN" | string in item.query_result) |
323 | 332 | tags: |
324 | 333 | - duplicate |
325 | 334 |
|
|
675 | 684 | - name: Shutdown Target Database for restoring the original SPFILE |
676 | 685 | become: true |
677 | 686 | become_user: "{{ oracle_user }}" |
678 | | - shell: "echo -e \"shutdown immediate;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" |
| 687 | + oracle_sql: |
| 688 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 689 | + sql: "shutdown immediate;" |
679 | 690 | environment: |
680 | 691 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
681 | 692 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
702 | 713 | - name: Startup Target Database for restoring the original SPFILE |
703 | 714 | become: true |
704 | 715 | become_user: "{{ oracle_user }}" |
705 | | - shell: "echo -e \"startup;\" | {{ duplicate_source_home.stdout }}/bin/sqlplus -s / as sysdba" |
| 716 | + oracle_sql: |
| 717 | + orahome: "{{ duplicate_source_home.stdout }}" |
| 718 | + sql: "startup;" |
706 | 719 | environment: |
707 | 720 | ORACLE_HOME: "{{ duplicate_source_home.stdout }}" |
708 | 721 | ORACLE_SID: "{{ duplicate_target_sid }}" |
|
0 commit comments