Spool file from cron

Hi,
I have the following script:
#!/bin/ksh
ORACLE_HOME=/u01/app/oracle/product/8.1.7
export ORACLE_SID=portal
DATE=`date +%m%d%y`
TIME=`date +%H:%M:%S`
/u01/app/oracle/product/8.1.7/bin/sqlplus -s /NOLOG <<-!! 2>&1
WHENEVER SQLERROR EXIT 999
WHENEVER OSERROR EXIT 998
connect scott/tiger@portal
set heading off
set verify off
set feedback off
spool /export/home/oracle/test.log
select to_char(sysdate,'DD-MM-YY:HH:MI') from dual;
spool off
--when I run this script manually, it creates the spool file, but when I run this script from cronjob it's not creating the spool file. what is the problem??
-GK

ORACLE_HOME=/u01/app/oracle/product/8.1.7this variable is not exported.
If you are using the same Unix user to run the script manually and from cron, it could be an environment setting problem.
Try to insert this line as the first line in the script :
. $HOME/.profile

Similar Messages

  • Can I download a spool file from ALV payroll recon report in Fixed Ascii?

    We have a process that imports the spool files from our various nightly payroll recon reports but have recently upgraded to ECC 6.0 and the ALV formatted report does not appear to create a fixed format spool file - the width of the columns changes from spool to spool based on the contents.
    Does anyone know how to accomplish our need?
    Thanks,
    DeWayne

    Does the printer show up in the Windows Printers folder?  We've used PDF995 or Cute pdfwriter for years.  All of these create virtual windows printers.  When you print to them, a dialog box pops up asking for the filename for the pdf.  If you have Activex calls to Excel in order to open a file, you should be able to make ActiveX calls to print it to a print driver such as this.  I don't know if any of these drives have a way to bypass the filename dialog box.  That may take some research and experimentation.  I don't know where the postscript file comes into play in the scenario you are describing.

  • Seek help to format spool file from SQL*PLUS

    I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
    DUMMY
    DB_NAME
    I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
    Conn system/password@Oracle_SID
    How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!

    Hi,
    It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
    You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
    What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script.

  • Reading Spool files from AS400 through JAVA Applications

    Hi,
    i am trying to read spool fiels through my java application with the help of jt400.jar files,which is developed by IBM.When i try to display the content of the spool file the result is look like this and give some ideas to come out from these
    problems.
    thanks in advance
    selvin
    --- 4- 4++++�+-+@z 4++-_��++_� 4+3@+@+@_���������@M_�����?�] 4+
    s+-�+@z 4+@@@@� � 4+__++@+-@z 4+___ 4+++++++ 4+s--�+@z 4+z_a_�a___� � 4+:-
    ?��@z 4+B__a_�a___� 4+s�+++@z 4+|��z_�z_� � 4+:-�?���@z 4+C__� 4+G` 4+I___ �� 4+
    -�?��� 4+-�?��� 4+B���?�@+�M�] 4+T@@���?� 4+j���?�@_?��� � 4+@+��� 4+@+?�� 4
    B��@����� 4+T+�?����� 4+k��@_�?��� � 4+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~ � 4+__� 4+
    ---++ 4+B@@@@_ 4+Q@@@@@@@@@@_ 4+j@@@@@@@@@@@@@@@@@@K__ � � 4+___ 4+
    ---_++++--+ 4+B@@@@_ 4+Q@@@@@_�k___ 4+j@@@@@@@@@@@@_�k_�_K__ � � 4+___ 4+
    ---++++� 4+B@@@@� 4+Q@@@@@�k___ 4+j@@@@@@@@@@@@__k___K__ � � 4+___ 4+
    ----- 4+B@@@@_ 4+Q@@@@@@@@@@_ 4+j@@@@@@@@@@@@@@@@@@K__ � � 4+@@@@@@@@@@@@@@@@@@
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ � 4+'�+--@��-+@z 4+C@@@@_ 4+R@@@@@�_k___ 4+
    k@@@@@@@@@@@@��k��_K__ � 4+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @@@@@@@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If you were expecting the spool file to be translated to ASCII with carriage returns, line feeds, and form feeds, here is the magical piece of code:
    SpooledFile splf = new SpooledFile(sys, splfName, splfNum, jobName, jobUser, jobNum);
    PrintParameterList pl = new PrintParameterList();
    pl.setParameter(SpooledFile.ATTR_MFGTYPE, "*WSCST");
    pl.setParameter(SpooledFile.ATTR_WORKSTATION_CUST_OBJECT, "/QSYS.LIB/QWPDEFAULT.WSCST");
    InputStream in = splf.getTransformedInputStream(pl);
    For reasons not immediately clear to me, the first character in the file appears to be a null byte (hex 0). I also believe that CRs and LFs only appear as needed to return to the beginning of the line (CR) and the feed one line (LF). It is permissible for example to have <data><CR><LF><LF><LF> (i.e. feed three lines). I also assume that <data><CR><data><CR><LF> would result in overprinting (missing line feed). I have even seen <data><CR><CR>, and I assume the second CR should be ignored.
    I have not exhaustively tested these scenarios, but from some of the problems we've had, the above description seems like a reasonable way to think about the data stream

  • Download Tab Delimited file from spool!

    Hi Experts,
    Is there any way to download tab delimited txt file from spool?
    Spool is created for Statements and Invoices from Sap Script and Smartform which is in OTF format.
    I am able to download this in Text file but I need this file in tab delimited format.

    I don't understand what you want to do as it seems impossible : the spool contains miscellaneous data, not compatible with tab delimited files which are used to store 2-dimensional tables (columns, rows).

  • Hello, How do I tell sql+ to spool output file from windows to Unix server?

    Hello, How do I tell sql+ to spool output file from windows to Unix server?
    I am new to SQL+ and just learned how to spool the file. But file is saved in my local windows enviroment and since it's 2GB in size...I want to spool it directly to another remote unix server.
    Pls answer in detail... I have been to most of the thread and didn't see relevant answer to above question.
    Am I suppose to develope some script which FTP the spool file directly to the server I want to
    or
    i Have to use UTL_FILE Package ?
    Thanks for reply

    You may not be able to...
    SQL*Plus can only spool to the local machine. If you have mapped a directory on the Unix server from your Windows machine, you can specify that directory in your SPOOL command.
    You could telnet to the Unix server, run SQL*Plus there, and spool the file to a local (Unix) directory.
    If the Unix server is also the Oracle database server, you could use the UTL_FILE package rather than using SQL*Plus to spool a file.
    If the Unix server is also an FTP server, you could also FTP the file from your local machine to the server.
    Of course, I would tend to re-examine a requirement to regularly generate a 2 GB text file. It seems likely that there is a better way...
    Justin

  • I want read PDF file from SAP directory and create a spool request or print

    Hi all,
    I want read PDF file from SAP directory and create a spool request or print the pdf through SAP. Can any body  help me in this.
    Also please write to me if its possible to open PDF from SAP directory to adobe pdf reader.
    Thanks in advance,
    Sunny

    Hi Sunny,
    Check these links.
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    http://www.erpgenie.com/sap/abap/pdf_creation.htm
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • Best way to spool DYNAMIC SQL query to file from PL/SQL

    Best way to spool DYNAMIC SQL query to file from PL/SQL [Package], not SqlPlus
    I'm looking for suggestions on how to create an output file (fixed width and comma delimited) from a SELECT that is dynamically built. Basically, I've got some tables that are used to define the SELECT and to describe the output format. For instance, one table has the SELECT while another is used to defined the column "formats" (e.g., Column Order, Justification, FormatMask, Default value, min length, ...). The user has an app that they can use to customize the output...which leaving the gathering of the data untouched. I'm trying to keep this formatting and/or default logic out of the actual query. This lead me into a problem.
    Example query :
    SELECT CONTRACT_ID,PV_ID,START_DATE
    FROM CONTRACT
    WHERE CONTRACT_ID = <<value>>Customization Table:
    CONTRACT_ID : 2,Numeric,Right
    PV_ID : 1,Numeric,Mask(0000)
    START_DATE : 3,Date,Mask(mm/dd/yyyy)The first value is the kicker (ColumnOrder) as well as the fact that the number of columns is dynamic. Technically, if I could use SqlPlus...then I could just use SPOOL. However, I'm not.
    So basically, I'm trying to build a generic routine that can take a SQL string execute the SELECT and map the output using data from another table to a file.
    Any suggestions?
    Thanks,
    Jason

    You could build the select statement within PL/SQL and open it using a cursor variable. You could write it to a file using the package 'UTL_FILE'. If you want to display the output using SQL*Plus, you could have an out parameter as a ref cursor.

  • How dowloand a file from spool ?

    Hi expert,
    I have some file in the spool, I would download the file from spool and store it in local.. how can I do it ?
    some function or transaction ?
    tks,
    bye.

    Hi,
    For Download in pdf format you can also follow the code bellow.
    DATA: pdf LIKE STANDARD TABLE OF tline WITH HEADER LINE,
          pdf_bytecount TYPE i.
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid   = '10302' " Spool Request Number
      IMPORTING
        pdf_bytecount = pdf_bytecount
      TABLES
        pdf           = pdf.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        bin_filesize = pdf_bytecount
        filename     = 'C:\TEST.PDF'
        filetype     = 'BIN'
      TABLES
        data_tab     = pdf[].
    Hope will solve out your problem,
    Best Regards,
    Faisal

  • Is there a FM or program to create a postcript file from a SAPScript spool?

    Does anyone know of a Function module or ABAP program that will create (an external to SAP) postcript file from a SAP Script spool?
    I can create a PDF using program RSTXPDFT4 but I need a physical Postscript file.
    I have found this note about postscript:
    "use RSPO_PROCESS_DIALOG_JOB to use spooler and device type POSTSCPT to convert OTF to PostScript"
    But when I run the function module RSPO_PROCESS_DIALOG_JOB for my SAPScript spool file I get the message: Printjob not found 128
    Has anyone solved this problem before?
    Thanks,
    Bev.

    I got the same issue: Acrobat won't create pdfs, but keeps asking me for the serial number.
    I use Acrobat 10.1.16 (within CS 5.5 Teacher's Edition) on a Windows 7 (64) Notebook.
    An update to fix this issue would be great.

  • How to move PDF file from Spool to Application Server?

    How to move PDF file from Spool to Application Server?
    Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
    RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
    The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.

    Hi Gemini ,
    Please refer the below links.
    [http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
    [http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
    Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM

  • Generate Excel file Automatically of Spool Ouptut from Spool request

    In 4.6C version how do i code to download Excel file of spool output from its spool request number?

    hi
    please if u know this ans pls send me...........
    but think like this .......
    it will create seperate image for u
    Regards Prasad
    Edited by: EV prasad on Nov 26, 2008 4:55 AM

  • Pulling data from spool file

    Does anyone know if it is possible to take say a spool file that you created intead of printing something and using jsp to scan the file and pull info out of it and place it into database fields? For example if the spool file contains info such as name, date, description, Is it possible to write soemthing in jsp or java that can pull it out and put it into say table in a mysql, sql server, or oracle db? I don't need to know exactly how, but rather can it be done? In not, any suggestions on how? Ie using asp, php, cfm? Any input would help greatly
    Regards,
    John

    not sure what format the spool file is in, but it is pretty easy to open and read a text file in with java. Then you can just parse the file. jdk1.4.1 even has out of the box support for regular expressions.(regex) if needed. Once you have parsed it, also easy to insert into mysql,oracle etc. using jdbc.

  • /sapmnt/SID/GLobal SPOOL Files

    Hi
    We are using Adboe forms and when spool request generate for the Form, there are three files generating on the OS Level @ /sapmnt/SID/global directory. The three files as follows.
    SPOOL0000014229_00001.xfd
    SPOOL0000014229_00001.pcl
    SPOOL0000014229_00001.cfg
    We have hundresds of PDFs getting generated everyday and its filling up the FILE system at OS level. These files are deleted when we delete the spool request from SP01.We would like to know if there is any process where we can delete the files from he OS level or can we change in the program tp change path of the files to store in diffrent location.
    Regards,
    Mahesh Shetty

    if there is any process where we can delete the files from he OS level !!
    You can use the cron utility (unix) at OS level to delete files from the @ /sapmnt/SID/global directory
    .For eg  : To delete files older than 2 days schedule the below command through cron to run daily .
    find /sapmnt/SID/global/ -mtime +2 -type f -exec rm {} \;  (Be careful )
    or from SAP level schedule the report  RSPO1041 daily to delete spool files.Thanks
    Other wise ,if you are using a particular output device to generate the spool you can do the following for the device in transaction SPAD
    SPAD -> Change output device -> Edit -> Data storage. and choose storage as database.
    Regards
    Amit

  • Spool file problem,Can't see the query in output file.

    Hello ,
    I am facing a very old school kind of problem .....about spool file ....
    The scenario -
    I have made a script by name DB_Status_checkup.sql which i want to fire on the database to check the database status. In this script their are many queries regarding the data dictionary views to know about the database. It consist of nearly 25-30 different select queries..
    The problem is i want to make a spool file of the output of that query....i want to see the SQL query & the output below in the spool file, so it will be easy for me to judge the result. But i can't see the SQL query , i can only see the output , & in so many queries it all gets jumbled up....even i can't understand where the next output starts ...
    Sample of my SQL Script ....
    clear buffer
    spool D:\DB_status.txt
    /*To check the database startup time*/
    Select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
    from v$instance
    .........next query n so on....
    spool off;
    In the output pf the spool file at D:\db_status.txt..
    Startup time
    08:25 16-JUL-10It shows only the output of the query in the spool file not the query,
    What should i do to get the SQL query as well as the output of that query just below it in the spool file ???
    Please suggest if you have anymore ideas , regarding this .....
    ORACLE 10g R2
    Windows Server 2008
    Thanks in advance ...

    Why don't you just use database control, instead of re-inventing the wheel?
    Apart from that, SQL*Plus has it's own reference manual, which you apparently refuse to read.
    The answer to your quiz/doc question is
    set echo on
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • Problem in saving values using transaction variant for IR02 transaction

    Hi All,               I need a help on creating the transaction variant. Please find the scenario below. In my Program, I had given a link to change the work center capacity (Intervals and Shifts) in IR02 transaction by BDC. 1.       Created a transa

  • Cisco ISE Certificate error.

    Cisco ISE 1.1.1 is given Certificate error while trying to access any of nodes. It is started after adding other nodes in to primary node. Accessing by IP's redirect to other nodes suppose if we accessing primary admin node by IP, it redirect to othe

  • How to import from dropbox into FCPX?

    Hi, Can FCPX use shared disks or Dropbox folder for import?

  • Problem with age restriction

    Hi guys. I was trying to download an app from featured points today, it's called modern combat zero hour, but when I redeemed the code, the age restriction popped up and I clicked okay. But when I clicked okay. It just took me back to the code redeem

  • CUIC REPORT for 8.5

                       Dear Team Is there any way to get the SQL Queries for UCCE 8.5 and run it from Sql Server , also how we can get a report to calculate abandoned calls with percentage. Please advise we are face data calculation issue with exiting CU