FYI: My script for a consistent export using Flashback_time

This is my first 'non-question' post, but thought it might be useful to others, as I spent a bit of trial & error getting it to work:
Here is the OS command, to create an export as per a Flashback_time:
SET exportDate=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2% %TIME:~0,2%%TIME:~3,2%00
echo %exportDate%
20100222 092500
expdp '"/ as sysdba"' job_name=mySID dumpfile=dpdump_dir:mySID_FULL.dpdmp logfile=dpdump_dir:mySID_FULL.log flashback_time=\"TO_TIMESTAMP('%exportDate%','YYYYMMDD HH24MISS')\" full=y parallel=2
Here is the same script, except that it is run via an Enterprise Manager Grid Control job - note the difference in the use of the '%' delimiters:
set ORACLE_SID=mySID
del d:\oracle\admin\%%ORACLE_SID%%\dpdump\%%ORACLE_SID%%_full.dpdmp
SET exportDate=%%DATE:~6,4%%%%DATE:~3,2%%%%DATE:~0,2%% %%TIME:~0,2%%%%TIME:~3,2%%00
echo %%exportDate%%
d:\oracle\product\10.2.0\db_1\bin\expdp '"/ as sysdba"' job_name=exp_%%ORACLE_SID%%_FULL dumpfile=dpdump_dir:%%ORACLE_SID%%_FULL.dpdmp logfile=dpdump_dir:%%ORACLE_SID%%_FULL.log flashback_time=\"TO_TIMESTAMP('%%exportDate%%','YYYYMMDD HH24MISS')\" full=y parallel=2
if %%ERRORLEVEL%% neq 0 set TOTALERRORLEVEL=1
Comments welcome

The easiest way I know of to do a consistent export is to use this:
flashback_time=sysdate
This was broken on earlier versions but is fixed in either 11.1.0.7 or 11.2.
Another way is to use a sql file like this:
flashback_sysdate.sql
set echo off
set linesize 132
set heading off
spool time.par
select 'flashback_time=' || TO_CHAR(sysdate, 'YYYY-MM-DD HH24:MI:SS') FROM SYS.DUAL;
spool off
exit
This will produce a file called time.par which can be used as a par file. The problem is if you already are using a par file, datapump only lets you use one parfile.
time.par
flashback_time=2010-02-25 09:20:55
----------

Similar Messages

  • Required to create a script for base table update using XMLSTORE package.

    Hi can anybody provide me some help full suggestion on how to update base table using XMLSTORE package.
    I created a simple script for Employee table and can able to do the basic operation like Insert and update on the table.
    Query is as follow's
    DECLARE
    insCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    xmlDoc CLOB :=
    '<ROWSET>
    <ROW num="1">
    <EMPLOYEE_ID>922</EMPLOYEE_ID>
    <SALARY>1801</SALARY>
    <HIRE_DATE>17-DEC-2007</HIRE_DATE>
    <JOB_ID>ST_CLERK</JOB_ID>
    <EMAIL>RAUSSJACK</EMAIL>
    <LAST_NAME>JACK</LAST_NAME>
    <DEPARTMENT_ID>20</DEPARTMENT_ID>
    </ROW>
    <ROW>
    <EMPLOYEE_ID>923</EMPLOYEE_ID>
    <SALARY>2001</SALARY>
    <HIRE_DATE>31-DEC-2005</HIRE_DATE>
    <JOB_ID>ST_CLERK</JOB_ID>
    <EMAIL>PATHAK</EMAIL>
    <LAST_NAME>PRATIK</LAST_NAME>
    <DEPARTMENT_ID>20</DEPARTMENT_ID>
    </ROW>
    </ROWSET>';
    BEGIN
    insCtx := DBMS_XMLSTORE.newContext('EMPLOYEES'); -- Get saved context
    DBMS_XMLSTORE.clearUpdateColumnList(insCtx); -- Clear the update settings
    -- Set the columns to be updated as a list of values
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'EMPLOYEE_ID');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'SALARY');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'HIRE_DATE');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'JOB_ID');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'EMAIL');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'LAST_NAME');
    DBMS_XMLSTORE.setUpdateColumn(insCtx, 'DEPARTMENT_ID');
    -- Insert the doc.
    rows := DBMS_XMLSTORE.insertXML(insCtx, xmlDoc);
    --COMMIT;
    DBMS_OUTPUT.put_line(rows || ' rows inserted.');
    -- Close the context
    DBMS_XMLSTORE.closeContext(insCtx);
    END;
    SELECT employee_id, LAST_name FROM employees WHERE employee_id = 114;
    DECLARE
    updCtx DBMS_XMLSTORE.ctxType;
    rows NUMBER;
    xmlDoc CLOB :=
    '<ROWSET>
    <ROW>
    <EMPLOYEE_ID>114</EMPLOYEE_ID>
    <LAST_NAME>PRABHU</LAST_NAME>
    </ROW>
    </ROWSET>';
    BEGIN
    updCtx := DBMS_XMLSTORE.newContext('EMPLOYEES'); -- get the context
    DBMS_XMLSTORE.clearUpdateColumnList(updCtx); -- clear update settings
    -- Specify that column employee_id is a "key" to identify the row to update.
    DBMS_XMLSTORE.setKeyColumn(updCtx, 'EMPLOYEE_ID');
    rows := DBMS_XMLSTORE.updateXML(updCtx, xmlDoc); -- update the table
    DBMS_XMLSTORE.closeContext(updCtx); -- close the context
    commit;
    END;
    Nowi want little modification on this above query like as i am passing static XML tags and i want it to pick the dynamic XML from web and use the XMLSTORE for the update.
    and also for complex XML having 2-3 levels how this query needs to be changed.As i am new to this Oracle utillity any help from xepert will be a great help for me.
    Thanks

    Nowi want little modification on this above query like as i am passing static XML tags and i want it to pick the dynamic XML from webFrom a Web Service?
    You'll need UTL_HTTP or HttpUriType interface to send the request and receive the XML response.
    Search in the forum, there are already a lot of useful examples available.
    and also for complex XML having 2-3 levels how this query needs to be changed.DBMS_XMLStore is OK for readily processing a canonical XML format (/ROWSET/ROW/COLUMN structure or alike).
    However, if you have to deal with a more complex structure, you either have to :
    - use a target object table that matches the XML structure
    - preprocess the input document using XSLT to transform it to canonical format
    That's why DBMS_XMLStore is not appropriate for multilevel documents, especially if they contain nested repeating groups.
    In this case, XMLTable is a more flexible way of parsing the XML and process it relationally at the same time.
    Depending on the size of the document, performance may be improved with schema-based object-relational storage.
    For more help, please post a new thread in the {forum:id=34} forum, with the following information :
    - database version (select * from v$version)
    - a sample XML document (the complex one)
    - DDL of your target table
    - mapping between XML elements and columns (ie which tag goes to which column?)
    - an XML schema (if you have one)

  • Build script for CXF web service using ant.

    Hi, I am trying to build a CXF web service using ant. Does any one have a sample build script for it or steps (such as 1. build wsdl using java2wsdl task, 2. create a war etc.....) to follow to successfully build a web service using Apache CXF and ANT? Your help is greatly appreciated. I am using tomcat server and spring.
    Thanks

    Hi,
    You can find and download sample of project and build scripts from
    'Design and implement POJO Web services using Spring and Apache CXF, Part 1: Introduction to Web services creation using CXF and Spring':
    http://www.ibm.com/developerworks/library/ws-pojo-springcxf/

  • Creating a script for a PRIMARY KEY USING INDEX SORT doesn't work

    Probably a bug.
    h1. Environment
    Application: Oracle SQL Developer Data Modeler
    Version: 3.0.0.655
    h1. Test Case:
    1. Create a new table TRANSACTIONS with some columns.
    2. Mark one of numeric columns as the primary key - PK_TRANSACTIONS.
    3. Go to Physical Models and create new Oracle Database 11g.
    4. Go to Physical Models -> Oracle Database 11g -> Tables -> TRANSACTIONS -> Primary Keys -> PK_TRANSACTIONS -> Properties:
    a) on General tab set Using Index to BY INDEX NAME
    b) on Using Index tab choose a tablespace
    c) on Using Index tab set Index Sort to SORTED.
    5. Export the schema to DDL script. For the primary key you will get something like this:
    ALTER TABLE TRANSACTION
    ADD CONSTRAINT PK_TRANSACTION PRIMARY KEY ( TRAN_ID ) DEFERRABLE
    USING INDEX
    PCTFREE 10
    MAXTRANS 255
    TABLESPACE TBSPC_INDX
    LOGGING
    STORAGE (
    INITIAL 65536
    NEXT 1048576
    PCTINCREASE 0
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    ) SORTED
    h1. Reason of failure
    The script will fail because SORTED is not allowed here. It should be SORT.
    Additionally, the default behaviour for Data Modeler is to set Index Sort to NO but default setting for Oracle database 11g is SORT. Shouldn't Data Modeler use SORT as the default value?
    Edited by: user7420841 on 2011-05-07 03:15

    Hi,
    Thanks for reporting this problem. As you say, it should be SORT rather than SORTED. I have logged a bug on this.
    I also agree that, for consistency with the database default, it would be better to have SORT as the default in Data Modeler.
    David

  • Is there a script for CS5 to export a multi-page InDesign Document to single page InDesign documents

    Hello,
    I am having trouble finding a script or utility that would allow me to export each page of an InDesign CS5 document as multiple single page InDesign documents. I have found one script that does this for CS3, but nothing for CS5. Thank you for any help.

    Generally speaking, if a script doesn't run in a later version, you can put it in a subfolder withteh correct version number as the name and it will work. For CS3 that would be "Version 5.0 Scripts" without the quotes.
    That said, if you have Acrobat pro, it's probably easier to use the extract pages command...

  • Script for Button 3 or using side buttons on Mighty Mouse for Button 3

    Looks like the preferences for Mighty Mouse only allow the side "squeeze" buttons to be used for Button 4. I don't want to use the scroll ball for Button 3 because it keeps zooming when i do. Does anyone know how to write a script to configure the side buttons to be Button 3?

    I think I'm having a similar problem. Lately, my side buttons have been activating seemingly on their own. I hear multiple clicking sounds. I know I can turn off the button, but I use USB Overdrive to activate page back in browsers and the Finder, so I can be surfing and be brought back several pages at once. Very irritating. It doesn't seem to be consistent either. I bought my latest iMac in June, so I the warranty should be in place, but I'm an hour and half from the nearest Apple store, making it somewhat inconvenient to have the mouse looked at.
    Heh, right when I was about to post this message, it went back several pages.

  • Login Script for HP Thin Clients using Citrix

    Hi
    Could someone please assist me with this.
    I use a login script on my domain but I am now joining the HP Thin Clients onto the domain which will use SSON (Single Sign ON) which will automatically load citrix and use the current username and password to sign into the citrix session
    Is there a command I can use that will "check" the version of windows and if this is Windows 7 embedded Standard edition, then it will bypass all the commands and go to the end of the script.
    I was trying something like this IF "%OS Version%" == "Microsoft Windows 7 Embedded Standard" goto END
    I know you can use this for a "Computer Name" but we have so many terminals and would need to store all the names of them on the servers.
    Please can someone give me some advise on this.
    Thanks
    Martin

    Hi,
    As far as I know, you can user command systeminfo | findstr /B /C:"OS Name" /C:"OS Version"to check current system edition in
    Command Prompt. However, as I'm not fimilar with script, to need more assistance for your problem, it would be better to provide your question at script center.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
    Roger Lu
    TechNet Community Support

  • Script for request a certificate using other user's credentials

    Hi, 
    I need to request for a certificate using other test user's credential. For this requirement I came up with the following script, 
    cd C:\temp-folder
    Add-Content C:\temp-folder\req.inf "[NewRequest]`r`nSubject=`"CN=Test01`"`r`nRequestType=pkcs10`r`n`r`n[RequestAttributes]`r`nCertificateTemplate=TestUser" #This line would create the inf file
    $username = 'MyDomain\Test01'
    $password = 'Pass1234'
    $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Invoke-Command -Credential $cred -ComputerName localhost -scriptblock {
    certreq -new req.inf certnew.req
    certreq -submit -config "ca.mydomain.com\MyEnterpriceCA" certnew.req certnew.cer
    certreq -accept certnew.cer
    But when it comes to executing the certreq command, the script hangs. Is there a possible way to come around this issue and request a certificate under MyDomain\Test01 user account via a script ? 
    Thank you...

    Hi,
    In MMC you can add Certificates and in personal certificate Advance option you can use ON BEHALF OF users.
    Regards,
    Yan Li
    Cataleya Li
    TechNet Community Support

  • Script for Indesign CS6 - Export Document to preset PDF

    Does anyone know how to do this please?

    Do what? You can't export a document to a preset. You can use a preset to export a document, is that what you mean?
    Check the ESTK object model under Document. Look at the exportFile() method.
    Dave

  • I have a problem with a php script for loading dynamic pages using flash as menu bar, but the urls in the flash is not processed by the php script only in firefox

    '''php script:'''
    <?php
    $page = $_GET['page'];
    if ($page)
    include ("inc/".$page.".php");
    else
    include ("inc/home.php");
    ?>
    '''Action script 2.0 in flash:'''
    on(release){
    getURL("index.php?page=new");
    }

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.
    See http://forums.mozillazine.org/viewforum.php?f=25

  • Is there a script for Windows I can use to make iTunes read CD text?

    I've looked all over and all I cannot seem to find one that works for Windows, only Apple. Thanks!

    Yes, but you can always try customized skins from this site: http://itunes-skins.com/ .

  • Powershell script for when user last used their AD account to login or unlock a computer.

    I want to create a method for determining when a users account would expire after 35 days of inactivity.
    The issue would be not when they last logged on, as many of our users just lock their machines, but when they last logged on or unlocked any computer in the domain.
    I am thinking a combination of last logon with a session unlock parameter.
    In the system logs:
    Event viewer id for logon unlock is 7.
    SessionSwitchEventArg - SessionSwitchReason is SessionUnlock.
    Is this feasible?

    dsget user -inactive 30
    Don't reinvent the wheel.
    http://technet.microsoft.com/en-us/library/cc725702.aspx
    ¯\_(ツ)_/¯

  • Script for export in datapump  -- help needed !!!

    hello all,
    i am using the following script as batch file in my database for export
    script:
    =========
    exp name/password file=d:\exp\%date%.dmp full=y log=d:\exp\exp.log an this will replace the first file(monday) on next monday.
    similar way i need a script for data pump for full database export using datapump
    thanks ,
    gold

    login to database as a dba and create directory for your dumpfile path.
    create directory dpump_dir as 'd:\exp';
    and then use the below script for export.
    expdp username/password full=y directory=dpump_dir dumpfile=%date%.dmp logfile=exp.log

  • Run s a script for to use tmconfig in batch mode failed.

    This is the script for add a server using tmconfig utility:
    $ more add_server.sh
    export EDITOR="echo \"TA_SERVERNAME\t$1\nTA_SRVGRP\t$2\nTA_SRVID\t$3\n\" >>$4"
    tmconfig <<!
    4
    4
    y
    y
    q
    y
    ubb_new.`date +"%y%m%d"`
    This is the outpun when I run the script:
    $ add_server.sh nuevo1 srv 99 s1
    Section: 1) RESOURCES, 2) MACHINES, 3) GROUPS 4) SERVERS
    5)SERVICES 6) NETWORK 7) ROUTING q) QUIT 9) WSL
    10) NETGROUPS 11) NETMAPS 12) INTERFACES [1]:
    Operation: 1) FIRST 2) NEXT 3) RETRIEVE 4) ADD 5) UPDATE
    6) CLEAR BUFFER 7) QUIT [1]: Enter editor to add/modify fields [n]? Perform operation [y]? CMDTUX_CAT:1766: ERROR: tpcall() failed, TPESVCFAIL - application level service failure
    Return value TAEREQUIRED
    Buffer contents:
    TA_OPERATION 4
    TA_SECTION 3
    TA_OCCURS 1
    TA_STATE NEW
    TA_STATUS LIBTMIB_CAT:236: ERROR: SET operation did not specify required key field
    Section: 1) RESOURCES, 2) MACHINES, 3) GROUPS 4) SERVERS
    5)SERVICES 6) NETWORK 7) ROUTING q) QUIT 9) WSL
    10) NETGROUPS 11) NETMAPS 12) INTERFACES [4]: Unload TUXCONFIG file into backup UBB [y]? Backup filename [UBBCONFIG]? Configuration backed up in ubb_new.050304
    I hope that you can help me. Regards.
    Marcela.

    Marcela,
    Your script sets EDITOR to an echo command which appends to $4, which is s1
    in your invocation of addserver.sh.
    However, tmconfig invokes $EDITOR on file /tmp/Ta$$ , where $$ is the
    process ID of tmconfig. Therefore, your script
    appends to s1 but leaves the file actually used by tmconfig unchanged,
    resulting in an error since the name, group, and ID of the new server have
    been left unspecified.
    Try setting EDITOR=vi and adding the fields manually to add your server.
    If you will be adding new servers frequently and want to develop a script or
    program to do this, an ud32 script or a C program invoking the TM_MIB(5)
    interface are probably the easiest ways to do this.
    Ed
    <Marcela Godoy> wrote in message news:[email protected]..
    This is the script for add a server using tmconfig utility:
    $ more add_server.sh
    export EDITOR="echo \"TA_SERVERNAME\t$1\nTA_SRVGRP\t$2\nTA_SRVID\t$3\n\"
    $4"tmconfig <<!
    4
    4
    y
    y
    q
    y
    ubb_new.`date +"%y%m%d"`
    This is the outpun when I run the script:
    $ add_server.sh nuevo1 srv 99 s1
    Section: 1) RESOURCES, 2) MACHINES, 3) GROUPS 4) SERVERS
    5)SERVICES 6) NETWORK 7) ROUTING q) QUIT 9) WSL
    10) NETGROUPS 11) NETMAPS 12) INTERFACES [1]:
    Operation: 1) FIRST 2) NEXT 3) RETRIEVE 4) ADD 5) UPDATE
    6) CLEAR BUFFER 7) QUIT [1]: Enter editor to add/modify fields [n]?Perform operation [y]? CMDTUX_CAT:1766: ERROR: tpcall() failed, TPESVCFAIL -
    application level service failure
    Return value TAEREQUIRED
    Buffer contents:
    TA_OPERATION 4
    TA_SECTION 3
    TA_OCCURS 1
    TA_STATE NEW
    TA_STATUS LIBTMIB_CAT:236: ERROR: SET operation did not specify requiredkey field
    >
    Section: 1) RESOURCES, 2) MACHINES, 3) GROUPS 4) SERVERS
    5)SERVICES 6) NETWORK 7) ROUTING q) QUIT 9) WSL
    10) NETGROUPS 11) NETMAPS 12) INTERFACES [4]: Unload TUXCONFIG file intobackup UBB [y]? Backup filename [UBBCONFIG]? Configuration backed up in
    ubb_new.050304
    >
    >
    I hope that you can help me. Regards.
    Marcela.

  • AE Export script for Blender

    I just discovered there is a relatively new AE  script for Blender that exports camera and null data. Add that to the new interface, hard / soft / fluid dynamics and other stuff and Blender is a great resource for AE users.

    hi,
    create a bat file export.bat and schedule it or run it manually
    (give ur oracle home path)
    export.bat
    del d:\expfulldaily.bat
    C:\oracle\product\10.2.0\db_1\BIN\sqlplus scott/tiger @ c:/genexp_script.sql(give the correct path)
    c:/genexp_script.sql
    set linesize 250;
    set pagesize 0;
    set echo off;
    set feedback off;
    set heading off;
    set trimspool on;
    spool D:\expfulldaily.bat;
    select 'c:\oracle\product\10.2.0\db_1\BIN\exp userid=scott/tiger full=y buffer=50000 consistent=y statistics="none" ' || ' file=d:\orcl_' || to_char((sysdate),'dd_mm_yyyy') || '.dmp' || ' log=d:\orcl_' || to_char((sysdate),'dd_mm_yyyy') || '.log' from dual;
    spool off;
    exit;
    to run next time.. you just run the export.bat file... the export it automatically called from genexp_script.sql.. before that it deletes the old entry..
    regards,
    Deepak

Maybe you are looking for