Undo Generation

  • From: "DBA Deepak" <oracle.tutorials@xxxxxxxxx>
  • To: oracle-l <oracle-l@xxxxxxxxxxxxx>
  • Date: Thu, 28 Jun 2007 23:13:39 +0530

Hi Gurus,

Have a simple doubt. I did an experiment to know which DML statement
generates the Most/Least amount of UNDO for the same no. of records.

Steps:

===========================================================

SQL> conn scott/tiger
Connected.

SQL> create table myemp as select * from emp;

Table created.

SQL> delete myemp;

14 rows deleted.

SQL> select used_ublk,used_urec from v$session s,v$transaction t where
s.taddr=t.addr and s.username='SCOTT';

USED_UBLK  USED_UREC
---------- ----------
        2         14

SQL> rollback;

Rollback complete.

SQL> update myemp set sal=sal*1.1;

14 rows updated.

USED_UBLK  USED_UREC
---------- ----------
        1          9

SQL> rollback;

Rollback complete.

SQL> insert into myemp select * from emp;

14 rows created.

USED_UBLK  USED_UREC
---------- ----------
        1          1

SQL> rollback;

Rollback complete.
=================================================================
Please note that there was only one session connected to the database as
SCOTT user.


My question is why the do the UNDO generated for DELTE and UPDATE DML
statements differ? Because Oracle has to keep undo information of the same
no. of records in both the cases.

Please help me on this.

--
Regards,

Deepak
Oracle DBA

Other related posts: