Skip to main content

Posts

Showing posts with the label DBA

Avoiding Mutating Tables

ORA-04091: table XXXX is mutating, trigger/function may not see it and you want to get around that. This short article will describe and demonstrate the various methods of getting around the mutating table error. If you are interested in why you are getting it and in what cases you will get it, please see the Oracle Server Application Developers Guide (click here to read it right now -- this link is to technet.oracle.com.  You need a password to access this site but you can get one right away for free). Avoiding the mutating table error is fairly easy.  We must defer processing against the mutating or constrainng table until an AFTER trigger.  We will consider two cases: Hitting the ORA-4091 in an INSERT trigger or an UPDATE trigger where you only need access to the :new values Hitting the ORA-4091 in a DELETE trigger or an UPDATE trigger where you need to access the :old values Case 1 - you only need to access the :new values This case is the simplest. ...

Alternative solutions to overcome Mutating trigger

   Let us take a simple scenario. We are selecting the records count from student_table after updating the result coloumn is 'Pass' through TEST_TRIGGER(This trigger is fired on student_table). Step 1: create the table student_table create table student_table(rollnumber number,name varchar2(50),marks number,section varchar2(3),result varchar2(30)) Step 2: insert 6 records in to the table student_table begin insert into student_table values(1000,'chidambaram',99,'A','Pass'); insert into student_table values(1001,'raja',76,'A','Pass'); insert into student_table values(1002,'ram',48,'A','Fail'); insert into student_table values(1003,'jaya',36,'A','Fail'); insert into student_table values(1004,'bala',99,'A','Pass'); insert into student_table values(1005,'sam',76,'A','Pass'); commit; end; SQL> select * from student_table...

Innovative New Approach to Oracle Data Protection

23-Sep-2013 Oracle announced the Oracle Database Backup Logging Recovery Appliance, the industry's first backup appliance engineered specifically for database protection. This appliance delivers near zero data loss data protection, minimal impact to user performance, and a massively scalable architecture.  The Oracle Database Backup Logging Recovery Appliance:               Prevents Data Loss: Databases continuously ship redo log data to                 the appliance, reducing data loss exposure to sub-second.               Minimizes Load on Production Servers: Backup algorithms integrated                 into the Oracle Database send only changed database data to the                 appliance minimizing database impact. Further, all expensive            ...

How do I get to see the procedures that are running

How do I get to see the procedures that are running SELECT   SUBSTR (DECODE (o.kglobtyp, 7, 'PROCEDURE'), 1, 15) "TYPE",          SUBSTR (o.kglnaown, 1, 30) "OWNER", SUBSTR (o.kglnaobj, 1,                                                      30) "NAME", s.indx "SID",          s.ksuseser "SERIAL"     FROM SYS.x$kglob o, SYS.x$kglpn p, SYS.x$ksuse s    WHERE o.inst_id = USERENV ('Instance')      AND p.inst_id = USERENV ('Instance')      AND s.inst_id = USERENV ('Instance')      AND o.kglhdpmd = 2      AND o.kglobtyp IN (7, 8, 9, 12, 13)      AND p.kglpnhdl = o.kglhdadr      AND s.addr = p.kglpnses ORDER BY 1, 2, 3; Note that, You should have the privilege on SYS.x$kglob , SYS...

JOIN IN SQL AT A GLANC

SQL JOIN Definition: The   JOIN   clause is used to combine records from two or more tables in a database. This is done by combining fields from the joined tables by using values common to each table. In other words, JOINS are used to find data from two or more tables based on the   relationship   between certain columns in these tables. Standard ANSII SQL specifies four types of JOINs: INNER OUTER LEFT RIGHT In certain cases, a   TABLE   or   VIEW   can JOIN to itself in what is called a " SELF JOIN ". The   join predicate   in the SQL statement is what contains the rules or conditions that identify what records are to be joined. When the SQL is evaluated, the predicate conditions are tested. If the predicate conditions are true then the combined record is produced. An   INNER JOIN   is the most common join operation and is generally the default join type. An inner join creates a result by combining colum...