Error in running DB query by script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error in running DB query by script
# 1  
Old 09-19-2013
Error in running DB query by script

Hi I was trying to fetch data from database. But the number of rows exported were huge so i got the error. Experts please advice. Thanks a lot for your supprt. #: ./script.sh ./script.sh: xmalloc: subst.c:3076: cannot allocate 1401346369 bytes (0 bytes allocated)

Last edited by brij123; 09-19-2013 at 09:48 PM..
# 2  
Old 09-19-2013
Your script failed because it could not allocate more than 1GB of memory for your query.

What DB are you using?

Please show the select statement from your script as well.

There are ways to fetch rows one at a time from a resultset. If we can see what is going on and can know the DB.
# 3  
Old 09-20-2013
The below is the script I am trying to run. The DB is SybaseIQ


HTML Code:
#!/usr/bin/sh


> data_output.csv
output=`dbisql -c "UID=username;PWD=password" -host localhost -port 2640 -nogui<<!

SELECT A||CHAR(44)||B||CHAR(44)||C||CHAR(44)||D as MYDATA from E

!`


line_count=0

echo "${output}" | while read line; do
echo "${line}" >> data_output.csv


done

exit 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding a query on making changes to a running script

Hello All, Greetings !! I have a query here to all is as follows: Question: Let's say we are running a script in a UNIX box and we have opened an another session and then made changes in script of some statements NOT to be print some values(just an example) so when I am monitoring the... (5 Replies)
Discussion started by: RavinderSingh13
5 Replies

2. UNIX for Dummies Questions & Answers

Extract only the data from ksh script running netezza query

Hi I searched this forum before posting the question, but couldnt find it, the issue i'm facing is, i'm trying to select a column from a netezza table from a korn shell script, but the query runs var=$(nzodbcsql -q "select MAX(millcount) from table1";) echo $var it returns the value like... (10 Replies)
Discussion started by: maximus_jack
10 Replies

3. Shell Programming and Scripting

Running sed from a script query

Hello! I'm trying to run this code to print the body of an html document (all text in between <body> and </body>) from a script but am unsure how to call it from the command line interface. /<body>/,/<\/body>/ 1s/.*<body>// $s/<\/body>.*//p I have tried to call it using this: sed... (6 Replies)
Discussion started by: bgnersoon2be#1
6 Replies

4. UNIX for Dummies Questions & Answers

Running a SQL Query from UNIX

Hi, Could you please help me on this. I have bulk of queries written in text file. I want to use those queries and want to execute from UNIX. I don't want to run this file as a sql file as this file will change every week. I want to run it in my environment as bulk sql statement from text... (1 Reply)
Discussion started by: abhii
1 Replies

5. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

6. AIX

Query on running script with nohup

Hi, I'm trying to run database restore script with the nohup command as it will run for long hours since if I run it normally, the putty session will become inactive and the restore gets terminated. The command I use is nohup db2 -tvf FBR_NODE0000.scr -z FBR_NODE0000.log & But the problem is... (2 Replies)
Discussion started by: vkcool.17
2 Replies

7. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

8. Shell Programming and Scripting

Running script from script query

Hi I have a question Suppose i have three scripts & i have created a top level script to run these. eg. leaf1.csh leaf2.csh leaf3.csh top.csh Now in top.csh i have written #!/bin/csh leaf1.csh leaf2.csh leaf3.csh Now my question is when i run this top level script when it... (1 Reply)
Discussion started by: sarbjit
1 Replies

9. Shell Programming and Scripting

error ORA-06512 while running query in script

1 #!/bin/ksh 2 ################################################################ 3 # Written by Johnson 12/03/2008 4 # Version 1.0 5 # This script executes some SQL to provide Spike Check Report to TNS team. 6 ... (3 Replies)
Discussion started by: shivanete
3 Replies

10. Shell Programming and Scripting

Patch query using shell script error

Hi All, OS:AIX 5.3 I am using the following shell script for patch query but not getting the prompt to enter values for '&From_date' and '&TO_Date' in the patch query when called from the shell script as below: patch_query.sh ============ #!/usr/bin/ksh export DBALIST="xyz@xyz.com"... (1 Reply)
Discussion started by: a1_win
1 Replies
Login or Register to Ask a Question