passage OEM "SQL Script" job name in lowercase as proxy database

Hello

I have a SQL script that requires the name of the database in lower case to be passed when running - she uses it as a substitution variable to create database directories that point to the UNIX file system (which is why they are case sensitive). I want to be able to configure this script as work in OEM (12 c version 3) so that I can run on several databases (11.2.0.3), but at the creation of employment, the % DBName parameter returns only the name of the database uppercase. I tried to change the % DBName parameter and run the script in a PL/SQL block, but the variable I spend it is interpreted as a literal string. I also tried to run in a shell script, but because of the way the user operating system is set up that I can't get that to work either.

Does anyone have any ideas how this can be done? Ideally, I wish I could just run @script lower (%DBName%) or something similar.

Thanks in advance,

Robin

In case anyone else has trouble with this, I worked on that I was able to use a PL/SQL block to convert the variable substitution for lower case, then create the directory with the variable:

DECLARE

v_lowerSID varchar2;

BEGIN

Select lower ('& 1') in the double v_lowerSID;

run immediately ' create the db_dir as directory "/ [path] /' | v_lowerSID | '/' || v_lowerSID | ' _directory1 "';

END;

/

Tags: Enterprise Manager

Similar Questions

  • Create jobs and positions via PL/SQL script

    Hi, it is recommended to insert new jobs and positions via PL/SQL Script?

    I know it's possible, I'm not sure if it is recommended. especially when it's via a direct insertion.

    Is there an API for it?

    I have about 200 + positions I need to set in our Instance of the EBS Test.

    Thank you!

    The APIs are the best way to do it in batches of charges-

    Job: HR_JOB_API

    Position: HR_POSITION_API

    To know that all the seeds API, add the responsibility of integrated SOA gateway

  • Job SQL Script using UTL_Mail.send fails

    Hello world

    It comes to 10.2.0.4 on Windows

    I have configured UTL_Mail and it works when I send mails via sqlplus.

    Now, just trying to get my work very simple SQL Script to send an email.

    That's all that is in the control box (I use control of the database to create the job)

    exec UTL_MAIL.send (sender = > '[email protected]',)
    recipients = > "[email protected]"
    CC = > '[email protected] ',.
    BCC = > '[email protected] ',.
    subject = > "UTL_MAIL Test."
    message = > "Job ULTRAPRD INTEGER BKUP Email on PNCLULTRAPRD has successfully completed");



    Natural logarithm of output

    SQL * more: Release 10.2.0.4.0 - Production on Fri Jul 17 09:36:32 2009

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

    SQL > SQL > SQL > SQL > connect.
    SQL > SQL > START UTL_MAIL.send(sender => '[email protected]',;) END;
    *
    ERROR on line 1:
    ORA-06550: line 1, column 53:
    PLS-00103: encountered the symbol ";" when expecting one of the following values:
    (- + new case mod not null other < an ID >)
    < between double quote delimited identifiers of > < a variable binding > avg
    current account is min max sql stddev sum variance prior
    execute forall time timestamp interval date fusion
    < a literal string with character set specification >
    < a > < a SQL string between single quotes > hose
    < a literal character in string quoted also defined specifications >
    < an alternatively-q


    SQL > SP2-0734: order unknown beginning "recipients...". "- rest of the ignored line.
    SQL > SP2-0734: order unknown beginning 'cc... '. "- rest of line is ignored.
    SQL > SP2-0734: order unknown beginning «bcc...» "- rest of line is ignored.
    SQL > SP2-0734: beginning of unknown command "subject...". "- rest of the ignored line.
    SP2-0044: for a list of known commands type HELP
    and to let EXIT.
    SQL > SP2-0734: order unknown start "message...". »


    Thanks for all the ideas. John

    Published by: user629010 on July 17, 2009 17:11

    Published by: user629010 on July 17, 2009 17:13

    Why the output does not say:

    Procedure completed successfully

    ????

    What about -

    END;
    /

    as the last 2 lines.

  • I choose the computer name of the machine running a SQL script

    Hello. I am looking for a way to select the computer name of the machine running a SQL script. Is this possible?

    I tried the following, but it does not work. Any suggestions?

    Select % computername % of double;

    http://www.Oracle.com/technology/oramag/code/tips2003/011903.html

    Check this link see if it helps.

    Concerning

    REDA

  • 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.

  • How to generate a sql script that is based on the structure of the table

    I want to generate a sql script that is based on a table structure.

    For example:

    If the table is:

    CID id c_value
    -----------------------------
    1 1 zz
    2 1 yy
    3 2 zz
    4 2 xx
    5 3 ss
    6 tt 3


    The expected output is:

    WITH
    CHILD_tab like)
    SELECT 1 cid, 1 id, 'zz' c_value of all the double union
    SELECT 2 cid, 1 id, 'yy' c_value of all the double union
    SELECT 3 cid, 2 id, 'zz' c_value of all the double union
    SELECT 4 cid, 2 id, 'xx' c_value of all the double union
    SELECT 5 cid, 3 id, 'ss' c_value of all the double union
    SELECT 6 cid, 3 id, 'tt' double c_value)


    11.1.0.7.0 release

    I do a lot of XML these days (maybe too well) so here is a solution involving XQuery.
    We pass a query string and it generates a CLOB containing the WITH clause:

    SELECT DBMS_XMLGEN.Convert(
    XMLQuery(
    q'[concat(
    "WITH t AS (
    ",
    string-join(
     for $i in /ROWSET/ROW
     return concat( " SELECT ",
                    string-join($i/*/concat("'",ora:replace(text(),"'","''"),"' ",local-name()),", "),
                    " FROM dual" ),
    " UNION ALL
    "
    ),
    "
    )")]'
    passing dbms_xmlgen.getXMLType('SELECT * FROM scott.emp')
    returning content
    ).getClobVal(), 1) AS WITH_CLAUSE
    FROM dual;
    
    WITH_CLAUSE
    --------------------------------------------------------------------------------
    WITH t AS (
     SELECT '7369' EMPNO, 'SMITH' ENAME, 'CLERK' JOB, '7902' MGR, '17/12/80' HIREDATE, '800' SAL, '20' DEPTNO FROM dual UNION ALL
     SELECT '7499' EMPNO, 'ALLEN' ENAME, 'SALESMAN' JOB, '7698' MGR, '20/02/81' HIREDATE, '1600' SAL, '300' COMM, '30' DEPTNO FROM dual UNION ALL
     SELECT '7521' EMPNO, 'WARD' ENAME, 'SALESMAN' JOB, '7698' MGR, '22/02/81' HIREDATE, '1250' SAL, '500' COMM, '30' DEPTNO FROM dual UNION ALL
     SELECT '7566' EMPNO, 'JONES' ENAME, 'MANAGER' JOB, '7839' MGR, '02/04/81' HIREDATE, '2975' SAL, '20' DEPTNO FROM dual UNION ALL
     SELECT '7654' EMPNO, 'MARTIN' ENAME, 'SALESMAN' JOB, '7698' MGR, '28/09/81' HIREDATE, '1250' SAL, '1400' COMM, '30' DEPTNO FROM dual UNION ALL
     SELECT '7698' EMPNO, 'BLAKE' ENAME, 'MANAGER' JOB, '7839' MGR, '01/05/81' HIREDATE, '2850' SAL, '30' DEPTNO FROM dual UNION ALL
     SELECT '7782' EMPNO, 'CLARK' ENAME, 'MANAGER' JOB, '7839' MGR, '09/06/81' HIREDATE, '2450' SAL, '10' DEPTNO FROM dual UNION ALL
     SELECT '7788' EMPNO, 'SCOTT' ENAME, 'ANALYST' JOB, '7566' MGR, '19/04/87' HIREDATE, '3000' SAL, '20' DEPTNO FROM dual UNION ALL
     SELECT '7839' EMPNO, 'KING' ENAME, 'PRESIDENT' JOB, '17/11/81' HIREDATE, '5000' SAL, '10' DEPTNO FROM dual UNION ALL
     SELECT '7844' EMPNO, 'TURNER' ENAME, 'SALESMAN' JOB, '7698' MGR, '08/09/81' HIREDATE, '1500' SAL, '0' COMM, '30' DEPTNO FROM dual UNION ALL
     SELECT '7876' EMPNO, 'ADAMS' ENAME, 'CLERK' JOB, '7788' MGR, '23/05/87' HIREDATE, '1100' SAL, '20' DEPTNO FROM dual UNION ALL
     SELECT '7900' EMPNO, 'JAMES' ENAME, 'CLERK' JOB, '7698' MGR, '03/12/81' HIREDATE, '950' SAL, '30' DEPTNO FROM dual UNION ALL
     SELECT '7902' EMPNO, 'FORD' ENAME, 'ANALYST' JOB, '7566' MGR, '03/12/81' HIREDATE, '3000' SAL, '20' DEPTNO FROM dual UNION ALL
     SELECT '7934' EMPNO, 'MILLER' ENAME, 'CLERK' JOB, '7782' MGR, '23/01/82' HIREDATE, '1300' SAL, '10' DEPTNO FROM dual
    )
    

    It may be useful for small datasets only because we reached quickly ORA-01706.

  • SSIS package in sql agent job

    I AM trying to EXECUTE a sql AGENT JOB. And I am getting this error below.

    But I'm not able to identify exactly what is the issue.

    The work I get a successful execution when it is run manually in SSIS2013.tHERE I USE the EXACT VARIABLES. Help, please.

    Here is the error of the story of job.

    Day 02/08/2016 08:44:32
    Historic backlog)

    ID from step 1
    Server
    Name of the job
    Step name exec command file
    Time 00:00:01
    SQL severity 0
    SQL Message ID 0
    Operator by e-mail
    Operator Net sent
    Operator paged
    Retries attempted 0

    Message
    Executed as user: asd... * C:\Windows\system32>REM * STEP: get the letter order of maestro and run the SSIS C:\Windows\system32>REM package * C:\Windows\system32>REM * C:\Windows\system32>REM * C:\Windows\system32>REM * AX-RISCVMSQL440Microsoft (R) SQL Server Execute Package Utility Version 12.0.4100.1 for 32-bit Copyright (C) Microsoft Corporation. All rights reserved.    Start: 08:44:32 Info: 2016-08-02 08:44:32.39 Code: 0 x 40016041 Source: abc Description: the package tries to configure from the XML "J:\ReportSettings\BatchJobsConfig.dtsConfig".  End of information news: 2016-08-02 08:44:32.44 Code: 0x4004300A Source: ErrorLog to FlatFile SSIS. Pipeline Description: starts the Validation phase.  End progress Info: 2016-08-02 08:44:32.44 Source: for the validation of the FlatFile error log: 0% complete end progress CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePreComponentCall Description: data flow engine invokes a component method.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePostComponentCall Description: data flow engine has completed a call to a method of component.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePreComponentCall Description: data flow engine invokes a component method.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePostComponentCall Description: data flow engine has completed a call to a method of component.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePreComponentCall Description: data flow engine invokes a component method.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePostComponentCall Description: data flow engine has completed a call to a method of component.  End progress CustomEvent: 2016-08-02 08:44:32.44 Source: for the validation of the FlatFile error log: 50% full end progress CustomEvent: 2016-08-02 08:44:32.44 Source: name of the journal of the FlatFile errors: OnPipelinePreComponentCall Description: data flow engine invokes a component method.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePostComponentCall Description: data flow engine has completed a call to a method of component.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePreComponentCall Description: data flow engine invokes a component method.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePostComponentCall Description: data flow engine has completed a call to a method of component.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePreComponentCall Description: data flow engine invokes a component method.  End CustomEvent CustomEvent: 2016-08-02 08:44:32.44 Source: journal of the FlatFile errors name: OnPipelinePostComponentCall Description: data flow engine has completed a call to a method of component.  End progress CustomEvent: 2016-08-02 08:44:32.44 Source: for the validation of the FlatFile error log: 100% complete end course Info: 2016-08-02 08:44:32.44 Code: 0 x 40043006 Source: ErrorLog to FlatFile SSIS. Pipeline Description: Prepare for Execute phase begins.  End progress News: 2016-08-02 08:44:32.44 Source: ErrorLog FlatFile prepare Execute: 0% all CustomEven end progress...  Exit code 1.  The step failed.

    Hi John,.

    According to the description, you have concerns about ssis package in the SQL agent job and you are unable to identify what exactly is the question. In addition, you get a performance successful when performed manually in SSIS2013 on the system.

    Certainly, I understand your concern.

    In order to get more information about this, I suggest you to post your query on the forum of the MSDN Community for that matter. You can get more effective suggestions and adapted by experts familiar with this topic.

    Please visit the link below for the best support.

    https://social.msdn.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer

    I hope this information is useful.

    Please let us know if you need more help, we will be happy to help you.

    Thank you.

  • Excerpt from SQL script Planner

    Hello

    Developer SQL version 3.2.10.09

    Is there a way to extract the SQL of a scheduler job script? I put in place a work in my enviromnent of test using the Wizard SQL Developer that worked extremely well, but my dba insists on having a SQL script to deploy in the active database.

    Thank you

    Nick.

    Try this:

    select
      dbms_metadata.get_ddl('PROCOBJ', 'your_job_name')
    from dual;
    

    -------
    You can also create new 'DDL' tab for jobs in SQL Developer yourself in less than 5 minutes:
    b save the XML in a file - for example 'JobEditDDL.xml '.

    
      
        <![CDATA[*DDL]]>
          
            
          
        
      
    
    

    b to the SQL Developer open: Tools-> preferences-> database-> user defined extensions
    (c) click the button. Select EDITOR (type), and then add the full path of the xml file.
    d click "OK" and restart SQL Developer

    Edited by: dz_r 2012-11-21 23:12

  • Insert the SQL script for BLOBs

    Hello

    I managed to upload my word and pdf documents in the database using blob support APEX and have these columns in the MY_DOC table

    , VARCHAR2 (400) FILE NAME NOT NULL
    BLOB_CONTENT BLOB
    , VARCHAR2 (48) MIME_TYPE

    Now I want to migrate the data to another environment by using an insert SQL script, how to respond to the BLOB column in the insert script?

    Kind regards

    ADE

    You cannot migrate data blob with insertion of scripts. However, you can achieve this by using the datapump...

    Example:

    expdp sysadm/sysadm tables = dumpfile = dump.dmp logfile = expdp_dump.log patterns =
    Impdp sysadm/sysadm dumpfile = dump.dmp

    BR,

    Nico

  • Registering InDesign Script ID/name pair

    Hello

    I try to record some InDesign Script ID/name pair, but it doesn't seem to work.

    These are my pairs:

    TFSS, Suite TabFlow
    TFob, object of the object TabFlow
    TFut, event table update
    TFuj, event do update of jobs
    TFop, object from the TabFlow property
    TFts, model for the table Propetry slug
    Patiaudrey, updateJob-ID parameter

    If I submit that I return to the site. There are 4 confused red symbols showing, but not a message of error or something like that. You can see in the attached priontscreen.

    I want to see the pairs already registered, the site is empty.

    What coud be wrong?

    Thank you

    Hans

    My first guess would be the "-" in udateJob-ID.

    So please revisit the naming conventions.

    -Have a look at docs/references/scripting-dom-applescript-idr60.html for examples, AS linking is closer to the natural formatting.

    -capitalization is generally left for the engine, with the exception of acronyms, for example 'suite of XML '.

    -for identifiers JS, caps indicate spaces in the original name

    -your starting names with generic types such as 'Suite', 'Object' will lead to confusion. Omit those who, with the exception of the suite where you make a suffix (put behind the name). for example 'suite of interactive elements '.

    -This TabFlow object looks like a singleton or a preference. I would call it "option TabFlow" or "TabFlow preferably" instead, depends on the question of whether it is persistent.

    -the name of the corresponding property is the plural form. See, for example

    This AppleScript DOM Qouting: (I hate this wysiwyg forum editor!)

    script preferences (property kScriptPrefsPropertyScriptElement)

    ScriptID= 'DCPDH', name = 'script preferences '.<--- the="" property="">

    Description = preferences. Script, Plugin = Scripting.InDesignPlugin
    Data type = "script of preference"<---- the="" class="">


    Finally, what makes you choose the "do" in "do update... "for the unique event, then omit it for each other?

    Have fun

    Dirk

  • PL/SQL Script for dates

    Hello
    I am new to Oracle and PL/SQL Script. I would like to ask - is it possible to write a PL/SQL Script to compare two dates in Oracle.
    It is a very basic example of the structure of the table.

    table_1)
    client_name varchar2 (30);
    client_expire_date DATE;
    status varchar2 (30);
    );

    settings)
    time_to_run varchar2 (30);
    );

    I want to write a script that runs each for example 5 minutes (I want the script to take time to time_to_run rank, each time when it starts) and compare the client_expire_date with the sysdate. If the client_expire_date < sysdate scripts updates the State of the locked client.
    Is it possible to do?

    concerning
    CREATE TABLE clients
    ( client_serial       INTEGER CONSTRAINT clients_pk PRIMARY KEY
    , client_expire_date  DATE
    , client_name         VARCHAR2(30) NOT NULL
    , status              VARCHAR2(20) DEFAULT 'active' NOT NULL );
    
    INSERT INTO clients VALUES (1, TO_DATE('2010-08-21 15','YYYY-MM-DD HH24'), 'Largo', 'active');
    INSERT INTO clients VALUES (2, TO_DATE('2010-08-21 16','YYYY-MM-DD HH24'), 'Blofeld', 'active');
    INSERT INTO clients VALUES (3, TO_DATE('2010-08-21 17','YYYY-MM-DD HH24'), 'Scaramanga', 'active');
    INSERT INTO clients VALUES (4, TO_DATE('2010-08-21 18','YYYY-MM-DD HH24'), 'Drax', 'active');
    INSERT INTO clients VALUES (5, TO_DATE('2010-08-21 19','YYYY-MM-DD HH24'), 'Goldfinger', 'active');
    
    COMMIT;
    
    BEGIN
        DBMS_SCHEDULER.CREATE_JOB
        ( job_name        => 'SET_STATUS'
        , job_type        => 'PLSQL_BLOCK'
        , job_action      => 'BEGIN ' ||
                                   'UPDATE clients SET status = ''locked'' ' ||
                                   'WHERE client_expire_date < SYSDATE AND status != ''locked''; ' ||
                             'END;'
        , repeat_interval => 'FREQ=MINUTELY;INTERVAL=5'
        , enabled         => TRUE
        , auto_drop       => FALSE
        , comments        => 'Demo job to update CLIENTS table every 5 minutes');
    END;
    /
    
    SELECT log_date, status, run_duration
    FROM   user_scheduler_job_run_details
    WHERE  job_name = 'SET_STATUS';
    
    LOG_DATE                                          STATUS                         RUN_DURATION
    ------------------------------------------------- ------------------------------ -------------------
    21-AUG-10 16.53.35.671000 +01:00                  SUCCEEDED                      +000 00:00:00
    21-AUG-10 16.58.35.609000 +01:00                  SUCCEEDED                      +000 00:00:00
    
    SELECT * FROM clients;
    
    CLIENT_SERIAL CLIENT_EXPIRE_DATE CLIENT_NAME      STATUS
    ------------- ------------------ ---------------- --------------------
                1 2010-08-21 15:00:0 Largo            locked
                2 2010-08-21 16:00:0 Blofeld          locked
                3 2010-08-21 17:00:0 Scaramanga       active
                4 2010-08-21 18:00:0 Drax             active
                5 2010-08-21 19:00:0 Goldfinger       active
    
    select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') as time_now from dual;
    
    TIME_NOW
    -------------------
    2010-08-21 17:02:17
    

    (Scaramanga account has been locked by the next run at 17:03)

    You can call a procedure under the action of work rather than including the command line.

    To abandon the work,

    CALL DBMS_SCHEDULER.DROP_JOB('SET_STATUS');
    
  • exp and imp in a sql script

    Hello

    I want to develop a sql script contains both code for the creation and insertion on a table and the exp command to export this table.
    Do you have an idea how integrate the command exp and imp in the sql script.

    Thank you.

    Edited by: Andrew1 Nov. 11. 2009 02:33

    This should be easy under Windows.

    Put the #1 and #2 in separate text files (.sql as use ending), for example create_table_web_enfants1.sql

    Create a batch (.cmd use as ending) file when you call these sql files, for example setup.cmd

    sqlplus /@ @create_table_web_enfants1.sql
    ...

    Add your exp returns to your command file

    and STI test.

    BTW: I'm going to assume that you post any real names of user/passwords to a production company database in your example, if not, you have broken some rules concerning the said database access security.

    C.

  • Oracle 11G demobld.sql Script...

    I have a colleague asked me to install the demo tables that Oracle used to provide (for example, scott/tiger HR, EMPL and other tables, but I don't seem to be able to find the demobld.sql script in the old location ($OH/sqlplus/demo).)

    Oracle still offers a simple demo for developers and others to learn SQL?

    Also, I used to have an old book (probably from Oracle 7) Oracle who gave examples of the use of the demo tables owned by scott.
    This book was actually written by Oracle and probably handed to me in one of the old Oracle SQL 7 training classes.
    Does anyone know if something like this exists for Oracle 11 G.

    So far I found only scripts under $OH/rdbms/demo, but I do not know what scripts to run, or in what order.

    Thanks in advance for your help.

    JI Li

    According to the doc 11 g
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28328/scripts.htm
    "You need to install the basic examples of Oracle data from media to fill the directories with the example of schema scripts"
    Examples of database Oracle is the new name of companion.
    You can download it from http://download.oracle.com then choose your platform, then click "Show all", you will see Oracle Database 11 g examples (formerly companion)

    Nicolas.

  • Update SQL script

    Hi friends,

    I started this thread yesterday, but for some reason that I'm not able to answer/continue on this old thread. Here are the details from the old thread

    I need help with a sql script to update sid_no_new column with values based on sid_no for about 6000 + records.

    Here is an example below...

    SQL > select * from test1;

    SID_NO SID_NO_NEW UNIT_NO

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

    2000                                                          unit1

    2000                                                          unit3

    2000                                                          unit4

    2002                                                          unit16

    4500                                                          unit22

    In the example above, there are 3 sid_no consecutive '2000'. Sid_no_new must be 2000_1, 2000_2, 2000_3, respectively.

    It should be like:

    SQL > select * from test1;

    SID_NO SID_NO_NEW UNIT_NO

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

    2000 2000_1 unit1

    2000 2000_2 unit3

    unit4 2000_3 2000

    2002 2002 unit16

    4500 4500 unit22

    I ran the script (thanks to the experts who have contributed to) below, it works very well for the above documents, but I get ORA-30926 error when I run on the table with 6000 records...

    Fusion IN test1 tgt USING

    (SELECT sid_no,

    sid_no_new,

    unit_no,

    Count (sid_no) over (partition BY sid_no) cnt,

    ROW_NUMBER() over (partition BY order of sid_no to unit_no) rn

    OF test1

    ) CBC ON(tgt.sid_no=src.sid_no AND tgt.unit_no=src.unit_no)

    WHEN matched THEN

    UPDATE SET Sid_no_new = CASE WHEN cnt > 1 THEN sid_no |' _'. RN ELSE sid_no END;

    ERROR on line 1:

    ORA-30926: failed to get a stable set of rows in the source tables

    Please give your suggestions... Thank you very much

    In fact, this could be done easier:

    SQL > select *.

    test1 2

    3.

    SID_ SID_NO UNIT_N

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

    2000 2000_1 unit1

    2000 2000_2 unit3

    unit4 2000_3 2000

    2002 2002 unit16

    4500 4500 unit22

    SQL > select *.

    2 of test4

    3.

    UID_NO TYP RULE_DUE

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

    RAF 2000 90

    3140 TH 100

    6712 JUL 21

    233 12 H6

    SQL > fusion

    2 in d of test4

    3 use)

    4 with as t4)

    5. Select uid_no,

    6                               type,

    7                               rule_due,

    8 rowid RID,

      9                               uid_no || '_' || ROW_NUMBER() over (partition by uid_no by 1 order) sid_no_new

    10 of test4

    11                      )

    12. Select t1.sid_no_new,

    T4.type 13,

    T4.rule_due 14,

    15 cases

    16 when t1.sid_no = t1.sid_no_new then t4.rid

    17 when t4.sid_no_new = t1.sid_no_new then t4.rid

    18 end rid

    19 of t4,

    Test1 20 t1

    21 where t1.sid_no = t4.uid_no

    22          ) s

    23 on)

    24 d.rowid = s.rid

    25       )

    26 when matched

    27 then

    Update 28

    29 set d.uid_no = s.sid_no_new

    30 when no match

    31 then

    32 insert

    33 values)

    s.sid_no_new 34,

    s.type 35,

    36 s.rule_due

    37                )

    38.

    3 lines merged.

    SQL > select *.

    2 of test4

    3.

    UID_NO TYP RULE_DUE

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

    2000_1 RAF 90

    3140 TH 100

    6712 JUL 21

    233 12 H6

    2000_3 RAF 90

    2000_2 RAF 90

    6 selected lines.

    SQL >

    SY.

  • Call of from.mxl under linux .sql script file

    Hello Experts,

    I have a requirement to call the sql script in the maxl file in the linux server. I get EOF file error.

    Could you please say how to achieve this requirement.

    MAXL Script:

    Reel to ' / / essbase02//MaxL//Test_MR.log ';

    the value of message level.

    Set timestamp

    echo 'start logging ';

    login "admin", "password" on 'server '.

    echo "beginning of sh execution."

    MSH ' / / essbase02//MaxL//Test_MR.sh';

    / * Create label * /.

    echo "Completed";

    disconnection;

    spool off;

    Contents of the Test_MR.sh file:

    sqlplus-s user@orcl/password @"' / / essbase02//MaxL//TEST.sql '"


    Journal for the maxl:

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    'Start of logging.

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > login "admin" "admin" on "server1.hq.emirates.com";

    OK/INFO - 1051034 - [admin@Native Directory] user connection.

    OK/INFO - 1241001 - connected to Essbase.

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    "Beginning of HS performance."

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > sqlplus-s user@orcl/password @ "/ essbase02/MaxL/TEST." SQL ".

    2 >

    3 >

    4 >

    essmsh error: end of file breaks the statement

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    "Completed".

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    MAXL > disconnect;

    The user admin is offline

    essmsh timestamp: Wed Aug 5 23:17:35 2015

    Thank you

    RM

    If you want to execute operating system commands you use Shell, not "msh". MSH is to call an additional MaxL script with MaxL orders only.

    Optionally, there should be no need to store the command shell in a separate file, that is, it should be possible to place the command sqlplus directly inside the MaxL script when you use the Shell.

Maybe you are looking for