Auto run sql script when DB opens

Is it possible to configure a DB so a given SQL script is run each time the database opens?
Thanks a lot in advance.

rafadc wrote:
Is it possible to configure a DB so a given SQL script is run each time the database opens?
Thanks a lot in advance.Either include the script in a startup script for the database, dbstart on *nix you'd need to write your own on windows, or else move the code into a startup trigger.
Niall Litchfield
http://www.orawin.info/

Similar Messages

  • Run a script on file open?

    I realize there is a way to run scripts when AI launches, but is there a way to run a script when AI opens a file?

    Hi Mordy,
    Sorry, I replied the same thing below as the other post and not sure if you would go back so... :)
    Thanks a lot for your reply. Thats ALMOST exactly what I need and so close to what I have been stressing over its unreal...
    ...although because I am not opening a new template and I am opening a direct tiff image from video footage I previously rendered out in after effects to then run my script on in illustrator for the additional tiff's, I would need a similar sort of thing that way around instead?
    Would you know if that is possible?
    Thanks again for your help with this...

  • I have a packardbell laptop with photoshop elements 8 installed from new. I have used it on several occasions but I cannot get it to run now.  When I open a photo using elements the Adobe box pops up saying that the programme has unexpectedley quit? can a

    I have a packardbell laptop with photoshop elements 8 installed from new. I have used it on several occasions but I cannot get it to run now.  When I open a photo using elements the Adobe box pops up saying that the programme has unexpectedley quit? can anyone help me please as I have several photos to edit before the end of this month. Many thanks for any help

    The "restore disk" is built into the Mac. See About Recovery.
    Need more specifics about what error messages you got while installing Adobe Flash.
    However, you can almost avoid Flash altogether by setting YouTube to play the HTML5 version instead.
    Click the Try something new! link at the bottom of the YouTube page.
    I don't know about the sound issue. Might be hardware as you think. Try other headphones to check.

  • ODP bug with generated SQL script when using DateTime

    With EF5, I'm getting some really weird SQL scripts when dealing with DateTime.
    THe follow script works fine.
    var a = db.MOTOR_POOL_RESERVATION
    .Where(o => o.DEPART_DT > new DateTime(2013, 1, 1))
    .Select(o => o.RESERVATION_ID)
    .ToList();
    SELECT "Extent1"."RESERVATION_ID" AS "RESERVATION_ID"
    FROM "MOTORPOOL"."MOTOR_POOL_RESERVATION" "Extent1"
    WHERE ("Extent1"."DEPART_DT" > TO_TIMESTAMP('2013-01-01 00:00:00.000', 'YYYY-MM-DD HH24:MI:SS.FF'))
    But as soon as I create DateTime with year, month or day values forming from a variable, then generated scripts become incorrect.
    var year = 2013;
    var month = 3;
    var dt = new DateTime(year, month, 1);
    var c = db.MOTOR_POOL_RESERVATION
    .Where(o => o.DEPART_DT > dt)
    .Select(o=>o.RESERVATION_ID)
    .ToList();
    see the date is treated a string.
    SELECT "Extent1"."RESERVATION_ID" AS "RESERVATION_ID"
    FROM "MOTORPOOL"."MOTOR_POOL_RESERVATION" "Extent1"
    WHERE ("Extent1"."DEPART_DT" > '2013-03-01 00:00:00')
    var b = db.MOTOR_POOL_RESERVATION
    .Where(o => o.DEPART_DT > new DateTime(year, month, 1))
    .Select(o => o.RESERVATION_ID)
    .ToList();
    same problem with this one.
    SELECT "Extent1"."RESERVATION_ID" AS "RESERVATION_ID"
    FROM "MOTORPOOL"."MOTOR_POOL_RESERVATION" "Extent1"
    WHERE ("Extent1"."DEPART_DT" > '2013-03-01 00:00:00')

    It turns out that the sql is valid since I'm using bind parameters.

  • Launchd - can it run a script when users log in OR switch?

    I'm hoping to find someone who knows all the gory details of launchd. Here's the why and what: I'm trying to coerce Aperture into letting two users on the same computer share the same Aperture Library, both able to import photos and see and use what the other has done. Initially it is no problem, change the permissions so everyone has read/write/execute, put the Library in a common area, and point both person's Aperture at it. The problem is that Aperture changes permissions of things inside the Library as you use it, and especially when one person imports, the other person can't see that stuff.
    So I want to run a script whenever someone logs in or becomes the active user by fast user switching; the script will simply change ownership and permissions of the library and everything in it to restore full access.
    After days of research and testing, I made a test launchd plist file (this is the configuration file or agent that launchd looks at and runs your script when criteria are met). It sits in /Library/LaunchAgents/, here it is:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>org.jim.test</string>
    <key>LimitLoadToSessionType</key>
    <string>LoginWindow</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Library/Scripts/testscript.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/Users/jim/Desktop/test.err</string>
    <key>StandardOutPath</key>
    <string>/Users/jim/Desktop/test.out</string>
    </dict>
    </plist>
    The actual test script is sitting in /Library/Scripts/:
    #!/bin/bash
    echo "org.jim.test.plist was run at `date`"
    So if the plist is loaded and the script run, the date and time are written in the test.out file on my desktop. This thing runs great when a user logs in. The problem is, it doesn't run when users switch by fast user switching. In reading the documentation, it was vague about this, whether that could be done; I thought it could.
    Can anyone help with a way to get the script to run when any user takes control by any means? As an added complication, which I'll worry about later, the script has to run as root because it's the only way to get the ownership and permissions changed.
    Thanks,
    Jim

    BobHarris is the MAN. ACLs seem to have worked. I put the Aperture Library in /Users/Shared/ApertureLibrary, restored the regular permissions as best I could (me as owner, staff as group, 755), pointed each person's Aperture to the library, then proceeded with the ACL magic. First I created a group for my wife and I, called 'aperture', in the Accounts preference pane. That was to simplify the ACLs (one entry instead of 2) and so that other users (son) aren't able to muck it up.
    It took one stinking Terminal command (note that 'aperture' at the beginning of the quote is the group, not the program, folder or library):
    chmod -R +a "aperture allow list,addfile,search,delete,add_subdirectory,delete_child,file_inherit,directoryinherit" ApertureLibrary.aplibrary
    I was unsure whether this list of permissions was necessary or sufficient, but it seems to have worked so far. Both users can access the library. I imported a different picture by each user, and the other user could then see and delete the picture imported by the other. This was not possible before.
    Bob, thanks for the great idea. After a little more testing I'll post a complete how-to in the latest "how do we share Aperture" thread, and give you due credit. The bad news is all the launchd fun is over
    Jim

  • Run sql script

    Hi,
    run sql script through command line(CMD). IS it possiple.
    Thanks.

    user638559,
    Do I miss something else ? Are you the OP ?
    Nicolas.
    And also, it's a dup thread
    run sql script
    Message was edited by:
    N. Gasparotto

  • Where to running SQL Scripts after install of ODAC for Oracle Client?

    I just installed ODAC for Oracle Client on a windows server, that runs a sql server database, for developers to connect a web app to an Oracle/Unix database. The install states to run SQL scripts located in the $ORACLE_HOME\ASP.NET\SQL directory after the install. I'm not sure where to run them? On the ORACLE DB on the Unix server? If someone could bring me up to speed I would appreciate it. Thanks.

    If I do run the scripts, do you know what user they should be run as? The developer are using ASP.NET for connectivity.
    Why there is no Oracle Expert answer this simple question? ?
    After ODAC 11.1.0.7.20 installation completed, there is a message in the last screen:
    *"Run the SQL script located in c:\app\Administrator\product\11.1.0\client_1\ASP.NET\SQL directory for a new installation or an upgrade of Oracle Providers for ASP.NET"*
    The question is: How to run these 9 SQL scripts ?
    In SQL*Plus, which oracle user should I connect to in order to run these 9 scrips, including:
    InstallAllOracleASPNETProviders.sql
    InstallOracleASPNETCommon.sql
    InstallOracleMembership.sql
    InstallOraclePersonalization.sql
    InstallOracleProfile.sql
    InstallOracleRoles.sql
    InstallOracleSessionState.sql
    InstallOracleSiteMap.sql
    InstallOracleWebEvents.sql

  • Is it Possible to Run SQL Script from Java prog

    Hello
    Is there any API by which we can run SQl Script file ,
    Just by giving database configration parameters and SQL Script file Path ,it will execute that script automatically

    You can excute SQL statemetns throught JDBC, but that doesn't have a facility to read those statements from a file. You'd have to write code to read the file and create and execute statements through JDBC. That should be pretty straightforward though.
    It's conceivable that there's a third party library out there that does it, if you know what to look for.
    If you're not familiar with JDBC, check out http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

  • KODI/XBMC auto run and script problems?

    I started a project a couple weeks ago to build a htpc using xbmc/kodi. I wanted to be able to play retro and steam games. So I've installed emulationstation and steam. Now comes the tricky part (for me anyways), writing bash scripts to access the programs through Advanced Program Launcher. Once I finally got that set up, I set the computer to login automatically and to auto run kodi. And here's where the issue happens. Normally when I run the simple script below, it closes kodi, and opens the program (so only one program is running at a time). However if I try to access the program from the auto-run instance of kodi, it doesn't close kodi before running. Instead, it opens the program and then opens another version of kodi. So if I press alt-tab it shows "kodi/emulationstation/kodi", so I have 3 programs open instead of 1 and trying to close any of them starts a cycle of new instances opening that causes a crash....
    #bin/bash
    killall -9 kodi.bin
    emulationstation
    kodi &
    So since everything runs fine when I start kodi by hand (icon and terminal), I'm assuming the problem is the way I'm auto starting the program? I've used the autostart section under the LXsession configuration, trying @kodi and @lxterminal -e kodi but both produce the same problem. Is there another/better way to autostart a program that I can do this? Or do you guys think it's an issue with the script?
    Thank in advance!!
    I'm running Arch 64 bit with the LXDE desktop.

    How do you autostart kodi ? By enabling the service ?
    In that case killing kodi would make it restart.

  • Run SQL Script from a a Batch File

    I'm trying to schedulling a SQL Script by Windows Scheduler:
    START 
    "C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtexec.exe" /FILE "C:\Users\tstjs\TESTESTESTES.sql" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF  /REPORTING EWCDI
    PAUSE
    However, when I run the batch file it giving the error below:
    ...sql" due to error 0xC00CE556 "Invalid at the top level of the document. Line 1, Column 1". This happens when loading a package and the file cannot be opened o r loaded correctly into an XML document. This can be the result of either provid
    ing an incorrect file name to the LoadPackage method or the XML file specified h aving an incorrect format. End Error
    How can I solve that problem?
    Thanks!

    Hi SaQvl,
    As Scott metioned, you shall use sqlcmd to execute a tsql script. You can reference the below link
    Use the sqlcmd Utility
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Have terminal NOT run a script when it loads

    I recently wrote a basic shell script and saved it as a .command file to run from the desktop. Since then, whenever I open the terminal it automatically runs the script then exits the terminal. If I hide the file (mv pt-noplugs.command .ptnoplugs.command) it simply opens the terminal and closes it immediately. I have tried changing the default shell from bash to something else but this doesn't seem to make a difference. I also don't seem to have a .bashrc file when it normally is /home/user/.bashrc (I'm used to linux). Any help would be appreciated. Below is the script:
    # Shell Script to start Pro Tools HD with no waveshell Plug-In
    echo "*"
    echo "* Script: pt-noplugs.command"
    echo "* Please Leave This Window Open Until ProTools Has Exited"
    echo "*"
    # Move waveshell Plug-In Files to Plug-Ins (Unused)
    cd "/Library/Application Support/Digidesign/Plug-Ins/"
    mv -v Waveshell-DAE_5.9.1.dpm "../Plug-Ins (Unused)"
    # Start Pro-Tools
    /Applications/Digidesign/Pro\ Tools/Pro\ Tools\ HD.app/Contents/MacOS/Pro\ Tools\ HD
    # Restore Plug-Ins directory
    cd "../Plug-Ins (Unused)"
    mv Waveshell-DAE_5.9.1.dpm ../Plug-Ins
    echo "*"
    echo "* Thank You. This Window May Now Be Closed"
    echo "*"
    exit

    I forgot to add: when I login as a different user and load terminal is does NOT run the script mentioned before.

  • Running  sql scripts from different directory

    Hi
    I have sql scripts in different directories as follows:
    D:\myapp\sql
    - load.sql
    - init.sql
    D:\myapp\sql\schema
    -users.sql
    -structure.sql
    D:\myapp\sql\populate\
    - data1.sql
    - data2/sql
    load.sql call all the other scripts as below:
    @init.sql
    @schema\users.sql
    @schema\structure.sql
    @populate\data1.sql
    @populate\data2.sql
    All my scripts run correctly when I run load.sql from D:\myapp\sql on comand prompt.
    I need a way to run this script from a different directory say D:\ or C:\
    I am writing a installer which will execute from a different directory.
    Right now I get a file not found error for scripts within schema an populate folder.
    Please let me know how can I make this work from a different directory.
    Thanks
    kelvin

    Hi peter. i think you cannot run files spread across different locations.
    --the method which u specified always looks to the defined path                                                                                                                                                                                                                                                                                       

  • Run SQL script in JDeveloper 11g

    HI! I create Offline and Online DB Diagrams for my DB in JDeveloper 11g. Then I sync these diagrams and et SQL script.
    1. Can I run it in JDeveloper or I need to use SQLDeveloper?
    2. And can I alter table with this script, if I had values in alter columns?
    Best regards!

    Debuger,
    1. Yes, you can run it in JDev; JDev has a lot of the SQL Developer functionality built in.
    2. Thats really a question of what the DB supports. For example, altering a column to make it bigger - fine; altering a nullable column to make it not null when there are null values - will fail.
    John

  • Timer - Run .sql Script automatically

    How do I setup an .sql script setup in SQL Developer to run automatically as a scheduled task?
    thanks

    Hello,
    welcome to the forum.
    SQL Developer is not a tool that can be automated. When you need to execute a script automatically, then you have several options.
    - Execute the script via SQL*PLUS, scheduled from OS
    - Use the db scheduler to execute a procedure
    - Call a OS script from a db job.
    For further information about these options go to {forum:id=193}, {forum:id=144} or {forum:id=75}.
    Regards
    Marcus

  • Trouble running sql scripts

    I just installed Oracle 10g Express on my laptop running Vista home premium.
    I can not open the accompanying sql scripts, nor can I access the users table if I type the sql commands in the SQL editor on the home page, I get object does not exist. But I can pull up the users using the administration icon.
    any ideas as to the issue?

    What do you mean by "opening the scripts"? Can you log in using sqlplus? Eg.
    sqlplus / as sysdba
    Try viewing the alert log to see if the database is started normally.

Maybe you are looking for

  • How to View Archived Data

    Dear all,         Can anyone pls tell me how to view the Archived data like same what we see in data target.      I have used ODS as data target ,after archiving i want to see the same data format what we see on ODS Active data.       Pls tell me how

  • Publishing to mp4 almost doubles the file size

    I have been trying to find someone in the forum with a similar problem but with no success. I hope someone can help me. I have a Captivate 7 file that is 59 MB. The resulting mp4 file after publishing is 107 MB. When I publish the same file to swf it

  • USER EXIT to be added in IT2001

    Hey Experts, I have the following requirment and i havnt worked on HR ABAP. Please provide me the solution and how to reach the user exit in the infotype. User exit needs to be added to IT 2001 to include the logic mentioned below: a.     For every n

  • Can i use oracle 7.3 drivers against oracle 8 database.

    When i'm executing a stored procedure with 8i driver i'm having a problem saying "Cannot Save or Rollback in distributed transaction". But when i use oracle 7.3 drivers i'm not having any problem.My question is , Can I use oracle 7.3 dirvers with ora

  • Scroll bar has lost zoom function

    Hi I'm using LP 9.1.7 Since I upgraded to Mountain Lion, my scroll bar zoom function has vanished. It's there in Waveburner. I can't find any preferences that can help me. Any help greatly appreciated -- I use tyhis function all the time and I'm lost