How to automate running scripts.

Moved from another forum.
I want to run the following commands on a weekly basis with the Windows Scheduler:
sqlplus / as sysdba
alter database flashback off;
rman target=/
delete noprompt archivelog all;
delete noprompt backup of database;
delete noprompt copy of database;
Not sure how to pass the commands and also make sure the previous command is complete before the next one runs.

Max wrote:
Hey Opus,
I think your requirement is to create a windows batch file and run it using windows scheduler...am i right?
If yes do it like this;
You need 3 files..just for simplifying the problem..
create a batch file like ...... mybatch.bat (should have *.bat* extension)Why should it have the *.bat* extension? Why not *.cmd*? I've been around since before DOS 2.0 and remember that .cmd was supposed to replace .bat. Interesting discussions if you google "bat vs. cmd".
insert below commands there..
sqlplus /nolog @c:\sqlpluscom.sql
rman target=/ cmdfile="c:\rmancom.sql"
Now create sql file like below and place it in C:\ drive and insert commands below
sqlpluscom.sql
connect / as sysdba
alter database flashback off;
exit;
I believe the database has to me in MOUNT (not OPEN) mode for the above
>
Now create another sql file named rmancom in C:\ drive and place the commands below
rmancom.sql
run{
delete noprompt archivelog all;
delete noprompt backup of database;
delete noprompt copy of database;
}exit;
Now put the batch file in windows scheduler...
Hope this will do for you... :)
Thanks,
Max

Similar Messages

  • How to automatically run scripts before/after scheduled backup?

    Hi, I want to run some scripts (automatically) before and after a scheduled filesystem backup using oracle secure backup. is it posible?
    thanks in advance

    I've see it: using "after backup" and "before backup" in the dataset definition.
    forget this thread...

  • [SOLVED] How to automatically run modprobe vboxdrv?

    Hi,
    I wonder how to automatically run at startup module vboxdrv such as for example always before running VirtualBox I have to type sudo modprobe vboxdrv and would like to improve this was done automatically. Please help and thank you
    Last edited by formoza (2014-07-28 18:22:46)

    see the wiki for kernel modules

  • How to automatic run a keynote

    hi guy's
    when i send a keynote presentation to a friend, every time he wants to open it , it opens in "work" mode, is there a way that when he double click the kenote presentation it wil automaticly run the presentation?

    In the Document Inspector, there is an option in the Slideshow Settings section to "Automatically play upon opening". Checking this will do what you want.

  • How can I run scripts in CP 8 on a timely bases.

    In CP 8 I want a script to run every second automaticaly, how can I do this?
    The reason for this is that I want the application that I build to check for the GeoLocation every second, so that the arrival at a location that is entered as a variable  can trigger an event (Go to Slide...).
    Now I have the cpInfoGeoLocation checked on Enter of the slide and on Click of a button. But would like it to happen automaticaly.

    Actually ... I had a great discussion with Suresh and the engineering team shortly before the release of Adobe Captivate 8 about just this topic.  The need to call a script on repeating basis is a huge need, and thanks to the great work of the engineering team - it was included in Captivate 8.  Here's how you do it - High level:
    1. Create a slide that you wish to loop on. (In your case this should be a 1 second slide.
    2. On EnterSlide event, store the current frame (cpInfoCurrentFrame) in a variable (call it whatever you like, startFrameSlideN should work)
    3. On Exitslide event, call a script - either an Advanced Action or a Shared Action that uses goToFrameAndPlay with the variable you used for the start  frame + 1 - the trick here is to set up this script to use decision points in sequence that ask your questions - if any of those conditions are met - call a goTo - navigation command and exit the slide loop.  If none of the decisionpoints are met, then simply let the final else (Only the final else) be the goToFrameAndPlay command that returns us to the start frame +1 of this slide.
    Now in earlier versions of Captivate (7 and below) this would not work. Because it would be interrupted and simply pass on to the next slide after one failed loop through all of the decision points.  But now this will loop infinitely - so be very sure that you include a  navigation button to let the user escape the slide loop - or you'll get permanent pause if the conditions are never met.
    I'll blog about this next week here: http://blogs.adobe.com/captivate/
    You could use this for some of the following (certainly loads of other things too.): 
    1. loop on a slide while comparing GPS to make a self-popping trigger when the learner walks / drives into a gps matching zone
    2. PUSH messaging.  Give cp a location where messages are stored - then if you add text to that messaging online text - it will get pushed to your application when the loop occurs.
    3. Dynamic update of course content - loop on a slide and load any variable
    Tons of other stuff i'm sure.
    --Allen

  • How can I run script every 10 minutes

    Hello ,
    I just wondering if oracle application server has a way to run a normal java class,servlet or JSP for every (for example) 10 minutes.
    I mean I want to automate a java class for a spesific time like running a script on UNIX using CRON JOB
    Regards

    Mr. user510124,
    Please try to be as specific as possible. Mr. Raghavendra has given you a very good solution, which you can use. Other possible solution would be to schedule it with crontab (Unix) or using Oracle Grid Control.
    Regards,
    Martin

  • How do I run scripts in Acrobat.

    This is simple I know but my only experience is with Indesign and there is an SDK and a pallette that the user selects from. I am not sure if acrobat shares any similarities. Any help or direction would be appreciated.

    Read this:
    http://acrobatusers.com/tutorials/where_js_goes

  • How to automatically run javascript code from Captivate 3?

    Howdy everyone,
    My company uses a custom webpage to display the finished SWF files generated by Captivate 3.  This page has menu buttons on the side that link to other videos that are related to the video being watched.
    We want to add a little bit of spice to the menu, and highlight the next video in the series after the current SWF has finished playing.
    Now I know that Captivate 3 will launch a Javascript code when either a button is pushed, a text box is used, or a clickbox is activated, but we are looking for a way for Captivate 3 to launch a Javascript code apart from user input.  Any suggestions?

    Hi there
    One of the options you have available when Captivate finishes playing a movie is to Execute JavaScript. Perhaps use that?
    Click Edit > Preferences...
    Cheers... Rick
    Click here for Adobe Certified Captivate and RoboHelp HTML Training
    Click here for the SorcerStone Blog
    Click here for RoboHelp and Captivate eBooks

  • Cron job : how to run scripts as cron job

    Hi friend,
    Sorry one very small question ..
    Can someone tell me how can i run scripts as cron job .. on HP UX.
    thanks
    ashish

    Hi Ashish,
    open one telnet session.
    crontab -e
    then give the periodicity day and time
    like below
    05 00 * * 1-6  /usr/local/bin/database_backup.sh
    and now create the script file with the command or script to execute.
    Regards
    Ashok Dalai

  • Automatically run applications on start up

    Hello all:
    Does anyone know how to automatically run certain applications such as Mail on start up? I don't think this is an automater function but not completely sure.
    Thanks in advance!

    Wow, that was really too easy. Cannot believe I didn't figure that out as I have right clicked on dock icons many times before and never noticed that. Thanks so much!

  • Run script with .pkb extension

    How do I run scripts from sql developer? I tried: file - open - mypackage.pkb. Opens file. When I do Run - Run File, I get: "The target metrics_pkg.pkb cannot be started because it is not a runnable target."
    Ok, maybe I should just use @mypackage.pkb as if I was in sqlplus. Nope. I have not told it where my script resides, so I get: "Unable to open file: "C:\Documents and Settings\mthompso\metrics_pkg.pkb".
    I assume there is some way to set the directory for running scripts?

    Couple of things to try here.. Don't use 'Run****' from the run menu. There is a green arrow on the editor that will only be available if a target is runnable.. If it is greyed out, you don't have a connection associated. Additionally, if the drop-down list on the upper right hand side doesn't show a connection, it won't run.
    And a hint to the development team.. please disable the run option under the run menu if it is not runnable :)
    Eric

  • How to make OTM scripts to run on remote machines

    Hi,
    I came across lot of posts which tells how to configure OTM to connect to remote machines.
    Some how i dont understand when they say stop the OATS service and configure it manually
    Also to use the password for authentication manager.
    What i really want to know is step by step for a layman to set up OTM to run scripts on a remote desktop and on the local with the execution being displayed (not suppressed)
    How do we configure that?
    Any help is deeply appreciated!! my test cases are just stuck inprogress status
    Thanks
    Radhika

    Hi Radhika,
    For running Scripts from either the server or the remote machine using OTM you need to run the Agent Manager service as a console not the OATS service. For that you need to stop that service--> set the startup type as manual--> the run the ' C:\OracleATS\agentmanager\bin\AgentManagerService.exe –c AgentManagerService.conf ' command in the CMD to run this service as a console. Because this agent manager service is for OLT to communicate with its agents and works fine even if it is set to automatic or manual and started normally. Hope this helps.....
    Regards,
    Charles Kingsly

  • How to automatically create the custom migration scripts after recreating SSMA project?

    How to automatically create the custom data migration scripts after recreating SSMA project?
    There is number of tables ( big tables with BLOBS)  which I want to set up automatically to be migrated with custom migration scripts (replacing e.g. attribute named "FILE" with "TO_BLOB('') AS FILE" ).
    So the question is how to open MB file (I think that it should be standard db of some destktop RDBMS) ? 

    Hi Roman.Pokrovskij,
    According
    to your description, we can use SSMA tool to migrate data from one database (including Access, Oracle and so on) to SQL Server via GUI or the scripts. There is an example about migrating Access database to SQL Server via the
    custom migration scripts, you can review refer to them.
    <?xml version="1.0" encoding="utf-8"?>
    <ssma-script-file xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Microsoft SQL Server Migration Assistant for Access\Schemas\A2SSConsoleScriptSchema.xsd">
    <config>
    <output-providers>
    <output-window suppress-messages="false"
    destination="stdout"/>
    <upgrade-project action="yes"/>
    <data-migration-connection source-use-last-used="true"
    target-server="target_1"/>
    <progress-reporting enable="false"
    report-messages="false"
    report-progress="off"/>
    <object-overwrite action="skip" />
    </output-providers>
    </config>
    <servers>
    <!-- Server definition for Sql server target server-->
    <sql-server name="target_1">
    <sql-server-authentication>
    <server value="$SQLServerName$"/>
    <database value="$SQLServerDb$"/>
    <user-id value="$SQLServerUsrID$"/>
    <password value="$SQLServerPassword$"/>
    <encrypt value="true"/>
    <trust-server-certificate value="true"/>
    </sql-server-authentication>
    </sql-server>
    </servers>
    <script-commands>
    <create-new-project project-folder="$project_folder$ "
    project-name="$project_name$"
    overwrite-if-exists="true"/>
    <connect-target-database server="target_1"/>
    <load-access-database database-file="$AccessDbFolder$\$AccessDatabaseFile$"/>---
    <!--Schema Mapping-->
    <map-schema source-schema="$AccessDatabase$" sql-server-schema="$SQLServerDb$.dbo" />
    <!-- Convert schema -->
    <!-- Example: Convert entire Schema (with all attributes)-->
    <convert-schema object-name="$AccessDatabase$"
    object-type="Databases"
    conversion-report-overwrite="true"
    verbose="true"
    report-errors="true" />
    <!-- Synchronize target -->
    <!-- Example: Synchronize target entire Database with all attributes-->
    <synchronize-target object-name="$SQLServerDb$.dbo"
    on-error="fail-script" />
    <!-- Data Migration-->
    <!--Example: Data Migration of all tables in the schema (with all attributes)-->
    <migrate-data object-name="$AccessDatabase$.Tables"
    object-type="category"
    report-errors="true"
    verbose="true"/>
    </script-commands>
    </ssma-script-file>
    There is a similar scripts about migrating Oracle database to SQL Server, you can use powershell script to automatically run the console for scripts/variable files, saved in the specified folder. For more information, review the following
    article.
    http://blogs.msdn.com/b/ssma/archive/2010/09/09/performing-database-migration-assessment-using-ssma-console-application.aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How can I disable the Photos app from automatically running when I plug in my iPhone?

    How can I disable the Photos app from automatically running when I plug in my iPhone?
    I have no intention of ever using Photos, in fact, having to abandon Aperture takes me one step close to moving back to Windows, but I digress.
    I just want to NOT have to kill the Photos app every time I plug in my phone.
    Thanks.

    I am still seeing the option Image Capture, like shown in the screenshot that Rysz posted.   But it is another example of the hide-and-seek Apple likes to play with us.
    The option has to be set for each device individually. With the device connected to USB, you have to click the tiny disclosure triangle in the lower left corner of the sidebar to reveal the option.
    I was perfectly happy with the program I paid for (Aperture), and now to maintain the functionality I have to pay for another application (LightRoom) to get the functionality that I paid for in Aperture.
    Aperture 3.6 is working well with Yosemite. I will use it, as long as I have a Mac, that will run Yosemite or a compatible system.
    Have you looked at Capture One?  It looks much more similar to Aperture than Lightroom.

  • How can I run a SQL script file...

    How can I run a SQL script file from a location on my computer without providing the whole path?
    Is there some way I can set a "Working folder" in SQL Plus??
    Thanks!
    Tom

    You can create an environment variable called "SQLPATH" which is a list of directories that SQL*Plus will search for your .SQL
    scripts.
    I would like to use another directory than the oracle/bin...
    How can I do this ??
    Hello,
    U can do this by this way:
    Save odm_script.sql file to the default Oracle
    directory i.e. Oracle-Home/bin and Run following command
    through SQL Plus.
    SQL>@Script_Name
    I hope this will resolve ur problem.
    Regards,
    Omer Saeed Khan.

Maybe you are looking for