Command prompt from pl/sql

hi,
is there any way to execute command prompt statements (like IMP for example) from within pl/sql procedures.

I didn't particularly want to have to start writing java utilities etc, just wanted to execute commands from within pl/sql. In sqlserver you can do this in transact-sql by running xp_cmdshell. I am trying to find ways of exporting table data and being able to reimport it on another machine or even different databases - so want a comma delimited file (preferably with a format file to go with it to identify what columns there are etc.
Is this not possible then ?

Similar Messages

  • Call command prompt from oracle sqldeveloper

    Hi all,
        Anyone please let me know how to run the cmd prompt from oracle sql developer as like HOST command in sql plus.
    Thanks

    You can use the same HOST command. Use F5 (Run Script) to execute it. And this is a SQL and PL/SQL forum. There is a seperate SQL Developer (Not for general SQL/PLSQL questions) forum.

  • I am having mac book air 2012model i had installed mavericks and use it, i long press command and power button at a same time and i saw the command prompt, from that i had formated the total hard disk. how to i want to install the OS again ?

    I am having mac book air 2012model i had installed mavericks and use it, i long press command and power button at a same time and i saw the command prompt, from that i had formated the total hard disk. how to i want to install the OS again ?
    i tryed with download mavericks but finally its saying a error message like cant conect to istore like that its saying and every thing is clear like internet and other stuf i tryed with 3times no progress same error pls help.. i bought this lap for my bro with his apple id only we use it now he got a new mac book pro so he gave to me so i formated and use it i use my apple id is that problem come because of changing apple id ? pls eplain

    Firstly, what is the source of the 10.6.4 disc? Is it the original installation disc for your MacBook, or one 'borrowed' from another computer?
    It isn't the retail version, because that's 10.6.3.
    Assuming it's the correct disc (i.e. the one that shipped with your Mac), you need to boot from it again.
    OK the language page.
    From the installer screen, ignore the continue button, go to the menu bar and choose Disk Utility from the Utilities menu.
    In DU, select your internal drive in the sidebar (the top item with the makers name and serial no.).
    Run Repair Disk. If that comes up as disk OK, click the partition tab. Select the partiton from the drop-down above the graphic; 1 partiton is all you need.
    Go to the options button and ensure that the partition scheme is GUID and the file system to Mac OS Extended (Journalled). Name the partiton (usually Macintosh HD), click Apply.
    When the Macintosh HD volume appears below the drive name, quit DU and see if you can then install.
    If the screen after the language screen doesn't show the menu bar, it may be necessary to use another Mac to do the job with the MB in Firewire Target Disc Mode. If it won't boot in TDM, or the MB doesn't have FireWire then it's getting very difficult.

  • Calling command prompt from inside a servelt?

    Hello all, I have an issue with calling the command prompt cmd.exe from inside a servlet to perform a .rtf to .pdf conversion for me. I believe the problem might be more Windows permissions oriented but I will see what you think? (I am at a loss on this one) I am using the standard call of -
    Process proc = Runtime.getRuntime().exec("cmd.exe /c C:\\BatchPDF.exe "+rtfFile.getAbsolutePath()+" "+pdfFile.getAbsolutePath());
    - Just calling a .rtf file and converting it to .pdf no biggie. But! oh there is always a but!
    If I start tomcat locally using the startup.bat in the tomcat /bin dir, I have no problems with my servlet launching cmd.exe and converting the files.
    However,
    If I start tomcat as a system service from the services control pannel, My servlet just hangs and will not launch cmd.exe? Tomcat is set to start as the servers Admin account when started as a service, should this not let it open the command prompt? Also, cmd.exe has full permissions to everyone! Is it possible that it might be a Catalina Policey that is preventing this? Again, I am lost and hope someone might have had this problem and fixed it before!
    Thank You in Advance,
    Lance

    It might be because of when starting as a service it
    has no "console" (just a guess). But anyway, you don't
    need the "cmd.exe /c" part - just run the .exe(meaning, the *PDF.exe)                                                                                                                                                                                                                                                                                                                                                                                   

  • How to close the command prompt from program

    Hi,
    I am using Swing. i used System.exit(0) to close my frame when a condition is met. But the command prompt is not closed. How do i close that automatically

    @Op.
    When was the command prompt opened?
    It won't close if it was opened before you started your application, and it won't close if you are executing your application from a bat/cmd-file that doesn't terminate.
    Kaj

  • Invoking command prompt from Java

    public class NewClass2 {
    public static void main(String[] args) {
    Runtime p = Runtime.getRuntime();
    p.exec("cmd");
    I would like to invoke dos prompt from my java application. The above code is not working. What could be the problem? I am using Windows XP m/c with netbeans.

    jjegan wrote:
    public class NewClass2 {
    public static void main(String[] args) {
    Runtime p = Runtime.getRuntime();
    p.exec("cmd");
    I would like to invoke dos prompt from my java application. The above code is not working. What could be the problem? I am using Windows XP m/c with netbeans.You didn't give it hands and feet, i.e. you can't expect the cmd.exe process to fire up a terminal for its input and output; you have to do that yourself. Read all about the Input- and OutputStreams of those sub-processes in the API documentation of the Processs class.
    kind regards,
    Jos

  • How i can open a new command prompt from one java from

    hi
    can any one help me that how i can open a command prompt by using the java program file .
    regards,
    ukbasak

    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#exec(java.lang.String)
    and several overloads.
    Also
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html

  • Java running host command - moved from PL/SQL forums

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for HPUX: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Hi,
    I am not familiar with Java setting in Oracle
    I have a a stored procedure that call a java program to execute host command like
    ssh user1@localhost '/home/user1/someprogram'
    if we execute this directly using PuTTY
    we can do the following with no problem
    su - oracle
    ssh user1@localhost '/home/user1/someprogram'
    but when we execute the stored procedure,
    we have to do
    */usr/bin/ssh* user1@localhost '/home/user1/someprogram'
    does anybody where to set the path or environment to make the java know the path correctly.
    thanks
    ps:. this is happen after we recently upgraded our Oracle from 9.2.0.8 to 11.1.0.6

    pgoel wrote:
    You said,
    a stored procedure that call a java program to execute host command like ssh user1@localhost '/home/user1/someprogram'SP -calls> Java Program (JP) -runs> ssh user1@localhost '/home/user1/someprogram'. is that right? I presume locahost is a database server.correct
    this is the stored procedure
    CREATE OR REPLACE PROCEDURE host_command (p_command  IN  VARCHAR2)
      AS LANGUAGE JAVA
      NAME 'Host.executeCommand (java.lang.String)';and this is the java
    create or replace and compile java source named host as
    import java.io.*;
    public class Host {
      public static void executeCommand(String command) {
        try {
          String[] finalCommand;
          if (isWindows()) {
            finalCommand = new String[4];
            // Use the appropriate path for your windows version.
            finalCommand[0] = "C:\\windows\\system32\\cmd.exe";  // Windows XP/2003
            //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe";  // Windows NT/2000
            finalCommand[1] = "/y";
            finalCommand[2] = "/c";
            finalCommand[3] = command;
          else {
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
          new Thread(new Runnable(){
            public void run() {
              BufferedReader br_in = null;
              try {
                br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
                String buff = null;
                while ((buff = br_in.readLine()) != null) {
                  System.out.println("Process out :" + buff);
                  try {Thread.sleep(100); } catch(Exception e) {}
                br_in.close();
              catch (IOException ioe) {
                System.out.println("Exception caught printing process output.");
                ioe.printStackTrace();
              finally {
                try {
                  br_in.close();
                } catch (Exception ex) {}
          }).start();
          new Thread(new Runnable(){
            public void run() {
              BufferedReader br_err = null;
              try {
                br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
                String buff = null;
                while ((buff = br_err.readLine()) != null) {
                  System.out.println("Process err :" + buff);
                  try {Thread.sleep(100); } catch(Exception e) {}
                br_err.close();
              catch (IOException ioe) {
                System.out.println("Exception caught printing process error.");
                ioe.printStackTrace();
              finally {
                try {
                  br_err.close();
                } catch (Exception ex) {}
          }).start();
        catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
      public static boolean isWindows() {
        if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
          return true;
        else
          return false;
    Where does Java Progarm reside? On the database server filesystem OR within the Database itslef. within the Database itslef.
    Edited by: HGDBA on Mar 11, 2011 1:50 PM

  • Uninstall SQL Server 2012 in Command Prompt

    I need to make an  uninstall script for SQL Server 2012 Express but I can't figger it out.
    After I uninstalled the SQL instance with following command:
    C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012\setup.exe /Action=Uninstall /FEATURES=SQL,AS /INSTANCENAME=SQLEXPRESS /QUIETSIMPLE
    There are still a couple of programs that I want to remove:
    Microsoft SQL Server 2008 Setup Support Files
    Microsoft SQL Server 2012 Transact-SQL ScriptDom
    Microsoft SQL Server 2012 Native Client
    SQL Server Browser for SQL Server 2012
    Microsoft VSS Writer for SQL Server 2012
    Microsoft - SQL Server 2012 Express
    Microsoft SQL Server 2012 Setup (English)
    Can someone please help me removing them without using 'Add or Remove Programs'
    and preferably without any interaction.

    Hi Michael1105,
    Are there any other instances except SQL Server Express in your system?
    To completely uninstall SQL Server Express include the Browser, Writer and other SQL Server components, I recommend you use the
    ConfigurationFile.ini file. Below is an example for you.
    Firstly, you can perform the following steps to generate a configuration file.
    1. Right click SQL Server 2012 from control panel and select Remove
    2. Follow the wizard through to the Ready to Remove page. The path to the configuration file is specified in the
    Ready to Remove page in the configuration file path section.
    3. Cancel the setup without actually completing the uninstallation, to generate the INI file.
    Secondly, you can specify the configuration file at the command prompt and uninstall SQL Server 2012 Express, or you can change the scripts in configuration file to meet your requirement, then copy the scripts
     in command prompt to uninstall SQL Server 2012 Express.
    Reference:
    Install SQL Server 2012 Using a Configuration File
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • How to execute OMB scripts from the command prompt of OS

    Hi
    I want to deploy the mapping from one environment to other environment using OMB script language. But I dont want to run the OMB scripts from OMB plus COmmand prompt?
    All I need is , is there any way/scripts to access OMB command prompt from the general command prompt of the OS Machine?
    or Can I call this OMB command from java program but not JDeveloper?
    It would be a great help for me by sharing your knowledge?
    Cheers
    Pradeep

    This way from MS-DOS:
    set ORACLE_HOME=c:\oracle\OWB10gR2 (change to your Oracle Home)
    call C:\oracle\OWB10gR2\owb\bin\win32\OMBPlus.bat C:\...\my_script.tcl > C:\...\my_log.log
    my_script.tcl contains something like this:
    set OMBLOG "c:\\...\\some_kind_of.log"
    # Disconn just in case you have called a previous script
    OMBDISC
    source C:\\...\\script_with_omb_procedures.tcl
    OMBCC my_project
    OMBCONNECT CONTROL_CENTER "USER/PASSWORD@HOST:PORT:SERVICE" USE REPOSITORY 'MY_REPOSITORY_OWNER'
    OMBDCC
    DEFAULT_CONTROL_CENTER MY_CONTROL_CENTER
    proc_from_script_with_omb_procedures
    exit
    Hope this helps you to begin.
    Instead of using script_with_omb_procedures.tcl you can have your procedures directly inside my_script.tcl, but I like using a script apart to reuse my procedures.

  • How to run a java program in command prompt

    hi i want to run a java program from in command prompt from another directory
    i want to run a file named First in C:\Program Files\Java\jdk1.6.0_07\bin
    so when i give the command
    java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
    it doesnt works it shows
    C:\>java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\Program Files\Java
    \jdk1/6/0_07\bin\First
    Caused by: java.lang.ClassNotFoundException: C:\Program Files\Java\jdk1.6.0_07\b
    in\First
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: C:\Program Files\Java\jdk1.6.0_07\bin\First. Pro
    gram will exit.

    but it prints
    C:\>java -cp "C:\Program Files\Java\jdk1.6.0_07\bin\" First
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
    show splash screen with specified image
    C:\>

  • Starting 6735b in safe mode command prompt

    I have a 6735b laptop running XP.  I've had trouble starting Windows normally, but have been able to get to a command prompt from the Start in Safe Mode w Command Prompt.  The first line that came up was C:\Documents and Settings\Administrator.   Any help on where to go from here to get this thing restarted?
    This question was solved.
    View Solution.

    Hi
    Can you try chkdsk /f 
    Check if unit loads to safe mode you can try doing a system restore.
    Let us know how it goes!
    "I work for HP."
    ****Click the (purple thumbs up icon in the lower right corner of a post) to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    Regards
    Manjunath

  • Using Java To Open Terminal/Command Prompt

    I wanted a .jar file to open the terminal/command prompt on execution so that i can use System.out to display all the information needed...Is this possible? If so what code can i use to open the command prompt from java
    Thanks a lot ppl ;)

    Terminal prompt is plataform dependent, I would not advise you to do that. If your system outs are logging, i sugest you to use any logging api. If you are trying to display text information to the user, open any text widget and output there.
    May the code be wiht you.

  • VBScript Runs Correctly From Command Prompt, But Not From SQL Server Agent Job

    I'm trying to run this script on my local machine to do some post-batch cleanup and it doesn't run correctly from the scheduled job (or when I invoke the job).
    Here's the script in question:
    Option Explicit
    Const filePath = "C:\Documents and Settings\jmunn\My Documents\Visual Studio 2008\Logs\"
    Const holdDays = 6
    main
    Sub Main()
    ClearArchive
    End Sub
    Sub ClearArchive()
    Dim fso 'As Scripting.FileSystemObject
    Dim fld 'As Scripting.Folder
    Dim f 'As Scripting.File
    Dim delLogName, delLogOut, delCtr
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fld = fso.GetFolder(filePath)
    delLogName = filePath & "Nightly Backup - Backup Logs Deleted" & ".txt"
    Set delLogOut = fso.CreateTextFile(delLogName, True)
    delLogOut.WriteLine(delLogName)
    delLogOut.WriteLine("")
    delLogOut.WriteLine("-- The following log files were deleted on " & DateValue(Now()) & " at " & TimeValue(Now()))
    delLogOut.WriteLine("")
    delCtr = 0
    For Each f In fld.Files
    If Left(f.Name, 48) = "Nightly Backup - SQL Server Databases_Subplan_1_" And Right(LCase(f.Name), 4) = ".txt" Then
    If DateDiff("d", f.DateCreated, Date()) > holdDays Then
    delLogOut.WriteLine(f.Name)
    fso.DeleteFile f, True
    delCtr = delCtr + 1
    End If
    End If
    Next
    If delCtr = 0 Then
    delLogOut.WriteLine("No log files were deleted this run...")
    End If
    Set fld = Nothing
    Set fso = Nothing
    delLogOut.Close
    End Sub
    If I put the script in its own file and run it from the command prompt, it runs just fine. If the script runs from the SQL Server Agent job, the for-loop will delete the files correctly, but the filenames
    do not get written to the deletion log file and the counter does not get incremented, so according to the job log, nothing was deleted. Why does the script run differently from each invocation? It can't be a permission thing, the service that logs in has full
    access to the directory and the files do get deleted. Any ideas out there?
    Between this and other outstanding issues, I'm quickly losing faith in SQL Server.  >=o(
    Thanks in advance for your thoughts!
    John
    Version Info:
    Microsoft SQL Server Management Studio      10.0.2531.0
    Microsoft Analysis Services Client Tools      10.0.1600.22
    Microsoft Data Access Components (MDAC)      3.85.1132
    Microsoft MSXML      2.6 3.0 4.0 5.0 6.0
    Microsoft Internet Explorer      8.0.6001.18702
    Microsoft .NET Framework      2.0.50727.3603
    Operating System      5.1.2600
    "A bus station is where a bus stops. A train station is where a train stops. On my desk I have a workstation..."

    Hi
    jrmunn
    i am trying to execute VB script to refresh my excel files.. using Vbscript file through SQL Agent job step.
    i have copied VBscript in a file with the extension RefreshExcel.vbs kept in C:\RefreshExcel.vbs
    Below is the script used inside the file (RefreshExcel.vbs)
    //---Script code-----------------------------------------------------------------
    Dim objXL, objWB
    Dim FileLocation, FileName
    On Error Resume Next
    'lgnConn = 1
    FileLocation = "F:\Reports\Reports"
    Set objXL = CreateObject("Excel.Application")
    objXL.DisplayAlerts = False
    FileName = "ReportFile1.xlsx"
    'MsgBox (FileLocation & "/" & FileName)
    Set objWB = objXL.Workbooks.Open(FileLocation & "/" & FileName)
    objWB.EnableConnections
    objXL.CalculateUntilAsyncQueriesDone
    objWB.RefreshAll
    objXL.CalculateUntilAsyncQueriesDone
    objWB.RefreshAll
    objXL.CalculateUntilAsyncQueriesDone
    objWB.Save
    objWB.Close
    Set objWS = Nothing
    Set objWB = Nothing
    objXL.Quit
    Set objXL = Nothing
    'MsgBox ("Refresh Completed")
    ---------------------------------------------------------------------------------------------------//Script complete
    Now when i am trying to call this script file in SQL agent job step (as you mentioned )
    as Type -cmdExec(OperatingSystem)
    cscript "C:\RefreshExcel.vbs"
    Issue: job step executed succesfully ,,but without performing any refresh on the excel. So i am not understandig what is going wrong. the same script file work when i am calling it through a batch file (window scheuler task). But it doesnt support
    to run the file "when user is not logged in"
    that is why  i want to refresh my excel file through sql agent ,which can be scheduled to any time and cab be run as SQL agent credentials.
    Can you please help me on this ...i have tried all the option but nothing working .. found hope by seeing your solution.
    Thanks in advance.
    Please help me. :-(

  • Sql command Help from prompt

    How to invoke the online sql command syntax help from the
    sql prompt
    Regards
    RA

    I think you have posted to the wrong forum
    Business Intelligence Beans Product Management Team
    Oracle Corporation

Maybe you are looking for