Sponsored Content
Top Forums Shell Programming and Scripting Sqlplus not connecting the 2nd time in for loop Post 303006504 by ajayakunuri on Thursday 2nd of November 2017 10:18:28 PM
Old 11-02-2017
Thanks for your reply. My bad, I had a typo in the password and so throwing that error.

But it is now failing with below error:
Code:
SELECT pi.memberid||,||pi.poolid||,||m.mediagtype from poolsitems pi inner join mediagroups m on
                    *
ERROR at line 1:
ORA-00936: missing expression

Code:
Code:
	while read j
	do
		echo $j > /data/datatransfer/Astra_pool_alert/j.csv
		awk -F "," '{print $1 "," $6}' j.csv >/data/datatransfer/Astra_pool_alert/output2.csv
		while IFS=, read V1 V2
		do
		echo $V1 $V2
sqlplus -S 'ajay/ajay@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=abcde)(PORT=1521)))(CONNECT_DATA=(service_name=12345)))'  >>log_file_2>>err_file  <<EOF
set echo off head off feed off pagesize 0 trimspool on linesize 1000 colsep ,
SPOOL output3.csv REPLACE
SELECT pi.memberid||,||pi.poolid||,||m.mediagtype from poolsitems pi inner join mediagroups m on
m.mediagroupid=pi.memberid where pi.poolid='$V1' and pi.RELEASENUMBER='$V2'
and m.mediagtype='17' and m.startdate <= sysdate and m.enddate >= sysdate;
spool off;
exit;
EOF
			echo "$j" >> /data/datatransfer/Astra_pool_alert/final_output.csv
		done < /data/datatransfer/Astra_pool_alert/output2.csv

pi.RELEASENUMBER field is a string. Am I missing quotes when passing the variables?

Thanks
Ajay
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

error connecting to sqlplus

Hi, I wrote a shell script to call oracle procedure. But when i am trying to connet sqlplus with the fallowing statement It is giving me error " callproce.sh : sqlplus: not found". What could be the problem. sqlplus -s $CONNECT_STRING >$LOGFILE <<!! thank u all papachi (2 Replies)
Discussion started by: papachi
2 Replies

2. Shell Programming and Scripting

calling sqlplus from within a for loop

i'm not new to programming, but i AM new to unix scripting. here's my deal. this works: #!/bin/ksh echo "HELLO" /oracle_home/bin/sqlplus username/password@MYDB<<EOF SELECT COUNT(*) FROM EMPLOYEES; EOF exit echo "GOODBYE" this doesn't: #!/bin/ksh echo "HELLO" for x in 1 2... (4 Replies)
Discussion started by: akosz
4 Replies

3. Shell Programming and Scripting

Showing errors when connecting to sqlplus in shell script

hi, I am trying to automate the compilation of procedures stored in .sql files in Unix. Is there any way in which we can sho err if there errors are raised in the compilation? I am using the following code to connect to the sqlplus sqlplus ${SQL_USER}/${SQL_PASSWORD} (5 Replies)
Discussion started by: silas.john
5 Replies

4. Shell Programming and Scripting

connecting through sqlplus

I am trying to connect to one of the oracle sever using uni through sqlplus command: sqlplus -s BOXI_ALPH_AUDITOR,Q078_audit$@Q047 But its not getting connected. I tried using some different server using same syntax its working. What differene i found is the password is having no special... (2 Replies)
Discussion started by: gander_ss
2 Replies

5. UNIX for Dummies Questions & Answers

Connecting to Oracle DB using sqlplus

Hi, I am very new to shell scripting and trying to write a simple shell script in which i am trying to achieve the following: 1. Connect to oracle database hosted on a different server 2. fire a query on the oracle db 3. store the output in a variable 4. use this variable for further logic... (1 Reply)
Discussion started by: shrutihardas
1 Replies

6. Shell Programming and Scripting

Connecting to Oracle DB using sqlplus

Hi, I am very new to shell scripting and trying to write a simple shell script in which i am trying to achieve the following: 1. Connect to oracle database hosted on a different server 2. fire a query on the oracle db 3. store the output in a variable 4. use this variable for further logic... (26 Replies)
Discussion started by: shrutihardas
26 Replies

7. UNIX for Advanced & Expert Users

Connecting once using sqlplus and doing multiple queries

Hello everyone, It's my first week using unix and shell scripting. I tried creating a script that has a function that execute SQL query. my script looks something like this: ---------------------------------------------------- #!/bin/sh tableName="myTable" secondTable="secondTable"... (2 Replies)
Discussion started by: edlin_r
2 Replies

8. Shell Programming and Scripting

IF loop in sqlplus

Hi all, I am trying to use if loop inside SQLPLUS....is it possible...bcoz i tried a whole day with all the possibilities....no use...pls help Here's the code: KRITI = $? sqlplus -s /NOLOG << EOF connect $USER/$PASS IF $KRITI = 0 THEN create table kriti_employees( emp_id ... (1 Reply)
Discussion started by: kritibalu
1 Replies

9. Red Hat

TNS Timeout Error when connecting to SQLPLUS through scripts only

Hi, I am facing a strange issue when connecting to SQLPLUS via a shell scripts. I am using Linux 2.6.18-274.18.1 and gbash shell. When I connect to SQLPLUS through scripts then it throws TNS Time Out error ""sometimes"" and connects successfully other times.This is only happening when... (9 Replies)
Discussion started by: aashish.sharma8
9 Replies

10. Shell Programming and Scripting

Connecting sqlplus from UNIX with multiple select statement

hi, i have a requirement where i need to connect sqlplus from unix and i am able to do so by following command: cust_count=`sqlplus -s $ORACLE_USER/$ORACLE_PASS@$ORACLE_SID << EOF set pagesize 0 set feedback off set verify off ... (1 Reply)
Discussion started by: lovelysethii
1 Replies
asadmin-ping-connection-pool(1AS)				   User Commands				 asadmin-ping-connection-pool(1AS)

NAME
asadmin-ping-connection-pool, ping-connection-pool - tests that a connection pool is usable SYNOPSIS
ping-connection-pool --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] pool_name Tests that a connection pool is usable for both JDBC connection pools and connector connection pools. For example, if you create a new JDBC connection pool for use with an application that is expected to be deployed, before deploying the application, the previously created pool is tested with this command. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. OPERANDS
poolname name of the connection pool to be tested. Example 1: Using ping-connection-pool Before you can ping a connection pool, you must: o Create a connection pool with authentication. o Make sure the Enterprise Information Server (can be the database) is started. asadmin> ping-connection-pool --user admin1 --password adminadmin1 --host pigeon --port 5001 sampleConnectionPool Command ping-connection-pool executed successfully EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-connector-connection-pool(1AS), asadmin-delete-connector-connection-pool(1AS), asadmin-list-connector-connection-pool(1AS), asadmin-create-jdbc-connection-pool(1AS), asadmin-delete--jdbc-connection-pool(1AS)asadmin- list--jdbc-connection-pools(1AS) J2EE 1.4 SDK March 2004 asadmin-ping-connection-pool(1AS)
All times are GMT -4. The time now is 07:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy