Wrote below script to login into oracle via shell script and trying to reset locked account..It works as expected. But I need specific output << EOF should go to target terminal not all out put
running below script from ansible command line..
Code:
#!/bin/bash
source $1
sqlplus '/as sysdba' << EOF
ALTER USER $2 ACCOUNT UNLOCK;
select username,account_status from dba_users where username='$2'
EXIT;
EOF
I am getting screen output like below
Code:
ora | CHANGED => {"changed": true, "rc": 0, "stderr": "Shared connection to closed.\r\n", "stderr_lines": ["Shared connection toclosed."], "stdout": "\r\nSQL*Plus: Release 12.1.0.2.0 Production on Sun Oct 7 16:41:25 2018\r\n\r\nCopyright (c) 1982, 2014, Oracle. All rights reserved.\r\n\r\n\r\nConnected to:\r\nOracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production\r\nWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options\r\n\r\n16:41:25 SYS @ ORCL:ORCL:>\r\nUser altered.\r\n\r\n16:41:25 SYS @ ORCL:ORCL:>\r\nUSERNAME\r\n--------------------------------------------------------------------------------\r\nACCOUNT_STATUS\r\n--------------------------------\r\nABTESTLOCK\r\nOPEN\r\n\r\n\r\n16:41:25 SYS @ ORCL:ORCL:>Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production\r\nWith the Partitioning, OLAP, Advanced Analytics and Real Application Testing options\r\n", "stdout_lines": ["", "SQL*Plus: Release 12.1.0.2.0 Production on Sun Oct 7 16:41:25 2018", "", "Copyright (c) 1982, 2014, Oracle. All rights reserved.", "", "", "Connected to:", "Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production", "With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options", "", "16:41:25 SYS @ ORCL:ORCL:>", "User altered.", "", "16:41:25 SYS @ ORCL:ORCL:>", "USERNAME", "--------------------------------------------------------------------------------", "ACCOUNT_STATUS", "--------------------------------", "ABTESTLOCK", "OPEN", "", "", "16:41:25 SYS @ ORCL:ORCL:>Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production", "With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options"]}
to the terminal in table column format i.e I need only out put of select username,account_status from dba_users where username='$2' to the terminal output in table format, how can i achieve this
I have a Script that generates 3 columns of the result. The line script is
/usr/xpg4/bin/awk -F' ' '{print $1 /t $2}' File_Name | awk -F'>' '{print $2}' | cut -d'<' -f1 | sort -rn | uniq -c
The output of the Command is :
Code.500 4 Input Error
Code.404 ... (4 Replies)
Hello,
I need help with a perl script that will process a text file and match virtual server name to profile(s). the rest will be ignored.
Virtual server name follows the word "virtual" in the begging of the line.
There could be multiple profiles assigned to one virtual server.
For example, ... (3 Replies)
Hi All,
I have a output like below values
val1=test.com
val2=10.26.208.11
val3=en1
val4=test-priv1.com
val5=192.168.3.4
val6=en2
val7=test-priv2.com
val8=192.168.4.4
val9=en3
val10=test-vip.com
val11=10.26.208.9
val12=$val3
I want to convet this output values into below... (1 Reply)
I have one script which generate file called report.txt having following output
parameter_name status comment
banking ok NA
finance 30% hike NA
Loan_department ok 20%
HR_Group defaulters Ajay
I wanted to convert this file into tabular form.
You can see each line contain 3 words and... (7 Replies)
Below is my code where i tried using table tag to print out put in table but its not working
#!/bin/ksh
#] && . ./.profile 2>/dev/null
if test -f '.profile'; then . ./.profile; fi;
#. .profile
LOG_DIR=/app/rpx/jobs/scripts/just/logs
sendEmail()
{
pzCType="$1";... (5 Replies)
Hi Friends,
I have the script output like below:
Script Output:
-----------------------------------------------------------------------
Details of the Client:
-----------------------
name: server1;
save set: All;
... (3 Replies)
Hi,
I need to format a command output for the beolow command:
runmqckm -cert -list -db $MQ_KDB -pw $PASSWD -expiry $EXP | grep -v "Certificates in database"
The output will be:
"ABC - cert name"
From: Tuesday, May 25, 1999 11:09:40 AM CDT To: Saturday, May 25, 2019 11:39:40 AM CDT
... (3 Replies)
Hello,
In my shell script, I extract table data from HP Vertica DB into a csv file using vsql -c command. But the problem is the file getting created is in binary format and hence some of the data becomes unreadable which has chinese characters as part of data.
file -i filename.csv - gives... (2 Replies)