avoid triggers on all tables in the schema

I need to put a CREATION TIMESTAMP to the timestamp of the database server (not the timestamp of session) in all tables in a schema to create and update. Is to create a trigger on all the tables in the schema a less time consuming way to do?

Similarly, I need to set up columns such as CREATE_USER, LAST_UPDATE_USER.

Thank you in advance.

You can easily generate the DDL for adding new columns.

The extent of the filling of the columns, your choice is either to use insertion befire table and triggers to update to fill the columns or the application to provide the necessary information.

Basic trigger logic would be pretty much the same for all tables, then write a little SQL or PL/SQL to generate the code of the trigger should be simple enough.

Depending on your application, such as web based with only one Oracle user, you may need to get the real user through dbms_application_info by the logic of the server-based application.

HTH - Mark D Powell.

Edited by: Mark D Powell 5 May 2010 07:48

Tags: Database

Similar Questions

  • How to delete all TABLEs in the schema SYS that are created from 09:15?

    Unfortunately a script created a lot of tables in the diagram (= SYS) and bad Tablespace (= SYSTEM).

    How can I delete all TABLES that are created inTablespace = SYSTEM and SCHEMA = SYS (in a DDL command)
    respectively for the past 3 hours from 09:15 to 25 Sep 2011?

    Alternative: How can I move these tables in another schema (for example ATEST) and Tablespace (USERS)?
    Is this possible with Oracle XE or Oracle Enterprise?

    Peter

    You can use ALTER TABLE... MOVE. It offers a TABLESPACE clause, which allows you to choose a different tablespace as target. Refer to the documentation for your version of the database.

  • Get the DDL for all tables in a schema;

    Hello

    I tried to get the DDL for all tables under my own diagram "A". Here are the steps I've tried, but in vain I
     1. logged in as a user A 
    2. And the ran query 
              
    SELECT DBMS_METADATA.get_ddl ('TABLE', 'XYZ')
    FROM user_tables
          
    o/p
    (HugecloB)
    
    {code}
    
    Any idea how i can get the DDL for all the tables under my own schema ?
    
    
    Thank you so much!
    
    Edited by: user642297 on Feb 4, 2011 12:05 PM
    
    Edited by: user642297 on Feb 4, 2011 12:05 PM
    
    Edited by: user642297 on Feb 4, 2011 12:05 PM
    
    Edited by: user642297 on Feb 4, 2011 12:07 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Your idea is good, you missed only to use the correct table name:

    SELECT DBMS_METADATA.get_ddl ('TABLE', table_name)
    FROM user_tables;
    

    Concerning

  • Select all the tables in the schema

    Hi, I'm looking for x, y of the tables in a schema, get the error "missing expression," working with oracle 11g.


    declare

    v_sql varchar2 (4000);
    number of v_x;
    number of v_y;
    number of V_n;

    Start

    for rec in loop (select table_name as table_name from all_tables where table_name like '% oumou %' ORDER BY 1)


    v_sql: = ' select a.idnumber, t.x, t.y, table (sdo_util.getvertices (a.geometry)) t OF ' | Rec.table_name | « a » ;
    V_sql EXECUTE IMMEDIATE v_n, v_x, v_y;
    dbms_output.put_line(V_n|| v_x || v_y);


    end loop;


    end;
    ...
      --only for fetching implizit CURSOR cur1
      CURSOR t2 IS SELECT CAST('' AS VARCHAR2(20))idnumber, CAST(0 AS NUMBER) x, CAST(0 AS NUMBER) y FROM dual;
      rec2   t2%ROWTYPE;
    ...
    

    To the implicit CURSOR cur1, you can set a variable-FETCH with CUR1% ROWTYPE.
    So, I defined an explicit CURSOR t2, bringing me the types for the columns of results:
    IDNUMBER (VARCHAR2 (20)), X (NUMBER) and Y (NUMBER)
    This T2 of cursor, I can set a % ROWTYPE VARIABLE t2 to fetch the results.

    Please give points for the solution.

  • get information from inside a trigger of the other tables in the schema even

    Addendum:

    ... Sorry I forgot: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64 bit

    *******************

    Hello

    I'm trying for a few hours to get information from inside a trigger to another table in the same pattern.

    My trigger is PSE_BKB. NUM_PHANTOM_BP

    I first tried a simple solution...


    CREATE OR REPLACE TRIGGER PSE_BKB. NUM_TR_PHANTOM_BP
    BEFORE DELETING, INSERTION OR UPDATE
    ON PSE_BKB. NUM_PHANTOM_BP
    REFERRING AGAIN AS NINE OLD AND OLD
    FOR EACH LINE
    DECLARE

    v_recht NUMBER (1): = 0;
    v_recht2 NUMBER (1): = 0;
    v_change_mitarbeiter NUMBER (1): = 0;
    v_recht_mitarbeiter NUMBER (1): = 0;
    v_typ varchar2 (20);
    v_obj_key varchar2 (11): = "gugus";
    v_ph_key varchar2 (11);
    -ph_key varchar2 (11);
    v_obj_keys varchar2 (4000): = ', ';

    anz_num NUMBER: = 0;
    anz_num_tmp NUMBER: = 0;
    anz_st_si NUMBER: = 0;


    BEGIN

    ...
    Select count (*)
    in anz_num
    of pse_bkb.num_objekt o
    where o.obj_key in
    (select distinct (ov.obj_key)
    of pse_bkb.num_objekt_verb ov
    where ov.phantom_key =: old.phantom_key
    )
    and o.typ = "NUM";

    ...

    Explanation: my trigger table is PSE_BKB. NUM_PHANTOM_BP.

    On the pse_bkb.num_objekt_verb of the table, I have a relationship 1: n to one or several object-key (field named obj_key!) on my referenced key: old.phantom_key. With this obj_key, I want to watch the weather, I have one or more lines in the table type num_objekt "NUM". So the internal selection gives me all the num_objekt_verb obj_key with my: old.phantom_key and with whom I count the number of lines I have on num_objekt with type "NUM".

    The problem is that the trigger does not see the table.

    I tried many variations.

    The latest version I tried was with a cursor inside the trigger definition as in the block of code below.

    For debugging purposes, I inserted a RAISE_APPLICATION_ERROR in the inner loop - see below. The v_obj_key variable is never defined, as in all the other variations, I tried-, I still see the predefined "gugus" in the declare section.

    It seems that oracle can not read other tables at this point. La: old.phantom_key is defined (in this simple example there would come a return obj_key).

    Thanks in advance for your help - and excuse my English.

    Trigger code:

    CREATE OR REPLACE TRIGGER PSE_BKB. NUM_TR_PHANTOM_BP
    BEFORE DELETING, INSERTION OR UPDATE
    ON PSE_BKB. NUM_PHANTOM_BP
    REFERRING AGAIN AS NINE OLD AND OLD
    FOR EACH LINE
    DECLARE

    v_recht NUMBER (1): = 0;
    v_recht2 NUMBER (1): = 0;
    v_change_mitarbeiter NUMBER (1): = 0;
    v_recht_mitarbeiter NUMBER (1): = 0;
    v_typ varchar2 (20);
    v_obj_key varchar2 (11): = "gugus";
    v_ph_key varchar2 (11);
    -ph_key varchar2 (11);
    v_obj_keys varchar2 (4000): = ', ';

    anz_num NUMBER: = 0;
    anz_num_tmp NUMBER: = 0;
    anz_st_si NUMBER: = 0;


    BEGIN


    Start
    declare

    cursor nums is

    Select obj_key
    of PSE_BKB.num_objekt_verb
    where phantom_key =: old.phantom_key;

    Start

    for the RC looping nums
    v_obj_key: = cr.obj_key;

    RAISE_APPLICATION_ERROR (-20099,' AGAIN 9 v_obj_key: ' | v_obj_key |) ': old.phantom_key ' | (: old.phantom_key);

    When the exit nums % NOTFOUND;

    Select count (*) in the pse_bkb.num_objekt anz_num_tmp where obj_key = v_obj_key and type = "NUM";
    anz_num: = anz_num + anz_num_tmp;
    end loop;

    end;
    end;

    Published by: user832075 on 14.01.2013 06:18

    The reason why you get count_n = 0 in tr_c is that there is no line in B with key_c = 17, to the moment you arrive at tr_c. The removal of B has already occurred, and since you're in a single transaction, the application for tr_c:

    select count(*)
      into   counter_n
      from   a aa
      where  aa.key_a in (select distinct(bb.key_a)
                          from   b bb
                          where  bb.key_c = v_ph_key
                         )
      and    aa.typ = 'n';
    

    'knows' that the row has been deleted then gets a number of 0.

    I added a set of instructions dbms_output to show the order in which triggers run, and that's what I get:

    SQL> delete from b_vw where key_a = 1 and key_c = 17 ;
    in trigger b_tr_vw
    In tr_b
    in tr_c
    delete from b_vw where key_a = 1 and key_c = 17
                *
    ERROR at line 1:
    ORA-20077: Remark: counter_n: 0 counter_s: 0 v_ph_key: 17 old.key_c: 17
    new.key_c:
    ORA-06512: at "OPS$ORACLE.TR_C", line 38
    ORA-04088: error during execution of trigger 'OPS$ORACLE.TR_C'
    ORA-06512: at "OPS$ORACLE.B_TR_VW", line 17
    ORA-04088: error during execution of trigger 'OPS$ORACLE.B_TR_VW'
    

    Thus b_tr_vw trigger is triggered first and deletes a B. trigger fires tr_b as part of this statement to remove and check against A, happening apparently so no error is triggered and succeeds the removal of B. Now tr_b_vw takes back control and deletes C. Since the B line which has key_c = 17 already deleted a control for counter_n > 0 and counter_s = 0 fails and raise you the-20002 error. Note that I'm assuming that the error of-20077 you lift is just to see the values and is not intended to be part of your actual code.

    Because I have really no idea what you're trying to accomplish here I can't offer a lot of advice that you might want to try entering two tr_c of the tr_b_vw trigger validation queries before deliver you the removal of b and put the counter_n > 0 and counter_s = 0 control under tr_b_vw to decide whether or not you want to remove.

    John

  • Creating table in the schema has with the user B and granting permissions to the user C

    Hello, I have a problem fun - we have a large table which requires a batch to make millions of updates, and he needs to finish more quickly. It takes several hours as an update, but a select create table did the same thing in about a minute. Yay! Then we just delete the old table and rename the new table to the former, rebuild all the index and grant select/insert/update/delete permissions to another user who needs access... and there is the problem, Oracle said insufficient privs.

    We have A figure, which is the owner of the table, userid B who done all the stuff of application batch and userid C which performs inserts for a process of middleware. None of them are actual users, of course. We want that user B to do the ETG, rename, rebuild and re-grant of the authorisation of the index. But user B apparently cannot grant permissions on objects in the schema A to user C, even if B has created the table and has the role DBA (not ideal, I know)!

    What's really crazy is that there is no sense unique user b can grant permissions to user C, which is to:

    grant select any table USER c;
    grant insert any table USER c;
    grant update any table USER c;
    Grant delete any table USER c;

    It seems really perverse can create tables in diagram A and even grant C privs "whole table" that user B, but may not grant privs specifically on this object in the schema A, even with DBA privs. I must be missing something... right?

    Yes. By default, the stored procedures are stored procedures from DEFINER rights. If A is the owner of a stored procedure, this stored procedure can do whatever A enjoys the privileges to directly. If A grants B privileges RUN this stored procedure, when B calls the stored procedure, the procedure runs with the privileges.

    I agree point stew, however, re-creating objects in Oracle is generally a bad idea and a TRUNCATE with one insert direct-path, possibly combined with the deactivation and the rebuilding of the index would be more appropriate than a DEC. If you're going to stick with this Assignment, however, that really do in a stored procedure owned by A while B has no need to CREATE ANY TABLE.

    Justin

  • DataPump - expdp.open creates tables in the schema

    Hello

    I use datapump in Oracle 10 g to archive old main schema to another schema partitions.

    I noticed that when dbms_datapump.open is called and a new table is created by dbms_datadpump for internal purposes. This is verified in the oracle documentation

    http://docs.Oracle.com/CD/B12037_01/AppDev.101/b10802/d_datpmp.htm#997383

    Notes on use

    • When the task is created, a master table is created for work under the scheme of the appellant in the default tablespace of the appellant. A handful referring to employment is returned that attaches to the current session to use. Once attached, the handle remains valid until that either explicit or implicit detach occurs. The handle is only valid in the session of the appellant. Other handles can be attached to the same task from another session using the ATTACH procedure.

    Does anyone know if this table can be removed by a call to dbms_datapump Oracle 'clean', or if it has to be cleaned manually.

    can confirm that this is what you do

    v_job_handle: = DBMS_DATAPUMP. OPEN('EXPORT', 'TABLE', NULL, v_job_name);

    -The parallelism 1 value and add the file

    DBMS_DATAPUMP. SET_PARALLEL (v_job_handle, 1);

    DBMS_DATAPUMP. ADD_FILE(v_job_handle, v_job_name |) '_' || v_partition. PARTITION_NAME | ".dmp", "PARTITION_DUMPS");

    -Apply filters to process only a partition in the table

    DBMS_DATAPUMP. METADATA_FILTER(v_job_handle, 'SCHEMA_EXPR', 'IN ("SIS_MAIN")');

    DBMS_DATAPUMP. METADATA_FILTER(v_job_handle, 'NAME_EXPR', ' AS "' | t_archive_list (i) |) '''');

    DBMS_DATAPUMP. DATA_FILTER(v_job_handle, 'PARTITION_EXPR', ' IN ("' | v_partition.partition_name |)) ')', t_archive_list (i), "SIS_MAIN");

    -Use statistics (rather than blocks) to estimate the time.

    DBMS_DATAPUMP. SET_PARAMETER(v_job_handle, 'ESTIMATE', 'STATISTICS');

    -Start the work. An exception is returned if something is not installed correctly.

    DBMS_DATAPUMP. START_JOB(v_job_handle);

    -The export job should work now. We loop until its finished

    v_percent: = 0;

    v_job_state: = "UNDEFINED";

    WHILE (v_job_state! = 'DONE') and (v_job_state! = "STOPPED") LOOP

    DBMS_DATAPUMP.get_Status (v_job_handle,DBMS_DATAPUMP.ku$_status_job_error + DBMS_DATAPUMP.ku$_status_job_status + DBMS_DATAPUMP.ku$_status_wip,-1, v_job_state, m);

    js: = sts.job_status;

    -As percentage-complete in this loop changes, displays the new value.

    IF js.percent_done! = v_percent THEN

    v_percent: = js.percent_done;

    END IF;

    END LOOP;

    -Once the work is finished, view the status before you loose work.

    PRC_LOG (f1, t_archive_list (i) |) ': Export complete with status: '. v_job_state);

    -DBMS_DATAPUMP. Detach (v_job_handle);

    -Use STOP_JOB instead of DETACHING otherwise 'master' table that is created when the OPEN is called is not removed.

    DBMS_DATAPUMP. STOP_JOB(v_job_handle, 0, 0);

  • Where to find information about all Tables of the Source for Oracle EBS

    Hi all

    We strive to implement Oracle EBS R12.1.3 with analytics (OBIEE11g).

    Currently, we need to know all the sources (Oracle EBS) Tables for the following modules:

    1. supply chain and order management Analytics
    2. purchases & move analytical
    3 finance Analytics

    We have searched in Google, could not find any information.

    Can anyone share a document link that can provide some information about it?

    Thanks in advance

    Concerning
    Nathalie

    1. production & order management Analytics
    All the major paintings in inventory (Articles, categories, onhand, operations), order management (headers, lines, clients, types of orders, deliveries), WIP (work, work order requirements, operations orders)
    2. purchases & move analytical
    All the main tables in shopping (po_headers, po_lines, shipments, suppliers, receipts, invoice headers, distributions, the invoice),
    3 finance Analytics
    All the big tables of AP, AR, GL

    Analytics extract data from a large number of tables. (hundreds, if not thousand)
    I'm curious to know what you do with this information.

    Sandeep Gandhi

  • querying table inside the schema of the IOM

    Hello

    I created a table looks in the scheme of the IOM. I want to insert data into this table custom through my scheduled task. As I try to insert data into a table that is located in the schema of the IOM itself, I hope I don't have to make a JDBC connection. Could you get it someone please let me know how can I go about it?

    Thank you
    PETREA

    You can use the statement prepared for her and use tcDataProvider (IOM) to make connections.

  • Apply a table style to all tables in the document

    I can't find a way to apply certain style of table for all tables in a document of p. 200.

    Specifically, clear any formatting within the cells (cell and replacements styles) would be a plus. All tables must have a unique look with a header cell style preset and style of cell in the body properly defined by a table style.

    All, even partial-help tips will be appreciated because they can save me time.

    I can't believe there is no way to do as other more complicated things are possible using find it & change don't function, for example objects, GREP, you name it.

    Roman

    This javascript will apply the table Style "tabs" to all the tables in the entire document and removes the replacements the (I'm not sure that this will happen automatically when you apply a table style). You set the header & body styles in the style of your table, and they should be applied automatically.

    for (s=0; s
    
    Copy, paste into a text editor (Notepad; TextEdit in plain text mode. best is the editor ESTK delivered installed with InDesign). Save as "ApplyTableStyles.jsx" in your own folder User Scripts, and it will appear in the Scripts panel. Double-click it to run it, and then sit down and relax.
  • count (*) query for all tables in the user_tables

    How can I show count (*) for all the tables in the user_tables?

    Thanks in advance!
    Oracle 11g

    Published by: user598242 on October 7, 2010 09:19

    If you need the number of lines, you can create a script with:

    select 'select '''||table_name||''', count(*) from '||table_name||';' from user_tables;
    

    Use the output from this command as a script.

    Published by: hm on 07.10.2010 09:25

    Sorry: I corrected the order.

  • What do you suggest me me to task "Please comment up all tables in the database.

    I in Oracle database 10g in a diagram ca 600 ('business') tables created. Most of these tables have no comments.
    I do not understand most of the tables, and nobody does. Can you give me some advice, how should I start to comment on these tables?
    I just want to put comments first to tables, later, I shall refer columns.
    I understand that some tables are with mandatory data to the system, something like table ala "What" would sound to be with mandatory 3 rows that are needed for the system to run. some tables contains mandatory data for the system, such as ala 'UserOptions"which sounds like it contains data that the user has inserted itself, if these data are not important for the system. Maybe I could distinguish between tables in other, perhaps some other tips are important to clarify the purpose of the table.
    Can you suggest something useful how do I do the commentary to these 600 tables?
    If you're dazzled that there are not many people who might know the porpouse of the tables, then you should not be surprised, take this as a reality.
    I dig in the Java code that uses these tables, I think what's ' will be a lot of comments either.

    If I were you CharlesRoos, I would be first to reverse engineer the schema/database. It is easier to understand the link between the business tables when you see actually graphically ;-)

    Also, you may find that some tables are on security (users, roles, profiles, granted by screen, etc), others may be connected to a workflow "internal" demand, etc etc.

    It's easier to do when you have the graphics. I'm saying; I just hope that you do not try to understand your database using SQLPlus :))

    See you soon,.

  • How exp/tables in the schema hosted Apex 4.2

    Hi all

    I created a test and schema + tables hosted apex application:

    Oracle APEX 4.2 instance hosted by Oracle, https://apex.oracle.com/pls/apex/f?p=4550:1:0

    How I can exp or expdp schema or tables that I created here in it?

    Thank you very much

    MK

    MariaKarpa (MK) wrote:

    Do the images of data type and BLOB like (photos, jpeg, pdf), the recorded data can be extracted as well?  text or xml?

    It would be much faster to try this for yourself, rather than post it here.

    Values of BLOB columns can be unloaded as XML, but not in the form of text.

  • Unable to export specific tables in the schema.

    I created a schema duser, the data is imported and now I want to take some pictures from this scheme.
    the tables are (partyhdr, partyaddressdtl, partycontactdtl, partydsdtl, partytdsexcludedtl, partycurrencydtl)


    D:\ > EXP FILE DUSER/LOG@ORCL = 20121221PARTY0228PM. DMP TABLES = PARTYHDR, PARTYADDRESS
    DTL, PARTYCONTACTDTL, PARTYTDSDTL, PARTYTDSEXCLUDEDTL, PARTYCURRENCYDTL;

    Export: Release 10.1.0.2.0 - Production on Fri dec 21 14:30:21 2012
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Release 10.1.0.2.0 - Production
    Export performed WE8MSWIN1252 and AL16UTF16 NCHAR character set
    About to export specified tables by conventional means...
    . . export of table PARTYHDR 19387 rows exported
    . . export of table PARTYADDRESSDTL 20747 rows exported
    . . export the PARTYCONTACTDTL 226 exported table rows
    . . export the PARTYTDSDTL 53 exported table rows
    . . export the PARTYTDSEXCLUDEDTL 2 exported table rows
    EXP-00011: DUSER. PARTYCURRENCYDTL; There is no
    Export completed successfully with warnings.

    as I check table in schema partycurrencydtl is their AND MONTRANT RECORDS.

    SELECT OBJECT_TYPE OBJECT WHERE OWNER = 'DUSER' AND OBJECT_NAME = "PARTYCURRENCYDTL";

    OBJECT_TYPE
    -------------------
    TABLE

    I can understand why this particular table does not export.

    Kindly help.

    Please use the below command without semicolon

    EXP FILE = 20121221PARTY0228PM DUSER/LOG@ORCL. DMP TABLES = PARTYHDR, PARTYADDRESS
    DTL, PARTYCONTACTDTL, PARTYTDSDTL, PARTYTDSEXCLUDEDTL, PARTYCURRENCYDTL

  • Need to find all tables in the target using indicators of loading time APPEND and PARALLEL

    Nice day

    Value your machines Way-Back version 10.1.0.4 for a matter of scheme.

    I am trying to identify all the target tables that are currently defined using APPEND it and PARALLEL loading tips. This is the default setting but is not the optimal method in all cases. With several developers who have developed cards for years, most with little background or training, we try to do a bit of cleanup and optimization.

    With about 900 cards it is not possible to do this manually, so I was hoping that someone who has used this old version remember where this information is stored in the old structure of repository.

    Thank you very much!!

    -gary

    Start OMB * more. And then

    OMBCONNECT...
    OMBCC ' /'
    the value of mods [OMBLIST ORACLE_MODULES]
    foreach $mods {} mod
    OMBCC ' /.
    define tabs [OMBLIST TABLES]
    foreach $tabs {} tab
    puts "$tab [OMBRETRIEVE TABLE '$tab' (PARALLEL_ACCESS_MODE) GET PROPERTIES]"
    }
    playing cards [OMBLIST MAPPINGS]
    foreach map $maps {}
    Set mtabs [OMBRETRIEVE MAPPING "$map" GET of OPERATORS of TABLE]
    foreach mtab $mtabs {}
    puts "$map $mtab [PROPERTIES of OMBRETRIEVE MAPPING"$map"OPERATOR"$mtab"GET (LOADING_HINT)]"
    }
    }
    }

    Kind regards
    Jaap.

Maybe you are looking for