-1

I have created the below ansible playbook to get the tablespace status by executing the sql query on oracle database 19c.

While executing this playbook it hangs or times out or maybe it is asking for a prompt. I dont have an idea. All I want is to execute the sql queries dynamically by passing a variable

---
- hosts: oracledbsrv  
  tasks:
    - name: Execute tablespace status
      shell:  ". /home/oracle/.bash_profile && echo $ORACLE_HOME && . /home/oracle/db.env && /u01/app/oracle/product/19c/db_1/bin/sqlplus / as sysdba  @query.sql"
      become: yes
      become_user: oracle      
      register: tablespace_status
      # failed_when: db_status.stdout.find("ORA-01034") == -1
    - debug:
        msg: "{{ tablespace_status }}"
Zeitounator
  • 38,476
  • 7
  • 53
  • 66
Suganthan Raj
  • 2,330
  • 6
  • 31
  • 42
  • 1
    Does your SQL script include an `exit` command? If not, `sqlplus` will stop at the SQL prompt and wait for more commands and the shell won't close. – pmdba Sep 01 '23 at 17:30
  • What happens when your run your command manually directly on the target server? – Zeitounator Sep 02 '23 at 09:10

0 Answers0