Run SQL scripts from a unix directory

DB version: 11.2
Version of the operating system: Solaris 5.10

We have a set of scripts that are used by administrators to display the info of Tablespace free space, file size information... etc.

Currently these .sql files (say free_Space.sql) are stored in the directory/U02/dba_scripts /. To run these scripts a dba can navigate to this directory, and then connect to sql * plus and from there run it as
SQL > @free_Space.sql
I recently came across an environment where you can connect to SQL * more than any directory and you can run scripts as above any directory. How is that possible? Should what settings I set for this?

Herbaceous says:
DB version: 11.2
Version of the operating system: Solaris 5.10

We have a set of scripts that are used by administrators to display the info of Tablespace free space, file size information... etc.

Currently these .sql files (say free_Space.sql) are stored in the directory/U02/dba_scripts /. To run these scripts a dba can navigate to this directory, and then connect to sql * plus and from there run it as

SQL > @free_Space.sql

I recently came across an environment where you can connect to SQL * more than any directory and you can run scripts as above any directory. How is that possible? Should what settings I set for this?

SQLPATH environment variable

Tags: Database

Similar Questions

  • How to run a script in environment unix and how to run this program into a toad

    Hello guys
    Please help me!
    How to run a script in the unix environment (Group of programs (cursor, programs...) stored in a file file.sql).

    file.sql luks like this


    WHENEVER OSERROR EXIT FAILURE
    WHENEVER SQLERROR EXIT SQL. SQLCODE
    SET the position
    SET serveroutput size 1000000
    coil ins2aais_jobs;
    SELECT "FILE IS: ins2aais_jobs' FROM dual;"
    SELECT "STARTED:' began, to_char (sysdate," YY/MM/DD HH24:MI:SS) TIME FROM dual; "
    DECLARE
    lv_upd_ct number: = 0;
    lv_ins_ct number: = 0;
    lv_exp_ct number: = 0;
    ---------------------

    date of lv_FROM_date;
    date of lv_to_date;
    lv_mon_or_week varchar2 (20);
    date of lv_week_end_date;
    lv_month_indicator varchar2 (8);
    -------------------------------------------------
    Aais CURSOR IS
    SELECT the ID substr (ID, 1, 7), SSN, FNAME, LNAME
    , SUCCESS, COMPENSATE, INSTALLATION
    , MODU, DRIVE, REVERSE, SUCC_RATE
    TRANS_TOTAL, FILE_NAME, WEEK_END_DATE
    RUN_DATE
    OF weekly_aais;

    -------------------------

    I aais % rowtype;


    -------------------------
    PROCEDURE p_ins (r1 aais % ROWTYPE) IS
    BEGIN
    BEGIN
    INSERT INTO AAIS_JOBS
    (ID, SSN, SUCCESS, COMPENSATE, INSTALL, MODU
    , DRIVE, REVERSE, SUCC_RATE, TRANS_TOTAL
    FILE_NAME, WEEK_END_DATE, RUN_DATE
    AAIS_FNAME, AAIS_LNAME
    )
    VALUES
    (r1.ID, r1. SSN, r1. SUCCESS, r1. COMPENSATE, r1. INSTALLATION, r1. MODU
    r1. DISK, r1. CONVERSELY, r1. SUCC_RATE, r1. TRANS_TOTAL
    r1. File_name, r1. WEEK_END_DATE, r1. RUN_DATE
    r1. FNAME, r1. LNAME
    );
    lv_ins_ct: = lv_ins_ct + 1;
    EXCEPTION
    WHILE OTHERS then
    DBMS_OUTPUT. PUT_LINE ('ERROR IN THE INSERT STATEMENT');
    DBMS_OUTPUT. Put_line (SQLERRM);
    lv_exp_ct: = lv_exp_ct + 1;
    END;

    END;

    ------------------------------

    PROCEDURE p_disp_msg IS
    BEGIN
    DBMS_OUTPUT. Put_line (' number of insertion: ' | to_char (lv_ins_ct));
    DBMS_OUTPUT. Put_line (' number of Exceptions: ' | to_char (lv_exp_ct));

    lv_ins_ct: = 0;
    lv_exp_ct: = 0;
    END;

    ---------------------------

    BEGIN

    lv_FROM_date: = to_date ('& 1', 'DD-MON-RR');
    lv_to_date: = to_date ('& 2', 'DD-MON-RR');
    lv_mon_or_week: = 'and 3';

    lv_month_indicator: = di.get_month_ind (lv_mon_or_week, lv_FROM_date, lv_to_date);

    ------------------------------------

    REMOVE FROM AAIS_JOBS
    WHERE WEEK_END_DATE = lv_to_date;

    -------------------------------------

    COMMIT;

    Aais OPEN;
    LOOP
    EXTRACT the aais IN i;
    OUTPUT WHEN aais % NOTFOUND;
    BEGIN
    p_ins (i);
    END;
    END LOOP;
    Aais CLOSE;

    commit;

    DBMS_OUTPUT. PUT_LINE ('INSERT INTO TABLE JOBS AAIS');
    p_disp_msg;


    -----------------------------------

    END;
    /
    SELECT "FINISHED: ' | '. TO_CHAR (sysdate, "MM/DD/YY HH24:MI:SS'") FROM dual
    /
    spool off
    "exit";


    and also how we organize this into a toad?


    Thank you.

    Hello

    You vous connecter connect to oracle through unix and SQL prompt, run these commands in a .sql file.

    Toad, you can run the instructions individually by selecting the sql statements or in a set with the F5 key.

    Kind regards
    AJR

  • Running SQL scripts on different databases

    Hello!

    At my work we have many databases on a server. I have to make a request so that users can run the application on a selected database SQL scripts.

    So my question may be separated into 2 sections:

    1 - is possible to let users SQL scripts run directly from the application?

    I think a database to create a page that displays the list of all the SQL scripts, that we want to use, and when you click on a specific script name in the list, it asks something like "Where the database you want to run the script?", and then, as confirmed by the user, it would show results running the script on a different page.

    is 2 - possible to let users choose what database to run these scripts?

    Any information would be helpful, I'm at the beginning of the project and am not sure at all about how to proceed, or if it is at all possible.

    Thank you!

    Fallen_Kaede wrote:

    Thanks for the quick response. I confirm that we are talking about databases on a server.

    The request is to "debug" to other databases. For example, be run scripts to the locks on the list, to show the different indexes on a table, etc. to help diagnose problems.

    It looks like the 'users' are DBA who should use OEM/Grid Control to do so.

    1 - is possible to let users SQL scripts run directly from the application?

    Lol the only way to run scripts in the APEX is the use of the SQL Scripts for SQL workshop component.

    The key word in your question is 'application '. SQL * more and Developer SQL are applications that allow users to run SQL scripts on the desktop. Scripts SQL is an APEX integrated application that allows developers to run SQL scripts on the web. However, there is no documented way supported for end users to run SQL scripts in a custom of APEX application that you created. Therefore, rethink your approach. Rather than create an application APEX runs scripts, you must convert the scripts in PL/SQL, APEX packages, pages, components and applications leverage features of the APEX and reports, graphics and interactivity (e.g. exploration links; timed refreshes etc.). This will give you a user experience improved, beyond what is possible using static SQL scripts.

    is 2 - possible to let users choose what database to run these scripts?

    The APEX applications would exist on an instance of the APEX in a database and access other databases using the database links (which can have a performance impact). It would be possible to create a LOV based on the view of the USER_DB_LINKS dictionary and use in a selection set to a global page list to provide a control to set the current context of the database. Region data sources will have to be generated dynamically in the packages of PL/SQL use the links from relevant database based on this value LOV.

  • Best way to run a script from a script

    Hello world

    I'm looking for running a script from an After Effects script, so far, there is aftereffects.executeScript (scriptContent) who use eval to run the script. The problem is that it uses eval so it is not really sure and he is slower. So I would like to know what is actually used when we file-> Script-> Run script file.

    As seen in the Javascript tool Guide CC page 168 in the section QAnywhere Corss-DOM.

    aftereffects.executeScript(theScriptContent); // Doesn't work with a script which as comments AND the script has access to my scope
    

    In addition, if there are comments like / * * / or / * / in the script I want to run, it no longer works.

    So, what is the best way to run a script from a script?

    If you want to evaluate a whole script file, you can use $.evalFile (file, timeout) - see description in ESTK object model viewer

    To evaluate a bit of code, you can use eval, that's for sure.

    Xavier

  • When I run my script from a shortcut ExtendScript is invoked, but this isn't when I run the menu

    I use Photshop CS2 on Win XP

    I set up a keyboard shortcut (Ctrl + Alt + P) to execute a .jsx file in the folder... \Presets\Scripts\.

    When I activate the script via the keyboard shortcut ExtendScript is called and interrupts execution on main() statement (see below).

    When I activate the script via the menu file/Scripts that extendscript is not called and the script runs up to the end.

    The .jsx file is a wrapper for a .vbs script that does the 'real' work

    The .jsx is:-

    main() function
    {
    var VBSscript = file ("C:/Program Files/Adobe/Adobe Photoshop CS2/Presets/Scripts/GGN_PS_Code_v1_2.vbs");
    If (VBSscript.Exists) VBSscript.execute ();
    }
    main();

    Anyone have any ideas on how to disable the invocation of ExtendScript when I run the script from the skortcut?

    One thing to check is that the .jsx extension is associated with Photoshop and not ExtendScript.

  • How to load SQL scripts from a text file.

    Hi, I tried several times to load a script file/SQL text with 10 different tables and the data, but 10g Express doesen't allows me to do that, can someone direct me or tell me what I do or what I need to adopt a special method to achieve this. I'm sure there must be something where you can download SQL scripts from a text file (in the SQL command editor!). Thank you

    Hello

    Yes, as Aust replied, you must use SQL Workshop/SQL Script, instead the command SQL Editor.

    Sqlplus can also do so, I think, as well as SQL Developer, now it is 1.5.

    sqlplus: (the window command line, black of sql)

    SQL > @path /--(l'extension devrait être.sql) filename.sql.

    Peter

  • Running a script from the command line

    Hi all
    First of all, I'd like to say I'm just starting ORACLE 11 g with no prior experience of the database. I currently lectures once a week. However, I am stuck with a problem. I am trying to access my database of the United of the House so I can do some work, apparently I can only access it via the command prompt (which is good for me) I began by downloading a shell www.putty.org secure and I managed to connect to my database of test of the University from my laptop at home. However, I have a createHR.sql of script file that is stored in my C:\ORACLE directory which I try to access in order to load my test tables and start practicing with them.
    use command line

    SQL > C:\ORACLE\createHr and I get SP2-0310: unable to connect to the file "C:\ORACLE\create HR.sql".

    normally, this should load and run the script - as with the browser method guests will get the tables is created and the test data.

    I am now officially frustrated that I can't get any done practice, offered any help will be welcome.

    Concerning

    Claude

    Published by: 891128 October 12, 2011 09:33

    Published by: 891128 October 12, 2011 09:41

    Published by: 891128 October 12, 2011 09:44

    891128 wrote:
    I started by downloading a shell www.putty.org secure and I managed to connect to my database of test of the University from my laptop at home.
    However, I have a createHR.sql of script file that is stored in my phonebook C:\ORACLE

    These two sentences above are essential. If I had to bet a directory C:\ORACLE assumption is located locally on your laptop. However, it seems you have done a SSH connection to your server and connected to the database using SQL * more customer on the server. The client on the server has no idea or access to files on your machine.

    You must open the script on your laptop and copy / paste into your SQL SSH * more session or you will need to find a way to copy this script on the server, so you can run it.

    I hope this helps!

  • can the run/run .sql script in another application?

    Hello..

    I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").

    But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.

    script: @c:\Users\test.sql

    in the script:

    coil c:\Users\test.csv;

    ' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »

    of RF_LOT_ON_HOLD_LIST;

    spool off;

    Thank you.

    bunch

    Yes, we know what talking about your question.

    a .sql script is just a plain text file containing everything you want.  The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).

    Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.

    What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.

    As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool.  The database itself has no idea what "spool" means, while passing to the database somehow does not work.  I also doubt that netbeans knows what that means, either.

    So, in short, how you try to do, not you cannot.

  • need help to run a script from cron

    Here's what I'm trying to get running (not the script complete, but all I need for this example):

    #! / bin/sh

    esxcfg-info - s & gt; /tmp/info.txt

    output

    This script works from the command line and info.txt is filled with loads of data. If I run it from cron, I don't get any errors, but the file has no data (0KB).

    I run other scripts of shell cron with no problems, but they are not call esxcfg orders. I guess that's because cron does not run as root as I am from the command line. Can anyone help to get this shell script to run or what do I need to get cron to complete (perhaps as root)? I don't want examples of perl, that my shell script is much more and I'm not a perl programmer, so I does the conversion.

    Thank you!

    You must specify the path complete the command that you try to run or any other entry Besides, since the projected TRACK can not set when the cron job started.

    who can help you locate that

    [root@himalaya Devastator-2009-05-22--2]# which esxcfg-info
    /usr/sbin/esxcfg-info
    

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    http://Twitter.com/lamw

    If you find this information useful, please give points to "correct" or "useful".

  • How to run SQL scripts using OWB process flows?

    Hello
    I have a few SQL Scripts. I run them using process flow OWB.

    Can I get a document or a link that helps me to achieve this?

    Thanks in advance,
    SriGP

    Hi SriGP,

    You can call SQLPLUS using the external process activity.

    Order: Give the full path of the SQLPLUS executable
    Script: specify what you want to do in SQLPLUS

    Thank you
    Fati

  • Running a script from .plb

    I use Oracle Database 10 g. I create a function in the hr schema and wrapped it. I can run this file to film in this scheme successfully. But I want to run this script in a different schema. I tried to run this encapsulated file (.plb) in the scott schema. But can not create this function. It gives an error like this-' ORA-01435: user does not exist. "Can I use this schema to another? If so, please someone provide me the way.

    MD. ROUMANE wrote:

    I use Oracle Database 10 g. I create a function in the hr schema and wrapped it. I can run this file to film in this scheme successfully. But I want to run this script in a different schema. I tried to run this encapsulated file (.plb) in the scott schema. But can not create this function. It gives an error like this-' ORA-01435: user does not exist. "Can I use this schema to another? If so, please someone provide me the way.

    Hello Joe,

    ORA-01435: user does not exist

    means that you USER_NAME. Function_name in the encapsulated file (.plb).

    First no wrapped up and remove the user name and re-packed and try.

    Hamid.

  • No model output module custom when you run the script from another process

    Hello

    I have a following problem:

    Try to automate the video rendering. When I run extend script of the program that is launched at windows startup, there is no custom output module template. If the script is started manually, it works perfectly.

    Trying to applyTemplate output module in the results of item renderer error queue.

    I use AE 2014 (13.1.1.3) and windows server 2012 standard r2.

    Thanks for help.

    Sounds like a permissions problem, you will need to set your user contexts and escalate privileges before running the script.

    Mylenium

  • How to run a script from a "Button 1" button?

    Hi all, I had this problem to have a window with several buttons named "Button 1" "button 2"... and run the script 'Script A' If you click on button 1, the script 'Script B' If you click on the button 2, etc... ".

    Here is my small script:

    indesign #target

    create a table of contents that send directly to the good script

    var l = new Window ("dialog");

    var buttongroup = w.add ("group");

    var panel = buttongroup.add ("panel");

    var button1 is panel.add ("button", undefined,"Script");.

    var button2 is panel.add ("button", undefined, "Script B");.

    var button3 is panel.add ("button", undefined, "Script C");.

    var cancel = buttongroup.add ("button", undefined, "Cancel", {name:'cancel'});})

    buttongroup.addEventListener ('click', press)

    w.Show ();

    function press (e) {}

    {if(e.Target.type=="Button")}

    If {(A e.target.text is "Script. »)

    w.Close ();

    app.doScript (new File("c/scriptA.jsx"),ScriptLanguage.javascript);

    }

    Else if (e.target.text == "Script B") {}

    app.doScript (new File("c/scriptB.jsx"),ScriptLanguage.javascript);

    }

    Else if (e.target.text == "Script C") {}

    app.doScript (new File("c/scriptC.jsx"),ScriptLanguage.javascript);

    }

    }

    }

    Each manuscript A, B and C starts with an app.dialogs.add)

    And that is the problem, he said that an alert or a modal dialog box is already active

    I tried the w.close (), but it does not work...

    I don't think that addEventListener is what I need, maybe I'm wrong for a window, but it is the only way to give names to the buttons, is it not?

    Instead of var this:

    w = new Window ("dialog");

    Use this:

    var l = new Window ("range");

    Peter

  • Problem to run the script from cron

    I have a script I want cron to run every day and it works fine if I connect at the VMAs and run it from the command line, but cron raise fair return "unavailable server version to... /usr/lib/perl5/5.10.0/VMware/VICommon.pm line 545. And the thing is, he has worked for cron too before update us the vMA to 5.0.0.1 build 643553.

    Any ideas how to solve this problem?

    Try adding

    {PERL_LWP_SSL_VERIFY_HOSTNAME} $ENV = 0;

    (old topic error: Server version not available at "https://1.1.1.1/sdk/vimService.wsdl" connecting to the virtual center with connect.pl)

  • run multiple scripts from one script (siebel load)

    Hello

    Saving scripts for reading chained for siebel load test, when the record button is reached, the browser window closes.

    Is there no work around the navigation in this script should start from the point in the browser where the first script off?

    Everything works fine for web http, functional siebel, but fails when siebel saving load a script.

    Thnkx

    Hello

    In OpenScript go to: view -> OpenScript preferences -> record -> HTTP and uncheck the box browser close.

    Hope that helps

    Alex

Maybe you are looking for