HI,
MY playbook:
sample.sh:
. /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env
val=‘v$archived_log’
R=sqlplus '/as sysdba'<<EOF set numw 1 lines 80 pages 0; select max(NEXT_CHANGE#) "RMAN_SCN" from $val where BACKUP_COUNT > 0; exit; EOF
echo $R
I am trying to achieve the same through ansible using shell command, but im getting the error
- hosts: source
tasks: - include_vars: sql.yml
- shell: |
. /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env
val=‘v$archived_log’
R=sqlplus '/as sysdba' <<-EOF set numw 1 lines 80 pages 0; select max(NEXT_CHANGE#) "RMAN_SCN" from $val where BACKUP_COUNT > 0; exit; EOF
echo $R
register: cmd - debug:
msg: “{{cmd}}”
error:
TASK [debug] ********************************************************************************************************************
ok: [10.210.8.149] => {
“msg”: {
“changed”: true,
“cmd”: “. /u05/oracle/VISEBS/12.1.0/VISEBS_sal-devtl10.env\n val=‘v$archived_log’\n R=sqlplus '/as sysdba' <<-EOF\n set numw 1 lines 80 pages 0;\n select max(NEXT_CHANGE#) \"RMAN_SCN\" from $val where BACKUP_COUNT > 0;\n exit;\n EOF
\n echo $R”,
“delta”: “0:00:01.031347”,
“end”: “2018-02-28 10:15:49.032656”,
“failed”: false,
“rc”: 0,
“start”: “2018-02-28 10:15:48.001309”,
“stderr”: “/bin/bash: line 10: warning: here-document at line 6 delimited by end-of-file (wanted EOF')", "stderr_lines": [ "/bin/bash: line 10: warning: here-document at line 6 delimited by end-of-file (wanted
EOF’)”
],
“stdout”: “SQLPlus: Release 12.1.0.2.0 Production on Wed Feb 28 10:15:48 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. ERROR: ORA-01017: invalid username/password; logon denied Enter user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] where ::= [/][@<connect_identifier>] ::= [][/][@<connect_identifier>] Enter user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] where ::= [/][@<connect_identifier>] ::= [][/][@<connect_identifier>] SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQLPlus”,
“stdout_lines”: [
“SQLPlus: Release 12.1.0.2.0 Production on Wed Feb 28 10:15:48 2018 Copyright (c) 1982, 2014, Oracle. All rights reserved. ERROR: ORA-01017: invalid username/password; logon denied Enter user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] where ::= [/][@<connect_identifier>] ::= [][/][@<connect_identifier>] Enter user-name: SP2-0306: Invalid option. Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM}] [edition=value]] where ::= [/][@<connect_identifier>] ::= [][/][@<connect_identifier>] SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQLPlus”
]
}
}
some one help me