Schedule bat file for sqlplus

Hi Experts,
Do we have any way to schedule bat file to run asqlplus SQL statement?
I know we can use pl/sql procedure by dbms_schdule.
I create a bat file as
set ORACLE_SID=ORCA
set CONNECT_USER='del/del@test'
set exp_dir=spool c:exprd_
set SQLState =select *from errdbg order by seq desc
set today=%date:~-4%%date:~4,2%%date:~7,2%
set exp_end =spool off
     Set PATH=%ORACLE_HOME%\bin;
%ORACLE_HOME%CONNECT_USER%exp_dir %today%.txt
SQLState
exp_end
but it can not open sqlplus
Thanks
JIm

You should create sql file and call it from bat file by writing:
@sqlplus usr/pass@db @c:\your_sql_file.sql

Similar Messages

  • Bat file for running scheduled jobs

    Hi
    I am not entirely sure whether this is the correct forum to post this question, so apologies if I have posted this question in the wrong place.
    Anyhow, I would like to know how to create two automated bat file scripts that will execute a PL/SQL package that will tell my Oracle 10g R2 database to run a scheduled job. Equally, I need another bat file to tell it to drop the scheduled job.
    I already have a PL/SQL package that creates a schedule job using dbms_scheduler, and I can execute the scheduled job by going into SQL Plus running the execute command against the package. It is this latter bit, the execute part that I want to automate into bat file.
    Can someone show me how to do this?

    I'm in complete agreement with Hans. Oracle has two facilities DBMS_JOB and DBMS_SCHEDULER neither of which benefits in any way be being called by a batch file.
    What is your version number (all of it) and why are you considering this idea?

  • Scheduling .bat File to Execute SFTP

    All,
    We are trying to schedule a .bat file to run SFTP via either the Windows scheduler or the ODI scheduler. When we try both ways they don't work. It seems to be something to do with the system not having a user currently logged on (for a current session) when the .bat file is ran. Is it possible to schedule a .bat file to execute SFTP via ODI? If not, does anyone know a way to accomplish this goal?
    Thanks in Advance,
    Josh

    Hi Josh,
    Not sure this is what you meant, but if your doubt is whether or not you can run your batch in ODI, then the answer is yes, you can run any .bat.
    ODI offers several alternative ways - please refer on Metalink Note 423761.1 "Best practices when embedding Operating System Commands in ODI": just for example you can embed your batch into a Jython procedure and run this via os.system (your_batch).
    I find this method quite handy, as in a procedure you can set up several parameters into a single shot (e.g. using "options").
    Hope this helps,
    scagliaf

  • Bat file for hide System Drive

    I want to create and Bat file that will invisible my system drive. Kindly help how can i create this batch file.
    In my system having C, D,E,F,G, I drive and i want all drive hide.
    Nirmal Singh IT Administrator

    You can achive with GP's, However this also can be also achived from editing the Registry key's...
    What you can do is Just export the Registry by doing this
    http://tipsandhakcs.blogspot.com/2008/04/how-to-hide-computer-drives-in-windows.html artical.
    and then you can create a batch file to add this registry key on target systems. You can follow this artical for how to use
    http://support.microsoft.com/kb/310516 
    a sample batch exaple
    regedit.exe /s <var>path of .reg file</var>
    SCCM This posting is provided "AS IS" with no warranties or guarantees, and confers no rights. |Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually
    answer your question. This can be beneficial to other community members reading the thread.
    Unfortunately that key is blocked if attached to a domain.  Group POlicy takes ownership and set the user account to read only.
    IN a workgroup tis will wok as long as teh machine has never been joined to a domain.  When unjoining the policy key does not get reset.
    The link to blog post goes to a site that has been hacked.  It immediately redirects to another site.  You can stay on the page by disabling JavaScript temporarily.
    The site seems to redirect to a number of sites and quickly downloads a bunch of things then stays on the following page:
    http://bodisparking.com/deniedltd.com?bl=js
    jv

  • How to set bat file for commands

    i have to set below all commands in bat file and run in particular time.i am not able to do.please let me know how i can do
    two node rac
    10.2.0.4
    windows
    note---how to enter rac forum in this oracle forums................pls give url
    echo %date% %time%
    echo ############################
    netstat -n
    netstat -s
    tracert <node1>
    tracert <node2>
    tracert <node3>
    II
    ping -t <node1>
    ping -t <node2>
    ping -t <node3>
    Node 1: cluster node 1
    Node 2 : Cluster node 2
    Node 3 : Web server where the connection is failing.

    user1175505 wrote:
    i have to set below all commands in bat file and run in particular time.i am not able to do.please let me know how i can do
    two node rac
    10.2.0.4
    windows
    note---how to enter rac forum in this oracle forums................pls give url
    echo %date% %time%
    echo ############################
    netstat -n
    netstat -s
    tracert <node1>
    tracert <node2>
    tracert <node3>
    II
    ping -t <node1>
    ping -t <node2>
    ping -t <node3>
    Node 1: cluster node 1
    Node 2 : Cluster node 2
    Node 3 : Web server where the connection is failing.What part do you not know how to do? You have the commands. Open up notepad and create a file containing those commands. Name the file 'whateveryouwant.cmd'. (The .bat extension is pretty much out of use, in favor of .cmd - I'm not sure of any technical difference, but I certainly know of no practical difference). Then schedule it to run using the Windows scheduler.

  • Batch file for sqlplus statements

    hi,
    i want to run the scripts from batch file i am using the following syntax
    sqlplus user1/user1@instance C:\Batch File\Create.sql
    exit
    and in
    .sql file create table tab1 as (select * from emp)
    commit;
    when i double click on the bat file its executing but table is not created in backend
    plz help me
    thanks,
    saichand

    I missed to place @ before the file name
    sql plus user1/user1@instance @c:\Batch File\Create.sql Now it's working fine
    thanks,
    saichand
    Edited by: saichand on Oct 19, 2009 12:50 PM
    Edited by: Saichand Varanasi on Jan 4, 2010 9:42 PM

  • Unable to get create_SDA.bat file for custom adapter development.

    Hi ,
    I am working on custom adapters development following the PDF(SOA361-how to develop an adapter in SAP Netweaver PI)  about using Sample Adapter .
    In section where we will create the SDA file and deploy it to the J2EE server.
    The create_SDA.bat file is unavailable , How can I get that file.
    Regards,
    Syed.

    This is the original content. Adjust it to your needs.
    set PATH=C:\j2sdk1.4.2_11\bin;%PATH%
    REM Create jar file
    cd ..\AdapterZIP
    jar cvf ..\AdapterZIP_RAR\zip_ra.jar *.xml  com\test\zip\adapter\ra\*.*
    REM Create rar file
    cd ..\AdapterZIP_RAR
    jar cvf ..\AdapterZIP_SDA\zip_ra.rar *.jar  META-INF\*.*
    cd ..\AdapterZIP_SDA
    jar cvf zip_ra.sda *.rar  META-INF\*.*
    pause

  • Dot BAT files in Windows 8.1

    How do you activate the dot Bat file for execution on the workspace and/or in the startup menu?
    Jim

    Hi Jim,
    Could you please explain a bit for the activate here refers to?
    If you mean to run the bat files, we may consider take use of group policy to run it at startup, or use the Scheduled Tasks, for more information, please check the articles below:
    Use Startup, Shutdown, Logon, and Logoff Scripts
    Batch Files – Basic Error Checking and Running as Scheduled Tasks
    If I have any misunderstandings, please feel free to let me know.
    Best regards
    Michael Shao
    TechNet Community Support

  • Running Oracle startup or shutdown bat file from Java code

    I have two bat files for the startup and shutdown of Oracle instance which works fine from the command prompt. But my requirement is to run it through a Java program. Please reply with full Java code. Also mention how I would get the status of the bat files that it is successfully executed or not and if not what is the error.

    Your program is working fine, but there is another problem. What's happening now is I have to open the Login screen after the startup of oracle server is complete, but the next line of my program after Runtime.exec is the LoginScreen.show which immediately shows the login screen after executing Runtime.exec and when I am giving the login name and password and press enter, it shows Oracle not available exception, because the startup process is still in progress. I want to stop the execution of my next line of code until and unless my process of Oracle startup is complete.

  • About the bat file to start and stop the weblogic server10.3

    I am using windows 2003 os.
    i installed the WLS 10.3 .
    can anyone help me how to write the bat file for starting and stoping the weblogic server instance.so that it willl run as background service.
    I am new to this .Please suggest me
    Any help is appreciated.
    Thanks
    Sailaja.

    Hi David,
    yes.i am talking about Admin server.
    when i am creating the new domain,i didn't encounter any prompt asking me to run the Admin server as windows services.why i am not getting this prompt?where exactly i will get this prompt while creating domain.
    i am using the weblogic 10.3
    how can i make the admin server as windows services.
    Thanks
    Sailaja.
    Edited by: sj0609 on Dec 2, 2008 4:02 PM

  • Creating new BAT file script to stop, restart and disable S I agent

    We have just installed BOXI3 and are in the process of updating some bat files for stopping, restarting and failover (to our backup servers)and disable services on the Central Configuration Manager.   In my old scripts we called each service  Examples (
    sc
    servername.net config "bobjspcengine" start= disabled                    
    sc
    servername.net config "BOBJWebiServer" start= disabled)
    I have a few  questions
    1.  Server Intelligence Agent... Where would I find it's name   like the BOBJWebiServer example?
    2.  If my bat file stops this agent does that automatically stop the CMS, Webi, Report services?
    3. This is for our support team in order to easliy stop Tomcat and other services for failing over to our DR sites and backups since the script automatically stops,  starts, restarts disables and enable services..., is this the best approach?   We put these bat files out on the servers and all they do is click on them to start the failover process.

    Try using
    Process Monitor for looking the key.
    For example, you may set the required value through the group policy and see what windows registry keys are changed.

  • Problems with .bat files [urgent]

    I have succed to do so that my java program can run a .dat file, but now I wonder what I should write in it.
    I want to run a file called Geo.class in a sub folder called \Subclasses, so what should I do?
    Here is the folder system:
    C:\java\runClasses.bat <--- It's here the .bat file should be
    C:\java\Subclasses\Geo.class <----- and here is the .class file that the bat file should execute
    So could anyone say what I should write in the .bat file for this to work?? It's very urgent!!

    It depends upon whether your Geo class is in a package or not. If you have a line that says "package Subclasses" (for instance) then you need to say "java Subclasses.Geo" in your bat file.

  • Successfull .Bat file execution

    Hi,
    I have a .bat file consisting couple of actions /tasks ...
    Rem Task 1: Using ImageX to deploy a image stored on USB .
                        Imagex /apply /U:\install.wim /index:3 D:\
    Rem Task2 : Copy a folder from USB to D drive
                        xCopy U:\Temp D:\Temp2
    Now I want to add some logic into the bat file, for example if a task is interrupted (maybe be source disk is not available or removed, like USB or network resources etc) or there is no folder with name Temp (for example), can  I get a VB message box
    with saying something went wrong, start again _???
    N.A.Malik

    If you write your batch file in a modular fashion then you can check for any criteria as shown below. You will have to write the individual code segments yourself.
    @echo off
    set result=OK
    call :CheckDiskSpace
    if not %result%==OK goto :eof
    call :FileSize
    if not %result%==OK goto :eof
    etc.
    goto :eof
    ==============
    :CheckDiskSpace
    . . . Your code goes here
    if %Free% LSS 100000000 set OK=false
    goto :eof
    ==============
    :FileSize
    . . . Your code goes here
    if %Size% GTR 100000000 set OK=false
    goto :eof
    ==============

  • How to Execute a BAT file

    Hi,
    I have to  execute .bat file , for this i writen the code as below,  i tried with 3 FM's.
    but am unable to run bat file, missing anything ?
      *data : begin of i_command occurs 0,
            txt(255),
           end of i_command,
           rbuff(10).
    *CONCATENATE 'rename' 'hari.txt' 'kris.txt'
                  into  I_COMMAND-txt  SEPARATED BY SPACE.
    APPEND I_COMMAND.
    CALL FUNCTION 'WS_DOWNLOAD'
          EXPORTING
               FILENAME = 'c:\ren.bat'
          TABLES
               DATA_TAB = I_COMMAND.
    CALL FUNCTION 'WS_EXECUTE'
          EXPORTING
               PROGRAM = 'c:\ren.bat'
          IMPORTING
               RBUFF   = RBUFF.
    *CALL FUNCTION 'GUI_EXEC'
          EXPORTING
           COMMAND  = 'CMD /C '
           PARAMETER = 'c:\ren.bat'.
    CALL FUNCTION 'GUI_RUN'
           EXPORTING
            COMMAND  = 'C:\ren.bat '.
    Thanks in advance,
    hari

    Hi,
    CALL METHOD cl_gui_frontend_services=>execute
      EXPORTING
        application            = 'cmd'
        parameter              = ' '   " here pass the required parameter
      EXCEPTIONS
        cntl_error             = 1
        error_no_gui           = 2
        bad_parameter          = 3
        file_not_found         = 4
        path_not_found         = 5
        file_extension_unknown = 6
        error_execute_failed   = 7
        synchronous_failed     = 8
        not_supported_by_gui   = 9
        OTHERS                 = 10.
    If useful, please reward
    Regards,
    Vijay

  • Scheduling job problem and modification in the bat file

    Dears ALL
    i am using the following script in windows 2003 server for oracle database 10 g i have one problem of scheduling the task i scheduled it successfully on windows scheduled task program but its not running at scheduled time and even when i run this bat file manually this give the security warning The publisher could not be varified,Are u sure u want to run this software? when i click on yes then it runs the bat file may be thats the problem in aslo scheduled how to remove this warning
    2ndly i want to do some changes in my script like this that it removes the same file older than 3 days means it jst have the last three dumps and will remove the olders the script is as
    @echo off
    CLS
    REM ********************************
    SET V_USER=riyadh
    SET V_PASSWORD=riyadh
    SET V_DB=vis
    SET V_DMP_PATH=D:\dump\
    REM ********************************
    ECHO.
    SET EXP_PATH=D:\oracle\visdb\9.2.0\bin\
    SET MONTH=%DATE:~4,2%
    SET YEAR=%DATE:~10,4%
    SET DATED=%DATE:~-7,2%
    ECHO ECHO CONNECT AS : %V_USER%/%V_PASSWORD%@%V_DB%
    ECHO Backup on : %DATED%/%MONTH%/%YEAR% (DD/MM/YYYY)
    ECHO SAVE AS : %V_DMP_PATH%%V_USER%_%DATED%%MONTH%%YEAR%.dmp
    ECHO TITLE BACKUP ...%V_USER%_%DATED%%MONTH%%YEAR%
    echo.
    %EXP_PATH%EXP.exe %V_USER%/%V_PASSWORD%@%V_DB% file=%V_DMP_PATH%%V_USER%_%DATED%%MONTH%%YEAR%.dmp log=%V_DMP_PATH%%V_USER%_%DATED%%MONTH%%YEAR%.log
    THANKS A LOT

    Solution:
    Run gpedit.msc
    Go to User Configuration >> Administrative Templates >> Windows Components >> Attachment Manager
    i have followd all the steps as it is but when i open the Inclusion list for moderate risk file types its not configured and the msg below this is Supported on: At least Microsoft Windows XP Professional with SP2
    and i have windows 2003 server so how to add it or enable it etc
    THANKS a lot for ur reply

Maybe you are looking for