Daily Export of a Query

I am VERY new to Oracle and SQL Plus. I've been tasked with automating a query to run unattended daily to export data and store it in a flat file with structured naming convention (CC_MMDDYY.exp). I need to have it be able to an "on demand" query to flat file too. Any help would be appreciated.

You should further specify and break down your goals in at least two tasks, one for the export and the other for the ascii dump (that's what it seems to be your goal), and don't expect to get the 'magic' script from the forum.
In order for you to be able to get ascii dumps from a table you should be able to master the SET commands in sqlplus CLI so this tool can SPOOL the output to an ascii text file without 'garbage' in a tabular format, or in a variable size record format.
Next you should schedule it, if you are on unix by means of cron, and if you are on windows by means of the windows scheduler.
~ Madrid
http://hrivera99.blogspot.com/

Similar Messages

  • Daily Export

    I want to schedule a daily export using the EM on all my databases, but this seems to be impossible?
    When you define an export using the EM, you can schedule it, but there is no repeat option? Also in the job tab you can create new jobs, but there is no specific Export job.
    What I tried was scheduling an export, and then do an edit of this job. Then you can put it on repeat and safe the job in the library. But when you try to submit the job, you get en 'One or more required job paramters are missing.' error.
    Does anyone has a solution for this problem?
    Regards,
    Stevne

    I have the same problem.
    So i looked around and found this answer on Metalink by Oracle:
    "However please note that Edit is not supported for this job type, only general information about the job can be updated. Therefore you cannot schedule repeated executions for this job type. This is an enhancement request. "
    It is ridiculous that they took something out that was always in there. Because they want to push export/import back, they just kinda quit supporting it in this way.
    I'm a big fan op RMAN, which they support totally, but with database that are not running in archivelog mode, i'm much more flexibele with a dump file so i can correct little errors (like a dropped table).
    A big thanks for nothing goes out to Oracle!

  • Daily export backup (via datapump) of a 600GB production database

    Hi Guys,
    I have a 600GB DB.
    10G Database.
    Currently I have daily rman backup to tape.
    Based on your experience, should i bother to perform a daily export of production database of such size?
    Do u think it's useful?
    thanks

    Fran wrote:
    All depends, what do you want to do? Do you have enough space to save a backup and export daily?
    In my opinion with one backup is enough to save your database. I'm sorry, I can't agree with that. I've been in situations where the first, second and THIRD backup sources have been unavailable in the event of a Production restore. I had to go to Plan D and cross my fingers (and sweat a lot). That might be overkill, but you should never rely on just one backup method/source for Production data.
    Not only that, but, obviously, you can also use an export of the data and import into another database or a schema inside the database in case you need to address any logical corruption. We also use the exports to refresh test databases.
    We have many similar sizes of databases and we take exports weekly, instead of daily. An export will be an incomplete backup, obviously, though you can ensure consistency by giving it an SCN to use as a datapoint. You can also run Data Pump in parallel which does speed things up.
    If you use it as part of your backup strategy, I'd make sure I had regular backups of the parameter file and the controlfiles (both binary and trace). I'd also make sure I had regular txt files showing the necessary information for the tablespaces and the datafiles which you can use to recreate the files in case you needed to.
    Mark

  • Export & import of query (SQ01/SQ02/SQ03)

    Hi,
    How to export/import SAP Query (SQ01/SQ02/SQ03) without any transport request.
    waiting for ur reply.
    Thanks in Advance,
    Pranab

    Hi,
    If you dont want to create any transport request number then you need to download/upload the query instead of import/export.
    Please follow the below steps for downloading/uploading the query
    (Go to the system from where you wnat to export the query)
    1. Goto transaction SQ02.
    2. Click on ' Transports' icon (CTRL+F3).
    3. In 'Transport action' select 'Download'.
    4. Select 4th radio button 'Transport Queris'.
    5. Enter the name your user group and query and click on execute.
    6. Give the file name and location where you want to save the query backup and click on save.
    (Now goto the system where you want to import your query)
    1. Goto SQ02 and click on 'Transports' .
    2.  In 'Transport action' select 'Upload' and click on execute.
    3. Enter/select the name of the file which you have downloaded before and click open.
    Please let me know if this is helpful.
    Regards,
    Priya Bhat

  • Error in Excel while exporting from SAP query.

    Hi Gurus,
    While exporting one SAP query to excel the last row/line of information lost partially.
    Means we get some information in the last line of excel but some information is not exported in that same line.
    Can you throw some light on this please....

    Hi
    Due to special Chracters in the Values sometimes this happens when exporting to excel.
    Please download into Unconverted format selection & after downloading Open with excel & save it in excel
    Thanks & Regards
    Kishore

  • Hyperion Workspace Financial Reporting Export to Excel Query-Ready Missing

    Hyperion Workspace Financial Reporting Export to Excel "Query-Ready" option is Missing in the dropdown when you go to File>Export>Excel
    Only the "Fully Formatted" option is available.
    From what I recall this option for a "query-ready" export should be available from the HTML preview?
    Is there something in configuration that needs to be enabled or something that needs to be checked on to get this option?
    We are running 11.1.1.3
    The Query-Ready option is available when exporting forms in Planning.
    When opening Financial Reports in Smartview the option for "Query-Ready" is available.
    For some reason this is not showing up in workspace, does it not exist in 11.1.1.3? Is this a bug?
    TIA

    Hi,
    The option to export the financial report output in "Query-Ready" format is actually at the bottom right hand corner of the report page (look at the report footer) instead of File>Export>Excel.
    Hope this helps
    Genti

  • How to Round on Daily bases in a Query.

    Hi All,
    I have a query which sum the columns between two dates I want to round the sum on the daily bases. My query is written below.
    SELECT sum(S_QTY * S_RATE), sum(S_QTY * S_TOT)
    FROM SAUDA
    WHERE S_PARTY = 'A080' AND S_CITY = 'Z' AND S_TYPE = 'S' AND S_BILL_TYPE = 'd' AND
    S_DATE BETWEEN '2005-03-30-00.00.00' AND '2006-03-31-00.00.00' AND UPPER(S_CITY) != 'F';
    SUM(S_QTY*S_RATE) SUM(S_QTY*S_TOT)
    3700 2.775
    What I want is to round the sum on daily bases, means the values which I am getting is the total sum but not the individual dates. Try to help me.
    SKM

    Try this:
    SELECT sum(round(S_QTY) * S_RATE), sum(round(S_QTY) * S_TOT)
    FROM SAUDA
    WHERE S_PARTY = 'A080' AND S_CITY = 'Z' AND S_TYPE = 'S' AND S_BILL_TYPE = 'd' AND
    S_DATE BETWEEN '2005-03-30-00.00.00' AND '2006-03-31-00.00.00' AND UPPER(S_CITY) != 'F';
    I hope this will solve ur problem.

  • Unattended Daily Exporting of Query to Flat File

    I am VERY new to Oracle and SQL Plus. I've been tasked with automating a query to run unattended daily to export data and store it in a flat file with structured naming convention (CC_MMDDYY.exp). I need to have it be able to an "on demand" query to flat file too. Any help would be appreciated.

    search asktom.oracle.com (temporary unavailable right now) for keyword flat file to obtain a procedure to write the result of a given query to a flat file and that's it. You can then schedule it's execution using DBMS_SCHEDULER or execute it on demand.
    Regards
    Etbin
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:68212348056
    Message was edited by: Etbin
    user596003

  • Oracle Export Error on QUERY Parameter

    Hi All,
    I would like to ask for assistance.
    Here's my environment:
    OS: Linux 5.4 32bit
    DB: Oracle 10.2.0.4
    Here's what I would like to do:
    Export selected rows from SH.SALES table using the query:
    SQL> select * from sh.sales
    where to_date(time_id,'DD-MON-RR:HH24:MI:SS') = to_date('28-DEC-01:00:00:00','DD-MON-RR:HH24:MI:SS');
    My parfile is:
    userid="sys/oracle as sysdba"
    buffer=10000000
    file=mysales148.dmp
    log=mysales148.log
    TABLES=sh.mysales
    query="where to_date(time_id,\'DD\-MON\-RR:HH24:MI:SS\')=\to_date(\'28\-DEC\-01:00:00:00\',\'DD\-MON\-RR:HH24:MI:SS\')"
    recordlength=65535
    statistics=none
    When I run the script, I am getting this error:
    [oracle@shaoran selective_export]$ exp parfile=exp_mysale.par
    Export: Release 10.2.0.1.0 - Production on Thu Feb 3 16:57:08 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in US7ASCII character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P1 character set (possible charset conversion)
    About to export specified tables via Conventional Path ...
    Current user changed to SH
    . . exporting table MYSALES
    EXP-00056: ORACLE error 911 encountered
    ORA-00911: invalid character
    Export terminated successfully with warnings.
    Hope to hear your feedback soon.
    Thanks a lot!

    Hi Guys,
    Thanks for the feedback.
    I edited my parfile as shown here:
    [oracle@shaoran selective_export]$ cat exp_mysale.par
    userid="sys/oracle as sysdba"
    buffer=10000000
    file=mysales148.dmp
    query="where time_id=\to_date(\'28\-DEC\-01:00:00:00\',\'DD\-MON\-RR:HH24:MI:SS\')"
    log=mysales148.log
    TABLES=sh.mysales
    recordlength=65535
    statistics=none
    [oracle@shaoran selective_export]$
    and I did the following steps:
    [oracle@shaoran selective_export]$ export NSL_LANG=AMERICAN_AMERICA.UTF8
    [oracle@shaoran selective_export]$ exp parfile=exp_mysale.par
    Export: Release 10.2.0.1.0 - Production on Fri Feb 4 11:34:03 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in UTF8 character set and AL16UTF16 NCHAR character set
    server uses WE8ISO8859P1 character set (possible charset conversion)
    About to export specified tables via Conventional Path ...
    Current user changed to SH
    . . exporting table MYSALES
    EXP-00056: ORACLE error 911 encountered
    ORA-00911: invalid character
    Export terminated successfully with warnings.
    [oracle@shaoran selective_export]$
    I still get the same error. :(

  • Export using a QUERY parameter

    I am trying to export a subset of data using the following parms:
    FILE=C:\EXPORT\ADM_ACCESS_LOG.DMP
    GRANTS=Y
    INDEXES=Y
    DIRECT=N
    ROWS=Y
    CONSISTENT=N
    TRIGGERS=Y
    CONSTRAINTS=Y
    FEEDBACK=1000
    TABLES=(THRESHER.ADM_ACCESS_LOG)
    QUERY=\"WHERE LOGIN_DT='31-JUL-2005'\"
    The table exists as does the column, however, I get the following error:
    LRM-00101: unknown parameter name 'LOGIN_DT'
    I have everything spelled correctly and I am logging into export as thresher.
    What am I doing wrong?
    Thanks

    use the query parameter like this
    QUERY="WHERE to_char(dte,'mm/dd/yyyy')='07/31/2005'"
    or
    QUERY="WHERE to_char(dte,'dd-mon-yyyy')='31-JUL-2005'"
    --thedba                                                                                                                                                                                                                                                                                                                                           

  • Export dump on Query basis?

    Respected All,
    I want to export oracle dumple file of one table depening on query baisis (for specific dates).
    Whether it is possible or not?
    Kind Regards
    Husnain

    user514721 wrote:
    Dear sir,
    I am using Oracle 9i so data pump as i know is available in 10g.
    C:\Documents and Settings\Jawadi>expdp NASEER/NASEER QUERY=VISIT:'"WHERE VISITDATE IS NOT NULL'"' NOLOGFILE=y DIRECTORY=dpump_dir1 DUMPFILE=exp1.dmp
    'expdp' is not recognized as an internal or external command, operable program or batch file.Sorry, you haven't provided us with the ORDBMS version earlier.
    Expdp - is executable of DataPump, that's why you don't have it. Then try exp.

  • How to export an archive query?

    Hi,
    I created an archive and I did a bunch of account mapping in my DEV, I was wondering if there's a way to run this same archive (import/export) query in my other system so i don't have to do all that mapping again there?, is this possible? (the content is different so im not exporting content, i just want the whole archive mapping I did and the options i checked to be run the same way in other system).
    Thanks!

    Hi
    I think that under the <CS home>/archives/collections there is a file collections.hda / archives.hda and if you open that it should be having the export query that you have set from the applet. Check that out and if that is the one then you can just copy it to the target location and get it working.
    I will check from my instances as well and give you the exact we can get this done.
    Thanks
    Srinath

  • How to export to adhoc query to Excel

    I am trying to export a list of bank account into excel through Adhoc query, when I go to List >> Export >> Spreadsheet, there is only Xml format for me to choose. However, my colleague has the option to choose excel. Is this Windows setting or SAP setting?

    Found the solution.
    SE38 >> SALV_BS_ADMIN_MAINTAIN >> F8
    Here we can select the default application for either global or user specific.

  • Daily Sales Total Comparison Query

    Hi Experts,
    I'm trying to make a query to get daily sales total for week and wish to make a graph.
    However, if there is no figures in credit note or Down payment invoice or invoice then query seems not showing any figures for particular date.
    I would be appreciated if anyone help this.
    SELECT DISTINCT
    GetDate(),
    SUM (DISTINCT T0.DocTotal) AS 'Daily INV Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE DateDiff(D,T0.DocDate,GetDate())=0 AND DateDiff(D,T1.DocDate,GetDate())=0 AND DateDiff(D,T2.DocDate,GetDate())=0
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 1, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 1, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 1, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 1, 0))
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 2, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 2, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 2, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 2, 0))
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 3, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 3, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 3, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 3, 0))
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 4, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 4, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 4, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 4, 0))
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 5, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 5, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 5, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 5, 0))
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 6, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 6, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 6, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 6, 0))
    UNION ALL
    SELECT
    DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 7, 0)),
    SUM (DISTINCT T0.DocTotal) AS 'Daily Sales Sum',
    SUM (DISTINCT T2.DocTotal) AS 'Daily DT INV Sum',
    SUM (DISTINCT T1.DocTotal*-1) AS 'Daily CR Sum',
    SUM (DISTINCT T0.DocTotal) + SUM (DISTINCT T2.DocTotal) - SUM (DISTINCT T1.DocTotal) AS 'Daily Sales Total'
    FROM OINV T0, ORIN T1, ODPI T2
    WHERE T0.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 7, 0)) AND T1.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 7, 0)) AND T2.DocDate = DATEADD(dd, 0, DATEADD(dd, DATEDIFF(dd, 0, GetDate()) - 7, 0))

    Could you let me know how to make pivot query?
                        AR INV TOTAL  |  AR Down Payment Total  | AR Credit Total  | (AR INV TOTAL+AR DP TOTAL-AR CREDIT TOTAL)
    Today's Sales
    Yesterday
    Until Week Before

  • APEX Export Report running query again

    Greetings all!
    Version -
    Oracle 11.2
    Apex 4.1
    We have an Apex report that is generated by calling a function. After the report is displayed in the region, when Export link is clicked to export to CSV, the query is run again. Shouldn't the report be exported without running the query again?
    Is there any settings that needs to be configured to disable running the query again while exporting a report or is it APEX issue?
    Thanks in advance.
    -SS.

    An export of a report is a separate request and it will need to get the data requested and create a CSV file out of it. So, the query will always need to run once again. The report you display on your page will always get only as many rows to the client as requested in the pagination and the condition in your report may ask for many more rows.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

Maybe you are looking for