Create One Trigger Before DML On All Schema Tables

Nov 28, 2011

We have an application is must be connected to our database for specific requirements in our company but this application has a very bug thing as we must write the super DB password "Like HR password as example" clear in some files and these files must be shared so developers can use the HR password to do any action !!! I know that this application is a problem but we have to install

I can do this by creating trigger on each table will restrict DML. As example: if the operating system user is XXX, the trigger restrict the action. But not logic at all to create more than 1000 triggers on schema (This will impact badly on DB performance).

So, i need to create one trigger to fire before doing any DML on all schema tables. As example: If "MMM" the administrator operating system user trying to do insert action, he can do the action. BUT If "DEV" the developer operating system user trying to do insert action, the trigger must fire here to restrict this action.

Be noted also, i need this trigger not depend on any specific tool like Toad as any user can simply rename the exe file for toad then he can pass the trigger. At least, trigger must depend on (Operating system user & Action_type)

View 11 Replies


ADVERTISEMENT

PL/SQL :: Trigger From Other Tables Of Same Schema?

Jan 14, 2013

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit

i'm trying since some hours to get information from inside a trigger from another table of the same schema.My trigger table is PSE_BKB.NUM_PHANTOM_BP

First i tried simple solution ...

CREATE OR REPLACE TRIGGER PSE_BKB.NUM_TR_PHANTOM_BP
BEFORE DELETE OR INSERT OR UPDATE
ON PSE_BKB.NUM_PHANTOM_BP
REFERENCING NEW AS NEW OLD AS OLD

[code]...

The last version i tried was with a cursor definition inside the trigger as in the code-block below.For debugging purposes i've inserted a RAISE_APPLICATION_ERROR in the inner loop - see below. The variable v_obj_key is never set, like in all other variations i tried - i alway see the predefined 'gugus' from the declare section.

It seems oracle cannot read from other tables at this point. The :old.phantom_key is set (in this simple example there should come one obj_key back).

trigger:

CREATE OR REPLACE TRIGGER PSE_BKB.NUM_TR_PHANTOM_BP
BEFORE DELETE OR INSERT OR UPDATE
ON PSE_BKB.NUM_PHANTOM_BP
REFERENCING NEW AS NEW OLD AS OLD

[code]...

View 11 Replies View Related

SQL & PL/SQL :: Create Tables From Different Schema?

Mar 18, 2012

I have created 2 different databases and each have their own schema user for eg we have database ALIVE with user allive and the other database RLIVE with user rllive , actually we have implemented new module in ALIVE database and in the process we created many tables , synonyms , index and other objects now we want to list out all the tables ,sequences as scripts which are not present in RLIVE and create them in RLIVE as new objects.

View 3 Replies View Related

SQL & PL/SQL :: Create Trigger That Will Fire Whenever Any User Will Access Schema Of Oracle

Oct 31, 2011

I would like to create a trigger that will fire whenever any user will access to a Schema of Oracle DB (for each and every login). regardless the access will be through an application or SQLPLUS and this trigger must insert the below information into a table.

1) IP address
2) Machine Name
3) login time
4) logout time
5) name of accessed schema

writing this trigger and creating the table that will hold the required data.

View 6 Replies View Related

SQL & PL/SQL :: Create Block Of Code That Would Search In All Tables In Schema For Column_name

Jun 14, 2011

I want to create a block of code that would search in all tables in a schema for a column_name where its data_length is like 4000 let's say. This data_length is actually dedicated for a comment column. If found, all not null column with like 4000 data_length will be changed by string "Comment has been removed". I have the following script below but it seemed lacking.

begin
for rec in (select table_name, column_name from user_tab_columns where column_name like ?data_length? = 4000 order by 1,2) loop
begin
execute immediate 'update '||rec.table_name||' set '||rec.column_name||' = ''Comment has been removed'' where '||rec.column_name||' is not null';
commit;
[code]........

View 6 Replies View Related

Create Trigger On Table / Populate With Data From Additional Tables

Nov 7, 2010

I would like to create a trigger on a table which populates a log table. In addition to using the table where the trigger will exist, I would like to populate a couple more fields in the log table with with data from 2 other tables.

e.g.

NAME_TABLE
-reg_id
-name

ADDRESS_TABLE *trigger to be fired when a new record is created here.
-reg_id
-srv_id

PROCESS_TABLE
-srv_id
-start_time
-end_time

This is what I would like the logging table to look like:

LOGGING_TABLE
-address_table_reg_id
-address_table.srv_id
-name_table.name
-process_table.start_time
-process_table.end_time

How can I go about creating this type of trigger?

View 2 Replies View Related

Client Tools :: How To Create A Table In Another Schema As In Existing Schema

Apr 26, 2010

I would like to create a table in another schema(CBF) as already exist in my schema(TLC) without data but related indexes,synonyms and grants should be include.

How could I do this without using export import. I am using TOAD 9.0.1.

View 10 Replies View Related

How To Fire A Schema Trigger From Outside Schema

Sep 24, 2012

A user is using an ad hoc tool similar to SQL Developer called PeopleSoft Application Designer.

He creates a connection to the db, then issues an alter session set current_schema = 'restricted_schema'. The connected user does not have direct privileges on the "restricted_schema" which they call SYSADM.

After changing the schema context in that manner he creates objects in SYSADM. A schema trigger is then fired and grants privileges on the new objects created in SYSADM. Doing the same in either SQL Plus or SQL Developer does not fire the schema trigger.

I think SQL Plus and SQL Dev are working as they should. Altering the session like that does not change your identity - just the schema context. But, when you examine v_$session, the connection with this other tool looks exactly the same as one from SQL Plus or SQL Dev when changing the schema context in the session.

Instead of trying to figure out what this other tool is doing, is there any way for that schema trigger to fire when using this process from one of our tools?

View 6 Replies View Related

SQL & PL/SQL :: Created Trigger On Database Level In System Schema

Jun 10, 2010

I have created trigger on database level in system schema. While i am creating new tables in system schema, trigger logged the entry but when i am creating table in scott schema it is not working for that.

CREATE OR REPLACE TRIGGER ddltrigger
AFTER DDL ON DATABASE
BEGIN
INSERT INTO aud_log
(user_name, ddl_date, ddl_type, object_type,
owner, object_name
)
VALUES (ora_login_user, SYSDATE, ora_sysevent, ora_dict_obj_type,
ora_dict_obj_owner, ora_dict_obj_name
);
END;

View 3 Replies View Related

SQL & PL/SQL :: Trigger - Automatically Grant Select Permission To ODI-MASTER Schema?

Jan 4, 2011

I have two schema named ODI_MASTER and ODI_WORK.Under ODI_WORK there are some tables like TEMP1, TEMP2
Further more when any new tables will create under ODI_WORK, then i need automatically grant select permission to ODI _MASTER schema.

for this purpose i choose trigger, and a Stored procedure.

CREATE OR REPLACE TRIGGER ODI_WORK.TRIG1
AFTER CREATE ON ODI_WORK.SCHEMA
ENABLE
call sp1 (ora_login_user)

[code]...

I searched a lot over blogs, if EXECUTE IMMEDIATE commands exist under Trigger it gets problem. Insert/update/delete statement on trigger seems no problem.

View 13 Replies View Related

SQL & PL/SQL :: Get Row Counts Of Tables In Schema Without Using Num_rows

Aug 9, 2010

I am trying to get a row count(*) for all the tables in my schema. The NUM_ROWS column in DBA_TABLES is not appropriate in this case because they are as good as the last analyze. So I need to get real time counts.

I tried the following code but I can't seem to catch my error.

DECLARE

l_sql varchar2(150);
cursor tablelist is
select table_name from dba_tables where owner = 'ME';

[Code]....

My expected results are :

TABLE_NAME ROW_COUNT
---------- ----------

View 13 Replies View Related

How To Grant Select On All Tables Of User1 To Another Schema

Jan 18, 2012

User1 is having 10000 tables in his schema...How can i grant "select" on a all tables of a user1 to another schema(user2) so that in future when user1 will create tables , the user2 will have "select" access on those tables automatically.

I dont want user2 to have "select any table" privillege.

User2 should not have "drop" privillege on his own tables.

View 1 Replies View Related

Tool To View Schema And Relations Between Tables

Jul 4, 2008

Any tool or way to view the schema and relations between tables of an Oracle database?

View 1 Replies View Related

Server Utilities :: Import Only Tables Of A Schema

Jul 26, 2013

The way to do IMPORT of a schema's ALL the TABLES only. Through Data Pump. I don't want to import any other objects like 'package',procedure etc...

Is it the only way is specifying them within EXCLUDE parameter?

View 3 Replies View Related

Server Utilities :: How To Backup Tables In A Schema

May 31, 2012

How to backup the tables in a schema? I need som halp on this subjekt. I hav Dev envrnment that I must to backup.

View 9 Replies View Related

SQL & PL/SQL :: Query To Find List Of Tables Contains Particular Data In Schema?

Feb 3, 2012

I want to list the tables in a schema which contains a particular value or data.

View 2 Replies View Related

Security :: Enabling Audits Can They Be Applied On Tables Or Whole Schema

Apr 19, 2013

Enabling of auditing in oracle database, can this be done on some tables or applied on the whole schema/user.

View 5 Replies View Related

Backup & Recovery :: Selected Data From Tables Of Schema

Mar 7, 2012

I want to take backup of selected data from tables of a schema (as huge data, that is not used, causing slow query performance) I planned to create a seprate backup schema and tablespace to store the data from these tables. Then write procedures that can move the data to and fro among table of those schema. And create partitioned index on those backup tables.

View 11 Replies View Related

Forms :: Summit Office Supply Schema (Tables)?

Jan 21, 2013

I have this pdf (2 Volumes) from Oracle University courses, "Oracle Fusion Middleware 11g: Build Applications with Oracle Forms" In order to read the examples you must have "Summit Office Supply Schema" fmbs, mmb, pll, tables.(dmp)

indicatively some tables (not confuse it with other summit user)
customers,
departments,
warehouses,
orders,
employees,
order_items,
product_information,
inventories

View 2 Replies View Related

SQL & PL/SQL :: Trigger From Multiple Tables

May 1, 2013

I need to set up a trigger to check and enforce that the age of an employee at hire date is older than 18 when a new record is inserted. The age is on the PERSON table, and the hire date is on the EMPLOYEE table.

My attempt:

CREATE TRIGGER AGE_HIRE
BEFORE INSERT OR UPDATE ON EMPLOYEE
FOR EACH ROW
BEGIN
IF FLOOR EXTRACT (YEAR FROM (PERSON.BIRTHDATE - EMPLOYEE.HIREDATE)) > 18
THEN DROP NEW
ELSE INSERT NEW
FROM PERSON, EMPLOYEE
END;

View 8 Replies View Related

Sort Through Schema Tables To Find If Particular Vendor Number Exist

Nov 14, 2006

I would like to be able to sort through a schema's tables to find if particular vendor numbers exist. The decode cross tab works fine, except that it needs static data for each table. How can I code a PL/SQL to populate the table_name and give a count for each row? See example below:

col table_name format a15
set numwidth 10
set lines 1000
set pages 50

select b1.table_name,
count(case when a.vendor='86444' then 1 else null end) "86444",
count(case when a.vendor='86445' then 1 else null end) "86445",
count(case when a.vendor='86469' then 1 else null end) "86469",
count(case when a.vendor='86470' then 1 else null end) "86470",
[code]........

View 1 Replies View Related

Server Utilities :: Exporting Database Schema / Tables Without Data

Sep 22, 2010

I'm trying to export a relatively large database but it's a bit more complicated than that.For one schema I need a full export / import (data included).

For another 10 schemas I need them empty, with the exception of a table in some of them which needs to be exported / imported with all data inside.Is it possible to do this with datapump utility (impdp, expdp)?

Afterwards I will be running some scripts to populate the DB instance with critical data / metadata.

View 1 Replies View Related

Export/Import/SQL Loader :: IMPDP Into Schema With Truncated Tables

Aug 2, 2012

I've got a schema that I've truncated all tables. I have a full schema export I took awhile back, and I'm wanting to import this into the schema to basically 'reset' it.

First time run, I got the :

ORA-39151: Table "xyz.tablename" exists. All dependent metadata and data will be skipped due to table_exists_action of skip

I've been reading through, and see suggestions to add to the par file:

CONTENT=DATA_ONLY TABLE_EXISTS_ACTION=APPEND

And I've seen others use the option for:

table_exists_action=replace

I basically want to put the data back into the tables, and have the indexes rebuilt.....

View 1 Replies View Related

Security :: Create Various Users On A Schema

Nov 19, 2010

I do a schema in oracle ... an m my question is if I can create 2 o more users for access to a schema..for example i have schema Project and i need that one administrator and 2 more users with others permission.

View 3 Replies View Related

Security :: Create Table Others Schema

Oct 18, 2010

how can i grant a user permission to create tables and indexes in other user schema.Grant create table permits the user to create tables in his own schema which is part of Resource role.Grant any table will permit him to create table in any schema including system which i don't want.

View 8 Replies View Related

Security :: How To Create User Under Schema

Dec 5, 2012

To make users under one schema.

1) user should have access of all objects with limited privileges.

How can i make it under schema?

View 3 Replies View Related

Enterprise Manager :: How To Create XML Schema Using OEM

Mar 28, 2011

How to create & register XSD schema using OEM ?

View 1 Replies View Related

Modify One Table To Trigger Other Tables

Aug 20, 2012

We are running an Oracle 10g server.

We are adding support for barcode scanner in one part of our information system. So that the mechanics can add parts to an work orders bill of material themselves using barcode scanner to scan the part and enter the qty.

I can via SQL add a part to the bill of materials and reserve the part. But then the part needs to be issued to make it disappear from the stock.

I have found a table that contains information about the part and the bill of material, it has a column named "QTY ISSUED" I have tried via an update command to set the qty issued = 1 for the reserved part. The table is updated, and via SQL everything looks fine, but the part doesn't disappear from the stock. So my guess is that there is a trigger or function somewhere that I need for this.

View 13 Replies View Related

SQL & PL/SQL :: After Update Trigger (with Multiple Tables)

Nov 21, 2012

I have to write a "after update trigger". Here, i have to update the stock table by other inventory tables (by complex query).
I have written trigger below. how to make it correct?

create or replace trigger trg_stk_upd_pur
after update on O_STOCK_EFFECTS
REFERENCING NEW AS new OLD AS old
FOR EACH ROW

[Code]....

View 5 Replies View Related

SQL & PL/SQL :: Efficient And Fast Method Required For Audit Trailing Tables In A Schema?

Nov 17, 2011

efficient & fast method for Audit trailing tables in a Schema for any insert /update /deletes for a table. I do not want to use db triggers because of performance issues.

presently we have as system which does audit trail as below:

1. If a user changes a column value for a table ( update/insert/delete) then we call a db package and pass the parameters like table name,col name,user, operation (ins/update/delete),old value, new value,date modified,user modified etc

2. the called package will insert a record in the audit trail table with the parameters passed

3. The audit trail table is used for report generation .

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved