Run a batch file script

Hi all

I want to run a SQL script that is executed from a batch file.
Lets say, I have the file loader.bat. This .bat file connects to Oracle and wants
to run the .sql file

The content of the file loader.bat is
sqlplus 
@C:\temp_val_id.sql
At runtime, it calls in the name of user and password. I enter the user name and password and then log on to Oracle
But the temp_val_id.sql file isn't exectuted.

The output is as below, but .sql file does not run
C:\>sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 28 17:19:50 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Enter user-name: utest_tt_senayat/password@silver3

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
I'm now trying another method
sqlplus 
@@C:\temp_val_id.sql
The result is the same as above. Do not run temp_val_id.sql

Could someone please help me,

Thanks in advance
Saaz

Saaz Ena wrote:
sqlplus/nolog @test.sql

test.sql content:

connect &user/&pass
select sysdate from dual;
exit;
/
C:\work\test>sqlplus /nolog @test

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 28 16:21:12 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Enter value for user: system
Enter value for pass: manager
Connected.

SYSDATE
---------
28-MAR-12

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Tags: Database

Similar Questions

  • I, stupid, changed the program by default to a BAT file to the cmd prompt, well, now I can't run the batch files now, please help!

    I, stupid, changed the program by default to a BAT file to the cmd prompt, well, now I can't run the batch files now, please help!

    Hi William,.

    Welcome to the Microsoft community.

    Batch file is a type of script file, a text file, containing a series of commands to be executed by the command prompt. When you run a batch file, it opens the command prompt to run the scripts.

    It would be great if you can answer the following questions:

    1. what happens when you try to run a batch file?

    2 are. what batch file you referring?

    3. the problem occurs for a particular batch file?

    First of all, I suggest you to check the commands written in a batch file. To do the same thing, just right-click on the batch file, and then click change. It will open Notepad with the list of orders scripted for this particular batch file.

    If you have additional questions on the computer, please ask your question about Windows and we will be happy to help you.

  • MS Dos command or batch file script

    How to remove files from a folder while MS-DOS command or batch file script keeping the last 15 days in windows server 2003R? Help, please

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
  • Should I have the administrator account to run the batch file?

    When I log in as administrator, I run after the file of commands without any problem, but

    When I login as a user, I can't run after the batch file, the changeover of the authority.

    I would like to know if I need to log in as an administrator to run this batch file or not,

    Can I use different accounts group? and always perform this task.

    Does anyone have any suggestions?
    Thanks in advance for your suggestions :>

    off @echo
    echo copy C: d:

    RoboCopy C:\ /MIR R:1 /W:1 D:\
    ECHO done

    Hello
     
    To respond to your request, you must enter the administrator password to access this command file.
    Instructions for Windows 7
    In order to run as administrator, create a shortcut to the batch file.
    1. right click on the batch file, then click on copy
    2. navigate to the location where you the shortcut
    3. right click on the background of the directory
    4. select Paste shortcut
     
    Then, you can set the shortcut to run as Administrator:
    1. right click on the shortcut
    2. Select Properties
    3. in the shortcut tab, click Advanced
    4. check the box "Run as Administrator"
    5. click on OK, OK
    Now when you double-click the shortcut it will ask for confirmation UAC and then run as an administrator (which as I said above is different than running under an account in the administrator group)
     
    I hope this helps.

  • HOW to run a batch file in BACK 6.22?

    I wrote a batch file that works fine in the Windows command prompt, but I would like to be able to run after POST in the BACK. I copied my code AUTOEXEC. BAT file that runs automatically; However sometimes with syntax errors when it reaches the call control and the rest.

    echo. This script is counting the # of POSTs.
    echo. The POST # value is saved in TEST.txt.
    echo.
    
    call:myPOSTTest
    
    for /f "tokens=* delims=" %%x in (A:\TEST.txt)  do echo POST# %%x
    
    echo. &pause&goto:eof
    ::--------------------------------------------------------
    ::-- Function section starts below here
    ::--------------------------------------------------------
    
    :myPOSTTest    - here starts my function identified by its label 
    
    set var=0
    
    if EXIST A:\TEST.txt (
         for /f %%x in (A:\TEST.txt) do (set /a var=%%x+1)
    )
    
    echo %var% >> A:\TEST.txt
    
    goto END
    
    :END
    
    

    Thank you

    Hello

    Many of us being volunteers do not have the expertise to help.  Refer the question to the TechNet Script Center.

    Script Center

  • How to restart and stop the system by running a batch file?

    Can any body give the command batch file for restart and stop of the system.

    My requirement is to reboot or shut down the system at a specific time. So I think that by creating a batch file, that I can schedule the file to run at a specific time of the scheduled task...
    With regard to:
    Rahma.

    Hello

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited on MSDN. Please post your question in the MSDN forums. You can follow the link to your question:

  • Run a batch file in windows separated box to call DRM client batch

    I need your suggestions on what follows.

    ODI & DRM are installed on separate boxes.

    Now, I want to ODI to call a batch file (kept on DRM - Windows box, this batch file called client batch DRM for export metadata). I tried to use the notion of shared folder, but without success.

    Pointers please?

    This should work for you-

    Create a batch on your current server (ODI) file and write in the path to the other file of commands on the other server.

    Server2completename/D$/path/yourbatchfile.bat

    Calling your batch file that you created on the same machine... which inturn will call the other on another machine batch file to run the batch client from the ODI.

    Also you can paste errors that you can get... need to check if you get any specific problem related to this.

    Thank you

    Denzz

  • batch file for statements to sqlplus

    Jin
    I want to run the batch file scripts, I use the following syntax


    sqlplus user1/user1@instance C:\Batch File\Create.sql
    output

    and in

    create table tab1 as .sql file (select * from emp)
    commit;

    When I double click on the file fighting his execution but the table is not created in the backend

    Please help me

    Thank you
    Angelique
    Usage: SQLPLUS [ [
    

    From the help above must be a file @before address...

    sqlplus user1/user1@instance C:\Batch File\Create.sql
    becomes

    sqlplus user1/user1@instance "@C:\Batch File\Create.sql"
    

    check the qoutes, because they are needed for names with spaces in directories.

    Ravi Kumar

    Ravi Kumar

  • How to run a Powershell script via a batch file

    I'm new on using Powershell and I have a fundamental question regarding running a powershell script. Basically, I wrote a file of commands as shown below.

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe - PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" - NoExit-command "C:\MyScripts\RunSpanshot.ps1".

    I run the batch file and nothing seems to happen. What is the problem with trying to run the RunSpanshot.ps1 script as shown above? -any help is appreciated.

    Thank you

    You could do

    C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -NoExit -Command "& 'C:\My Scripts\RunSpanshot.ps1'"
    
  • Batch file or scripts to automate running the cache?

    Hello gurus,

    I'm new to OBIEE and trying to learn how to automate hides...

    I got to know that we can automate the cache for the purge by running a batch file or script... outside the purging of the cache by checking the time of persistent cache for individual objects.

    I also read the documentation for the purging of the cache as the use of the ODBC extension functions... such as SApurgeCacheByQuery, SApurgeCacheByTable, SApurgeCacheByDatabase, SApurgeAllCache... But how can we get these functions?

    Someone can explain on the automation of the cache or can someone give all kinds of web links or reference?

    Thanks in advance...

    Published by: user12269190 on April 30, 2010 14:35

    http://CatB.org/~ESR/FAQs/smart-questions.HTML#before

    First result when I search "obiee clear cache" on Google:

    http://obiee101.blogspot.com/2008/03/OBIEE-manage-cache-part-1.html

  • Batch file is not running of the event-AftLoad

    Hello

    I can run my batch file in the AftLoad event manually script from the client Workbench, but not when I use the the Task Manager or Upsshell in FDM pocess processes. nothing happens.

    Method of the API

    API. DataWindow.Utilities.mShellAndWait CStr("D:\APPFDM\FDM.bat"), 0

    Method of the shell

    Set Shell = CreateObject ("WScript.Shell")

    hull. Run 'D:\APPFDM\FDM.bat', 0, True

    Help, please!

    Thank you

    Vivek

    Problem will be probably related to your batch file.

    I suggest you start with a simple bat file.

    For example, to write something in a file.

    You can add your FDM.bat code?

    Thank you

  • Call the batch file and not the shell script using measures of the event

    Can I use EVENTACTIONS at the door of gold like

    eventactions (SHELL, /path-to-batch-file/test1.bat)

    will this work? I am on a windows machine, so I need to run a batch file and not a shell script

    In GGSCI, you can shell OUT to the BONE and call a command/executable file.

    For example on Windows:

    GGSCI (WIN2003) 2 > shell dir

    Volume in drive C has no label.

    Volume serial number is 8CCC-9E58

    Directory of C:\ggs

    18/08/2012 07:23

    .

    18/08/2012 07:23

    ...

    2010-10-15 06:37 bcpfmt.tpl 426

    2010-10-15 06:37 bcrypt.txt 1 725

    22/04/2011 03:41 2 560 category.dll

    05/11/2011 10:43

    cfg

    2010-10-15 07:15 739 chkpt_ora_create.sql

    ...

    What were the results when you tried this in an EVENTACTIONS clause?

  • call a batch file in the sql scripts

    Hi friends,
    I'm looking for a way to call any batch file in sql scripts. I avoid using the DBMS_SCHEDULER package because my application server and database server are deparaments.
    I use the sql script using the server.plz application.


    Ah, I see. Of course, this explains everything.

    Now to be serious: there is no way to run a batch SQL script. The Tools that present SQL statements to the database are often able to do; host in SQL * Plus may issue commands to the OS, the host of builtin forms is it too and with dbms_scheduler , you can run a shell script on the database server.

    So depending on the tools you use, there are several ways to run the OS commands. So far you didn't tell us what you want to do with what tools in the version you want to do. So to only answer is: it is not possible. You cannot run a simple SQL command script.

    see you soon

  • Windows 7 and I have a batch file to copy files from 1 computer to another. It works fine alone, but when I put it to run in the Task Scheduler it shows it ends successfully, but nothing is happening

    I am running Windows 7 and I have a batch file to copy files from 1 computer to another.  It works fine alone, but when I put it to run in the Task Scheduler it shows it ends successfully, but nothing is happening.  None of the files are copied, and the control box does not appear.  Any ideas?

    Run a batch file in Task Scheduler

    Hello ITGIRL17,

    Thanks for posting on the Microsoft answers Forum.

    Configure your task under your administrator account.
    Then go to the folder with the batch file and ADD on control for the folder administrator permissions and each of the files in batches.
    If the batch files write data, then the target for the task should ALSO have all explicit permissions.
    Now try to run the Task Scheduler task.

    Also check the information from the following link and look specifically at Brian Vandemark Sommaire steps on 2 September.
    http://social.technet.Microsoft.com/forums/en/winservermanager/thread/d47d116e-10b9-44f0-9a30-7406c86c2fbe

    I hope that this information will help resolve your batch file does not problem.

    Sincerely, Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Batch file is not automatically end

    Hello friends,

    I'm Harnish Jouve of the India. Now a days I am facing a question about the batch file does not end.

    I have a database server and I need to transfer data from server to Client PC. For this, I create a batch file. My batch file is run with success and transfer data were but batch file is not terminated automatically. Please find the below batch file script for the same.

    Script below is run on Server 2003

    xcopy \\172.17.7.11\BACKUPS\MORNING\*. * \\172.17.7.55\ORABKP\morning/c/f/r/z

    Data must transfer the server form 2003 to windows 7 PC

    Please help me to solve the same.

    Thank you and best regards,

    Harnish Jouve

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.msdn.Microsoft.com/forums/en-us/home

Maybe you are looking for