dbms_metadata for 381 triggers

I try to extract 381 triggers in a file that I can then run to re-create triggers later.
But when I run the result of the file I receive by underneath, they compile the triggers.
The script below does not place a "/" at the end of eacj SQl statement.
She does at the end of the DDL...
END zedw_trg_adr6;
ALTER TRIGGER 'SAPSR3 '. "' ZEDW_TRG_ADR6 ' ACTIVATE
Instead of...
END zedw_trg_adr6;
/
ALTER TRIGGER 'SAPSR3 '. "' ZEDW_TRG_ADR6 ' ACTIVATE
/


How can I fix the commands below?




I use this to the DDL trigger creat ethe file to run later.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sqlplus "/ as sysdba".

SET LONGCHUNKSIZE 1024
LONG VALUE 128000
SET ECHO OFF
SET THE POSITION
SET LINESIZE 512
SET TRIMOUT ON
SET TRIMSPOOL ON
PACKAGING OF THE SET


coil c:\temp\triggers_extract.sql

Select dbms_metadata. GET_DDL (u.object_type, u.object_name, 'SAPSR3')
u dba_objects
where type_objet = 'TRIGGER '.
and the owner = "SAPSR3";

spool off;

output

VI triggers_extract.sql
-Remove items ' SQL > ' lines from the top & bottom of the script.
: wq!

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi Bill,

Try to play a bit with this:

dbms_metadata.set_transform_param (dbms_metadata.session_transform, 'SQLTERMINATOR', true);

Edit:
In addition, you will need to either put all your SQL * more commands in a script, then run it only after the connection.
Alternatively, leave termout.

Both should remove the need to change it later.

Concerning
Peter

Published by: Peter on December 6, 2011 15:13

Tags: Database

Similar Questions

  • using dbms_metadata for the ddl to create directories

    Hello
    I'm working on creating a test database, which is a copy of production for 11g upgrade test. I want to get all my production database DDL to create all the directories in the new test database. I tried using dbms_metadata for it-
    Here is the code I tried to use. However, when I query the my_metadata table, nothing in there. Can someone help me with this please?

    DROP TABLE my_metadata;
    CREATE TABLE my_metadata (md CLOB);

    CREATE OR REPLACE PROCEDURE progp1_directories_extract
    AS
    hndl NUMBER; -dbms_metadata handle
    e NUMBER; -transform handle
    CLOB DDL; -Individual CLOB from the database
    BEGIN
    hndl: = DBMS_METADATA. OPEN ("DATABASE_EXPORT"); -Open the metadata
    DBMS_METADATA.set_Filter (hndl, 'INCLUDE_PATH_EXPR', ' = "DIRECTORY" "); -Filter the data according to the case
    th: = DBMS_METADATA.add_transform (hndl, 'DDL'); -Get the Handle of the transformation
    DBMS_METADATA.SET_TRANSFORM_PARAM (th, 'SQLTERMINATOR', TRUE); -Include the semicolon

    LOOP
    DDL: = DBMS_METADATA.fetch_clob (hndl); -Loop through the result set, inserting in our temporary table
    DDL OUTPUT IS NULL;

    INSERT INTO my_metadata
    (md)
    VALUES (DDL);
    COMMIT;
    END LOOP;
    DBMS_METADATA. CLOSE (hndl);
    EXCEPTION
    WHILE OTHERS
    THEN
    NULL;
    END;
    /
    display errors

    Hello

    You can get the DDL for the directory running sql in the source database.

    Select 'create directory' | OWNER: '. ' || DIRECTORY_NAME |' like ' | " ' || DIRECTORY_PATH | " ' || ';' in dba_directories;

    Concerning

  • Equivalents of the ADF for forms triggers

    Hello
    I want to know the equivalents of the ADF for the triggers of following forms-

    A TIME NEW FORM INSTANCE
    PREFORM
    WHEN CLOSING WINDOW

    and a few other triggers as well.

    I found some of them below - document
    http://www.Oracle.com/technology/products/jdev/tips/Muench/formstriggers/index.html#revhistory

    Y at - it a complete list of the equivalent paper? Can someone help me please in this...

    Thank you
    Elodie

    Hello

    Here is a list of triggers

    http://download.Oracle.com/docs/CD/E15523_01/Web.1111/b31974/appendix_formstriggers.htm#sm0347

    A TIME NEW FORM INSTANCE
    PREFORM
    WHEN CLOSING WINDOW

    The web does not pe-form since unlike forms, is not build out of fmb (aka shape) records. Because the application works according to a CIU, who is the widow of the browser, there is no trigger of cose winow. You have options to detect navigation (given that you deal with editing a page or a fragment of a page like a window), you can do using phase listeners JSF.

    Frank

  • Can you change text of reversal in the same range for different triggers?

    Hi, I have not used Fireworks since version 3, which was about 6 years ago when I dabbled in web development.  My past has turn against me, and I need to make a pretty simple site quickly enough for my boss.  I myself have CS4, and now that I understand that you can only use the buttons for disjoint bearings, I begin to make progress...

    What I want to achieve, is that there are 6 "buttons" on my page, which, when they you flipping them will display the text in a box on the side.  I would use separate boxes for each button, but there is not enough space on the page, because there is a lot of text, so I would use a box at the same place to display all 6 texts, according to which the button is reversed.  Is this possible?

    I have no doubt entirely my head layers round and this may be very simple, but could someone please point me in the right direction, even if it is a link to the right drill bit using the product?

    Because the reversal disjoint button does not work, I created 6 slices for triggers.  I first tried the hot spots, but could not use them as I want as a direct substitution trigger the filter effect.

    Yes, you can trigger the different content on the postponement of several other sections.

    It is easier to show the describe statement, so here is a sample file that does what I think you are looking for:

    (1) six buttons

    (2) each button a unique text

    (3) each button corresponds to a rollover State

    (4) single text appears in the same place for each button on turnover

    I hope this helps!

    Dave

    Right-click and save the image below - it's a Fireworks source file:

  • using dbms_metadata for retrieve data type name and the parameter of a procedure

    Hi guru,.

    is there a subprogramme in dbms_metadata which will extract that ideally the specifications of a procedure/function call

    If the my program spec is proc1 (id1 number, CRC in varchar2, id2 number)

    If I call something like

    Select * from table (dbms_metadata. < subprogramme > ("proc2"));

    It gives me

    Id1 number

    CRC in varchar2

    Id2 number

    ideas/pointers?

    Why do you need to do this?

    See S/n/ALL/$user_arguments.

  • Run for the triggered alarm settings

    Hello.

    I set an alarm to call a script whenever a virtual computer is vMotioned with the following code:

    My $alarmScript = "C:\event-reporter.bat";

    my =::get_service_content()-> alarmManager Vim $alarmMgr;

    my $alarm = Vim::get_view (mo_ref = > $alarmMgr);

    My $alarmExpr = EventAlarmExpression-> new (eventType = > 'VmMigratedEvent');

    My $alarmAction = RunScriptAction-> new)

    script = > $alarmScript

    );

    My $alarmTrigger = AlarmTriggeringAction-> new)

    action = > $alarmAction,

    red2yellow = > 1,

    green2yellow = > 1,

    yellow2red = > 1,

    yellow2green = > 1

    );

    My $alarmSpec = AlarmSpec-> new)

    name = > 'VM vMotioned. "

    Description = > "Trigger to run the VM startup script."

    activated = > 1,

    expression = > $alarmExpr,

    action = > $alarmTrigger,

    );

    My $newAlarm = $alarm-> CreateAlarm (entity = > $vm, spec = > $alarmSpec);

    I would like to improve this alarm from the run settings to the script during the VM migration, more specifically the IP address to the accommodation ESX host recently migrated VM. I know that using the ActionParameter constants, you can spend TIME info, but I don't know if it is possible to pass information of the object (VM), the alarm is associated.

    Thank you.

    Juan Aristizabal.

    The "ActionParameter" provides only a set of constants whose value is replaced by the processor of the action with the performance values. You will not be able to pass a custom constant whose value can be substituted for the IP Address of the host (in your case).

  • Using dbms_metadata for defination of large table

    Hello

    I have table definition table very large with partitions and partition under and I want to create this table in some other db.
    I have tried under request queued, but its definition to complete recovery of the table, other settings that I should follow

    coil t.sql
    set pagesize 0
    the 2000000 long value
    Select dbms_metadata.get_ddl

    I use oracle 10g r2

    Thank you
    Pankaj

    Mr. Paul wrote:

    Set longchunksize 2000000
    the 2000000 long value
    fixed lines 2000
    set pages 0

    Exaggerated!

    I decided to be generous this year!

    Happy new year, Nicolas.

    Best wishes to you, Paulo,

    Nicolas.

  • How the DDL triggers AFTER CHANGE of work?

    I thought that this general framework for DDL triggers AFTER WHAT ALTER has been like that:

    -Implicit VALIDATION before the DDL statement (here: ALTER TABLE)

    -DDL statement

    -Implicit VALIDATION after DDL statement (here: ALTER TABLE)

    -AFTER ALTER DDL trigger fires

    And I also thought that everything is inside that trigger would be 'new' code as introduced by the ALTER TABLE DDL. But it looks like I'm missing something about this situation because the trigger next dbms_metadata.get_ddl procedure and seeing 'old' DDL code (before the ALTER TABLE statement).

    What Miss me? Could you give me some advice about this behavior? If I shouldn't expect returned DDL 'current' so why should I not?

    Thank you

    / * everything is done in the SCOTT schema * /.

    create table y (col1 varchar2 (5));

    create table t (dt date default sysdate, d varchar2 (4000));

    create or replace trigger trg

    After ON ALTER scott. SCHEMA

    declare

    v_d varchar2 (4000);

    Start

    Select cast (dbms_metadata.get_ddl ('TABLE', sys.dictionary_obj_name, sys.dictionary_obj_owner) as varchar2 (4000))

    in v_d

    Double;

    insert into t (d) values (v_d);

    end;

    ALTER table add col2 int;

    Select * from t; -This is the 'old' DOF with only col1

    I understand the transaction consistent reading, and it would work if second implicit validation had not been published before a trigger has been activated... the question is: is this second implicit validation has published in the above situation or I'm wrong about this, and commit the transaction started by first implicit included relaxation itself, and after he performed the second commit implicit came into play...

    It looks like this for me, but I have not found anything in the doc Oracle stating explicitly that this is the case... Could you confirm?

    Hmmm - I found it in the section client events of the doc PL/SQL language

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/triggers.htm#g1722272

    The LOGON event starts a separate transaction and undertakes after firing the triggers. All the other events fire in the existing user transaction.

    Is the same with the AFTER DDL event where you thought to try this one.

    Why do you need the DOF immediately after it happens?

    Just capture the same and information of interest to a table. Then, later, asynchronously, run a job to get the DDL or everything that you need. The only "gotcha" If several ddl statements are issued against the table and you needed every one of them for some reason any. Not sure why you would need for each change.

  • Sequence of triggers

    UseCase:

    I have some different triggers working on the same status. And I need a specified sequence operation triggers.

    Is it possible to define the sequence?
    The "SeqNr' triggers to influence the sequence of triggers to work on the same status?

    We must differ between incoming and outgoing of triggers.

    On arrival:

    If a valid message is sent to ServiceGrid, and the message is well authenticated systems trying to find the trigger message corresponds to the message received.
    First of all the only way to identify the trigger is the sender. Thus, the system searches all shippers to find appropriate communication.
    If only one communication is the situation is easy and the affected trigger is processed.

    If more than one communication is that the system begins to process the communications models until a ticket can be found.
    If this is the case of stopping the treatment and mentioned relaxation is processed. So always only a single incoming trigger is activated when a message is received.
    The sequence of the treatment of the models is not predictable.
    So its always a good idea to have different valid senders for different purposes. This is why the sequence number is not editable for incoming triggers.

    Outbound:

    It is generally possible over a trigger out with a single event. Outgoing triggers are processed in the order of their sequence number.

    If a trigger has several communications, they are processed in the order of their ID beginning with the lowest.
    If you checked the box 'Manual Selection' the sequence number is used to display the triggers in the order of the Seq.No interface...
    If the checkbox "IsTopRule", it says outgoing trigger is activated first.
    If there is more than a trigger marked as 'IsTopRule', they are processed in the order of their identity.

  • Published in dbms_metadata.set_transform_param, SQLTERMINATOR property

    Hello

    I use the dbms_metadata for the DDL for all objects in a particular schema.

    DDL is recovered without any problem, but the SQLTERMINATOR is not added at the end of any DDL.

    The property is used is

    dmsf: = dbms_metadata.session_transform;

    DBMS_METADATA.SET_TRANSFORM_PARAM (dmsf, 'SQLTERMINATOR', TRUE);

    Please let me know on what I should change to solve this problem.

    This is all the code that I use.

    CREATE OR REPLACE TYPE ddl_ty AS OBJECT  
    (  
      object_name VARCHAR2(30),  
      object_type VARCHAR2(30),  
      orig_schema VARCHAR2(30),  
      orig_ddl    CLOB  
    )  
    /  
    CREATE OR REPLACE TYPE ddl_ty_tb AS TABLE OF ddl_ty  
    /  
      
    CREATE OR REPLACE FUNCTION get_object_ddl(input_values SYS_REFCURSOR)  
      RETURN ddl_ty_tb  
      PIPELINED IS  
      
      PRAGMA AUTONOMOUS_TRANSACTION;  
      
      -- variables to be passed in by sys_refcursor */  
      object_name VARCHAR2(30);  
      object_type VARCHAR2(30);  
      orig_schema VARCHAR2(30);  
      
      -- setup output record of TYPE tableddl_ty  
      out_rec ddl_ty := ddl_ty(NULL, NULL, NULL, NULL);  
      
      /* setup handles to be used for setup and fetching metadata information handles are used  
      to keep track of the different objects (DDL) we will be referencing in the PL/SQL code */  
      hopenorig   NUMBER;  
      hmodifyorig NUMBER;  
      htransddl   NUMBER;  
      dmsf        PLS_INTEGER;  
      
      /*  
      CLOBs to hold DDL  
      */  
      orig_ddl CLOB;  
    BEGIN  
      /* Strip off Attributes not concerned with in DDL. If you are concerned with  
      TABLESPACE, STORAGE, or SEGMENT information just comment out these few lines. */  
      dmsf := dbms_metadata.session_transform;  
      dbms_metadata.set_transform_param(dmsf, 'SQLTERMINATOR', TRUE);  
      dbms_metadata.set_transform_param(dmsf, 'TABLESPACE', FALSE);  
      dbms_metadata.set_transform_param(dmsf, 'PRETTY', TRUE);  
      dbms_metadata.set_transform_param(dmsf, 'STORAGE', FALSE);  
    -- dbms_metadata.set_transform_param(dmsf, 'SEGMENT_ATTRIBUTES', FALSE);  
      
      -- Loop through each of the rows passed in by the reference cursor  
      LOOP  
        /* Fetch the input cursor into PL/SQL variables */  
        FETCH input_values  
          INTO object_name, orig_schema, object_type;  
        EXIT WHEN input_values%NOTFOUND;  
      
        hopenorig := dbms_metadata.open(object_type);  
        dbms_metadata.set_filter(hopenorig, 'NAME', object_name);  
        dbms_metadata.set_filter(hopenorig, 'SCHEMA', orig_schema);  
      
        /* Modify the transformation to remove "orig_schema" reference*/  
        hmodifyorig := dbms_metadata.add_transform(hopenorig, 'MODIFY');  
        dbms_metadata.set_remap_param(hmodifyorig,  
                                      'REMAP_SCHEMA',  
                                      orig_schema,  
                                      NULL);  
        -- This states to created DDL instead of XML to be compared  
        htransddl := dbms_metadata.add_transform(hopenorig, 'DDL');  
      
        -- Get the DDD and store into the CLOB PL/SQL variables  
        orig_ddl := dbms_metadata.fetch_clob(hopenorig);  
      
        out_rec.object_name := object_name;  
        out_rec.object_type := object_type;  
        out_rec.orig_schema := orig_schema;  
        out_rec.orig_ddl    := orig_ddl;  
        PIPE ROW(out_rec);  
      
        -- Cleanup and release the handles  
        dbms_metadata.close(hopenorig);  
      
      END LOOP;  
      RETURN;  
    END get_object_ddl;  
      
    /  
      
    SELECT *  
      FROM TABLE(get_object_ddl(CURSOR (SELECT object_name, owner, object_type  
                                   FROM dba_objects  
                                  WHERE owner = 'ALERTSASIA'  
                                        AND object_type IN  
                                        ('PACKAGE'))));  
    
    

    Hello

    I think that dbms_metadata.session_transform is for GET_DDL, GET_DEPENDENT_DDL and GET_GRANTED_DDL functions.

    You must use set_transform_param on the htransddl handle. Add after line 65:

          dbms_metadata.set_transform_param (htransddl, 'PRETTY', true);
          dbms_metadata.set_transform_param (htransddl, 'SQLTERMINATOR', true);
    

    Other attributes transform as TABLESPACE and STORAGE should also be applied to htransddl to remove the 40-45 lines.

    You must also add a logic when you define this transform settings such as STORAGE and TABLESPACE for example cannot be applied to the PACKAGE object type.

    Kind regards

    Mitja

  • In a widget of Composition can triggers dynamically reposition in what concerns the different sizes of image of hero?

    I'm working on a design where using Composition widget is best suited to my needs for customization. My plan is to position the trigger under the goal of hero image thumbnail. As each trigger is selected, a different hero image appears as it should. However, each of my hero images vary in vertical height. If I post the triggers, say, 50px below #1 and #2 image image is much larger, #2 image overlaps the triggers. Not good.

    Is it possible in this widget for do triggers dynamically reposition (force push) depending on the size of image of hero, now a uniform fill between?

    Or is this only possible by giving each project it's own, renouncing a widget in total and by treating the thumbnails just as page links?

    (Visuals provided here):

    Thanks for any advice you can share,

    Steve

    version1.pngversion2.png

    You will need to use nested widgets, even if this often made quite a mess of using triggers remote because of the conflicting functions of widget.

    Mylenium

  • How to open a different window for separate codes pl/sql?


    Hello

    In my form, I have many controls. When I open the pl/sql code for all trigger of any control, it opens in the same window that was previously containing pl/sql of some other trigger codes.
    I want to open a separate window for each trigger handled in my form.
    How is that possible?

    Database: 10g
    OS: Windows XP Virtual machine 32 bits
    Forms version: 10g

    Thank you.

    You can open as many windows as you want.

    Hold down the SHIFT key, and then click twice on the unit to trigger or program you want to open, reapeat for several triggers/program units that you want to open.

    Make sure that you do not have the Publisher pl/sql window/s maximized if yes, you will see 1 pl/sql editor open at the same time.

  • Purpose of the triggered alarm

    Hello

    I am trying to create a script that sends an email with all the daily alarms from VMware.  I did everything, but the part that identifies the object that is actually in a State of alarm.  I use the code below I've seen in other similar questions, but I can't find anything in the SDK that will produce this object.  I can get it only to point to the object where it is actually defined.  Am I missing a property which will produce who or what I have to drill down to each object in the inventory and check for alarms triggered?

    $vcenter = "vcntr01".

    SE connect-VIServer $vcenter

    $datacenters = (get-data center * | get-View)

    {foreach ($datacenter to $datacenters)

    foreach ($triggered in $datacenter. TriggeredAlarmState) {}

    $alarmDef is get-view-Id $triggered. Alarm

    Write-Host "$((get-vue_$alarmDef.Info.entity).name) $($alarmDef.Info.Name).

    }

    }

    Thank you!

    Try like this

    Get-Datacenter | where {$_.ExtensionData.triggeredAlarmState} | %{  $_.ExtensionData.triggeredAlarmState |  Select Time,    @{N="Entity";E={Get-View $_.Entity | Select -ExpandProperty Name}},    @{N="Alarm";E={Get-View $_.Alarm | Select -ExpandProperty Info | Select -ExpandProperty Name}}}
    
  • How to display the ddl for a view

    In oracle 11g how can I write a query which will display a view initial create MATERIALIZED view?

    I know that you can click on the SQL tab in sql developer, but how can I do the same thing with a query?

    Hello

    996454 wrote:

    In oracle 11g how can I write a query which will display a view initial create MATERIALIZED view?

    I know that you can click on the SQL tab in sql developer, but how can I do the same thing with a query?

    Yes, the code is in the data dictionary:

    -In SQL * Plus, do this first:

    VALUE LONG 8000

    SELECT text

    From user_views

    WHERE view_name = 'MY_VIEW '.

    ;

    You can also use dbms_metadata for getting this.

    What do you mean by "seen statemnt to create initial display ?  If you create a view and then do a CREATE or REPLACE VIEW statement, then the initial definition is lost. only the most recent is kept in user_views.

  • How to stop lower level triggers of shooting?

    I have triggers INSERT pre defined block-level both the shape and the data. I have the properties for the triggers defined for the form-level trigger fires first. Under certain conditions, I want to insert not met and for the block-level trigger will not run. (Basically, I want to erase the form and roll back database changes.) Y at - it a command or set of commands that I can use to prevent this? I tried used the trick of the TIMER, but WHEN-TIMER-EXPIRES trigger after INSERT trigger block level prerequisite.

    Thank you
    John

    Wait! I've never coded anything in a trigger we Commit! If you read the online help for the trigger validation, it is said:

    .. .this operation occurs after all records that have been marked as insertions, updates, and deletions have been posted on the database.

    If I understand it, you should do the check until your form delivers a Commit_Form; command. Therefore, you should do in the validation key trigger, or in a process called validation key and before you issue a command to Commit_Form.

    I hope that I did not write something that led you in using the trigger on validation.

Maybe you are looking for