To spool output from a database query


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To spool output from a database query
# 1  
Old 04-07-2008
To spool output from a database query

Hi all,

I would want to spool file for a database query, however by using crontab, the file is not spooled. Below shows my script:

ORACLE_HOME="/u01/oraprod/perpdb/10.1.0/db_1"
OUTFILE="/tmp/invalid.out"
FILE="$HOME/admin/scripts"
$ORACLE_HOME/bin/sqlplus -s "/as sysdba" @$FILE/compile_inv_obj.sql
sleep 30
echo exit >>$FILE/comp_all.sql

contents inside $FILE/compile_inv_obj.sql

spool comp_all.sql
select
decode( OBJECT_TYPE, 'PACKAGE BODY',
'alter package ' || OWNER||'.'||OBJECT_NAME || ' compile body;',
'alter ' || OBJECT_TYPE || ' ' || OWNER||'.'||OBJECT_NAME || ' compile;' )
from
dba_objects
spool off

I could not c comp_all.sql in anywhere of my file system. Any suggestions would be much appreciated. Thanks!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Database query

I am getting an error function in date formate while importing the date ccolumn in oracle sql developer tool My date format in table is 6-Nov-14 and while importing its converted to 6/11/14 eventhough the format is as 6-Nov-14 in excel. could you please let help me out what I need to change... (6 Replies)
Discussion started by: ramkumar15
6 Replies

2. UNIX for Dummies Questions & Answers

#Spool/Query executing with extra space.

Hello, I have a requirement where i have to spool some data to a file. i have achived the desired target but m facing one issue. i have attached the script and the output. i checked the data length in the table but it is only 45 for column 1. can you tell me how to remove these extra... (4 Replies)
Discussion started by: Mohammed_Tabish
4 Replies

3. Shell Programming and Scripting

SQL*PLUS Spool Output

Hi, Im writing a script to run a bit of sql(via sqlplus) that pulls back some data and spools it to a file, I want the spool file to only display the data, with no sql command at the top and no reports at the bottom ie(# of records recieved). I am currently doing it via a grep command but... (1 Reply)
Discussion started by: Magezy
1 Replies

4. Shell Programming and Scripting

Help supressing spool output from screen when calling sqlplus from script

I'm calling an embedded sql from my shell script file. This sql does simple task of spooling out the contents of the table (see below my sample code) into a spool file that I specify. So far so good, but the problem is that the output is also displayed on screen which I do NOT want. How can I... (3 Replies)
Discussion started by: MxC
3 Replies

5. Shell Programming and Scripting

manipulate & format the output of spool command

Hi All, I am spooling the data some sql queries into a single file but wanted to know how to format the data of the file generated by spool. #!/bin/sh unset -f USAGE USAGE () { clear echo "############################USAGE#######################\n" echo "Incorrect number of... (2 Replies)
Discussion started by: ss_ss
2 Replies

6. Shell Programming and Scripting

Need help with a sh script to spool directory and modify the output (Oracle cnt file)

Hi, I'm creating a shell script to dynamically create a recreate controlfile for an Oracle database. I need to read a cold backup file system, and make some changes to these files. Let's say for argument sake the directory name is /ebsprod_c/oradata and it looks like this:... (6 Replies)
Discussion started by: exm
6 Replies

7. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

8. Programming

Single sql query to spool to multiple files

Is there anyway to spool my select statement into spool files of max 10000 records each? eg I have a select statement that will return 45000 records. A normal spool command will output the 45000 into just one spool file. How can I make sqlplus do this? 00001 - 10000 records --- spool... (3 Replies)
Discussion started by: Leion
3 Replies

9. Shell Programming and Scripting

Database Query

Hi, Am using informix database. When i give "isqlrf <database name> - " from the command prompt , i get connected to the database and i can run sql queries.. I am moving to freeBSD and when i give the same command at the prompt i get an error : Index already exists on column Why is this... (0 Replies)
Discussion started by: jisha
0 Replies

10. Shell Programming and Scripting

query to get a value from database

Hi friends, I have written a script which retrieves one value from the database. It takes time for the sql query to get the desired output. So the query runs fine from TOAD or from UNIX console. However if I put this in a script it doesn't work. The script is as below. #! /bin/ksh... (2 Replies)
Discussion started by: vivek_damodaran
2 Replies
Login or Register to Ask a Question
uuaids(8c)																uuaids(8c)

Name
       uucompact, uumkspool, uurespool, uupoll - uucp utilities

Syntax
       uucompact -ssystem
       uumkspool system ...
       uurespool [ -t# ]
       uupoll system ...

Description
       All of the commands are located in

       The  command  compacts  uucp  system spool directories and associated subdirectories. If system is ALL, then all existing uucp system spool
       directories are compacted.  Otherwise, only the specified system spool directory is compacted.  If no system is	specified,  is	compacted.
       If  is stopped before it is finished, it can be restarted without reprocessing directories.  The command continues processing where it left
       off during it's previous instantiation.

       The command makes a per system spool directory and associated subdirectories for each of the specified systems.	For example, if system	is
       mk3 and if the local system name is penny, the following directories are created:
	       /usr/spool/uucp/sys/mk3
	       /usr/spool/uucp/sys/mk3/C.
	       /usr/spool/uucp/sys/mk3/X.
	       /usr/spool/uucp/sys/mk3/D.
	       /usr/spool/uucp/sys/mk3/D.penny
	       /usr/spool/uucp/sys/mk3/D.penny
       The  command  moves files from old spool directories to	new spool directories.	Because the structure of the spool directories has changed
       from older versions of it is necessary to respool old spooled files to new spool directories in at least two instances:

       o    When installing the current version of

       o    When creating a new system spool directory for each system.

       In the latter case, it is necessary to move files from to the new spool directories.  To ease this task, moves files that have been spooled
       in  one	of 4 formats and respools them under the new spooling structure.  The format is specified by the -t# option, where the number sign
       (#) can be any one of the following:

       o   Original spool - All files are in

       o   Split spool - Contains the subdirectories

       o   Modified split spool -  Contains all subdirectories listed in split spool, and

       o   Used when a new system directory has been created and spool files must be moved from the DEFAULT directory to the new system directory.

       The command forces a connect attempt to the named systems even if recent attempts have failed, but not if the file prohibits the call.  For
       example, the file will prohibit the call if it is the wrong time of day.  Thus, the should be monitored for messages about the connection.

Files
       Spool directory

       Logfile

See Also
       mail(1), uucp(1c), uux(1c)

																	uuaids(8c)