Which DML statements create undo information?

I have a quickie here - the reason I need to clarify is that there is a contradiction between the Couchman Fundamentals text book, and the CD.
CD says : DML that creates undo are DELETE, INSERT, UPDATE
Book explains: it is only DELETE, UPDATE.
Which to believe, or is there a third way ?
DA

Yeahh as I've added my voice to mentioned thread by yours, I've repeat the example here also abot undo:
(rows with 0 values I deleted)
SQL> select version from v$instance;
VERSION
10.2.0.1.0
SQL> select value, name
  2  from v$statname n, v$mystat m
  3  where n.statistic# = m.statistic#
  4    and (upper(name) like '%REDO%'
  5     or upper(name) like '%UNDO%')
  6  /
     VALUE NAME
         3 redo synch writes
        72 redo entries
     18260 redo size
      5536 undo change vector size
         5 data blocks consistent reads - undo records applied
       372 IMU undo allocation size
33 rows selected.
SQL> with a as (select /*+ materialize */ * from dual)
  2  select * from a;
D
X
SQL> select value, name
  2  from v$statname n, v$mystat m
  3  where n.statistic# = m.statistic#
  4    and (upper(name) like '%REDO%'
  5     or upper(name) like '%UNDO%')
  6  /
     VALUE NAME
         4 redo synch writes
        79 redo entries
     19808 redo size
      5780 undo change vector size
         5 data blocks consistent reads - undo records applied
       372 IMU undo allocation size
33 rows selected.Unfortunately in 9i there isn't such metric like "undo change vector size".
Gints Plivna
http://www.gplivna.eu

Similar Messages

  • Create undo tablespace while at mount state, possible?

    Oracle 10g (10.2.0.1.0), on RedHat 4 (both 64 bit)
    My test db’s undo tablespace is corrupt (no RMAN or user backups).
    DB fails to open, fails during "Doing block recovery for file 2 block 209910"Is there a way of creating undo tablespace while at mount state?
    I am pretty confident it’s not possible, also searched the net and found no fix, I thought I will ask.
    I get error:
    CREATE UNDO TABLESPACE UNDOTBS1_new DATAFILE  '/u01/oracle/oradata/TEST_DB1/undotbs2_01.dbf' SIZE 512M
    ERROR at line 1:
    ORA-01109: database not openp{code}As a last option, I will open the db with *'reset logs'*, wondering is any thing else I can try to fix the issue.
    Thanks for any input.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    your problem is not to create un UNDO, your problem is that your UNDO is corrupted ! ;)
    You must recover undo because it may contains needed data.
    As there is not backup, you may try to set undo to manual, and then open the db and recreate the undo
    but this may fail and you may have to allow undo corruption in initialization (_corrupted_rollback_segments), but this is an unsupported operation (hidden parameter)
    Could you contact support ?
    is your db a production one ?
    Edited by: Leo Anderson on 1 sept. 2008 15:25

  • BPC 7 MS: Which SQL statements are created for writing with input schedule?

    Hi,
    I wanted to know which SQL statements are created and executed if a user submits values using an Excel input schedule to an application.
    When I check the correspoinding MS SQL server log files, I see that data is read from the three partitions belonging to the application and put into a temporary table, but I can't find anything about writing back to the application (presumably the WB partiton...) in the log.
    There are some cryptic entries in the log file as well, but they are not human-readale... are there any BPC logfiles that could tell me which SQL statements are created and executed to write back the new values to the application? Thanks!

    Hi,
    As far as i know, when a user send data entry from an excel schedule, it will be written in the WB table of the application (for each application, you have 3 Data tables : WB, Fact2 and Fact).
    I presume that the SQL statement may be an INSERT or UPDATE statement.
    Technically, the update is done by the send governor service (hosted on your BPC application server).
    There is no log that will show you the SQL Statement besides a SQL trace that you have to setup in SQL Server 2005 Manager Studio.
    btw, the data are written in the Relationnal database but are read from the OLAP cube. The olap Cube is split in 3 partitions (ROLAP on WB table / and MOLAP on fact and fat2). Wich mean that every new entry in WB will be automatically "updated" in the cube.
    Some DM packages can directly write data in fact2 table. In this case you need to reprocess the cube to get it loaded.

  • Constructing Database Update DML Statements

    This is a very common problem I am sure but want to know how others handle it. I am creating a web application via Servlets and JSPs. I am working with Oracle 10g.
    Here's the problem/question.
    When I present an html form to a user to update an existing record, how do I know what has changed in the record to create the dml statement? I could just update the entire record with the values supplied via the POST data on submit but that does not seem right since maybe only 1 out of 10 fields actually changed. This would also write needless audit and logging information to the database. I have thought about comparing the Request parameters sent with the post with the original java bean used to populate the form in the first place by adding it back to the request as an attribute. Is this the only way to do it or is there a better way?
    Thanks everyone,
    -Brian

    What database drivers are you using? I recall there being some bug in
    sp2 that caused delayed transaction commits for a very specific
    combination of transaction settings and database drivers.
    I think it was third-party type II Oracle drivers and local
    transactions, but I'm not sure.
    In any case, I'd contact support as there is a patch available.
    David
    Gurjit wrote:
    Hi all,
    I have posted something of this sort earlier too. The problem is that
    the database is not reflecting what has been updated using queries from the
    application.
    THe structure of the application is as follows.
    DB = Oracel 8.1.6
    Web Server = iPlanet 4.0
    App Server = iPlanet 6.0 sp2
    The database is connected to via the EJB's. No Database transactions are
    being used except for Bean transactions which are container managed. The
    setAutoCommit flag is set to true. Each query is a transaction. The jsp's
    call these ejb's through wrapper classes. As stated earlier the database
    updates (Inserts, update, delete statements) are not getting reflected in
    the database immediately. The updates happen after a gap of about 7-10
    minutes. Why is this sort of behaviour coming up. This is almost like batch
    updates happening on the database. Is there a setting in IPlanet for
    removing this kind of problem.
    Regards,
    Gurjit

  • HR Schema DDL and DML Statements

    Dear all,
    I want all tables and datas for practicing purpose.(HR Schema)
    In Oracle site where can I get these DDL and DML Statements.
    Can Any one post all statements..
    Thanks in advance.

    Unlocking the Sample Tables
    The Human Resources (HR) Sample Schema is installed as part of the default Oracle Database installation. The HR account is locked by default.
    You need to unlock the HR account before you can use the HR sample schema. To unlock the HR account, log in as the SYSTEM user and enter the following command, where your_password is the password you want to define for the user HR:
    ALTER USER HR IDENTIFIED BY your_password ACCOUNT UNLOCK;
    For further information about unlocking the HR account, see the Oracle Database Sample Schemas guide. The HR user is primarily to enable you to access the HR sample schema and is necessary to enable you to run the examples in this guide.
    Each table in the database is "owned" by a particular user. You may wish to have your own copies of the sample tables to use as you try the examples in this guide. To get your own copies of the HR tables, see your DBA or see the Oracle Database Sample Schemas guide, or you can create the HR tables with the script HR_MAIN.SQL which is located in the following directory on UNIX:
    $ORACLE_HOME/DEMO/SCHEMA/HUMAN_RESOURCES/HR_MAIN.SQL
    And on the following directory on Windows:
    %ORACLE_HOME%\DEMO\SCHEMA\HUMAN_RESOURCES\HR_MAIN.SQL
    To create the HR tables from command-line SQL*Plus, do the following:
    1.
    Ask your DBA for your Oracle Database account username and password.
    2.
    Login to SQL*Plus.
    3.
    On UNIX, enter the following command at the SQL*Plus prompt:
    SQL> @?/DEMO/SCHEMA/HUMAN_RESOURCES/HR_MAIN.SQL
    On Windows, enter the following command at the SQL*Plus prompt:
    SQL> @?\DEMO\SCHEMA\HUMAN_RESOURCES\HR_MAIN.SQL
    To remove the sample tables, perform the same steps but substitute HR_DROP.SQL for HR_MAIN.SQL.
    Regards
    Asif Kabir

  • Will Materialized view log reduces the performance of DML statements on the master table

    Hi all,
    I need to refresh a on demand fast refresh Materialized view in Oracle 11GR2. For this purpose I created a Materialized view log on the table (Non partitioned) in which records will be inserted @ rate of 5000/day as follows.
    CREATE MATERIALIZED VIEW LOG ON NOTES NOLOGGING WITH PRIMARY KEY INCLUDING NEW VALUES;
    This table already has 20L records and adding this Mview log will reduce the DML performance on the table ?
    Please guide me on this.

    Having the base table maintain a materialised view log will have an impact on the speed of DML statements - they are doing extra work, which will take extra time. A more sensible question would be to ask whether it will have a significant impact, to which the answer is almost certainly "no".
    5000 records inserted a day is nothing. Adding a view log to the heap really shouldn't cause any trouble at all - but ultimately only your own testing can establish that.

  • Udf in dml statements

    can we select udf which contains dml statements?

    1007109 wrote:
    can we select udf which contains dml statements?
    Excellent question! And one that illustrates just how careful you have to be when you ASK questions or provide answers.
    As with many things Oracle the correct answer is: it depends.
    Yes - you can. And no - you can't. And also, yes - you can!
    ANY one of those answers is correct, depending on what assumptions the questioner is making and/or what assumptions that you, the answerer are making.
    Sometimes a interviewer will ask this old 'trick' question and then get mad at you if you don't give them the answer that they want even if you give them an answer that is CORRECT and even if you explain WHY your answer is correct.
    Some questioners are looking for the answer that Frank gave:
    >
    A function that performs DML (or that calls another sub-program that performs DML) can NOT be used in a SQL statement, such as SELECT.
    >
    If you just read the 'restrictions' section in the Advanced App Developer's guide you might come up with the answer that Frank gave.
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25518/adfns_packages.htm#i1008107
    >
    Restrictions
    When a new SQL statement is run, checks are made to see if it is logically embedded within the execution of a running SQL statement. This occurs if the statement is run from a trigger or from a subprogram that was in turn invoked from the running SQL statement. In these cases, further checks determine if the new SQL statement is safe in the specific context.
    These restrictions are enforced on subprograms:
      A subprogram invoked from a query (SELECT statement) or DML statement cannot end the current transaction, create or rollback to a savepoint, or ALTER the system or session.
      A subprogram invoked from a query or parallelized DML statement cannot run a DML statement or otherwise modify the database.
      A subprogram invoked from a DML statement cannot read or modify the particular table being modified by that DML statement.
    >
    But then if you read the very next sentence in that doc you will see this:
    >
    You can avoid these restrictions if the execution of the new SQL statement is not logically embedded in the context of the running statement. PL/SQL autonomous transactions provide one escape (see "Autonomous Transactions" ).
    >
    And finally if the term DML includes the SELECT statement and the SQL Language doc DOES use it that way
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_1001.htm#i2099257
    >
    The SELECT statement is a limited form of DML statement in that it can only access data in the database. It cannot manipulate data stored in the database, although it can manipulate the accessed data before returning the results of the query.
    >
    That doc also lists statements other than the traditional SELECT, INSERT, UPDATE or DELETE
    >
    Data Manipulation Language (DML) Statements
    Data manipulation language (DML) statements access and manipulate data in existing schema objects. These statements do not implicitly commit the current transaction. The data manipulation language statements are:
    CALL
    DELETE
    EXPLAIN PLAN
    INSERT
    LOCK TABLE
    MERGE
    SELECT
    UPDATE
    >
    So the CORRECT answer is:
    1. No, Frank's answer, if by DML you are only considering INSERT, UPDATE or DELETE statements and you do NOT use the AUTONOMOUS_TRANSACTION pragma.
    2. Yes - if DML includes SELECT (LOCK TABLE also works) - you don't need the pragma. A common use of functions is in LOOKUP operations. These functions can be, but should NOT be, called from a sql statement.
    3. Yes - if the AUTONOMOUS_TRANSACTION pragma is used. This is NOT recommended.
    Try some of the following code examples
    >
    create or replace function get_dname(p_deptno IN number) return varchar2 is
    v_dname dept.dname%type;
    begin
      select dname into v_dname from dept where deptno = p_deptno;
      return v_dname;
    end;
    select empno, ename, deptno, get_dname(deptno) from emp e
    where rownum < 4
    EMPNO,ENAME,DEPTNO,GET_DNAME(DEPTNO)
    7369,SMITH,20,RESEARCH*
    7499,ALLEN,30,SALES**
    7521,WARD,30,SALES**
    create or replace function get_dname1(p_deptno IN number) return varchar2 is
    v_dname dept.dname%type;
    begin
      update dept set dname = dname || '*' where deptno = p_deptno;
      select dname into v_dname from dept where deptno = p_deptno;
      return v_dname;
    end;
    select empno, ename, deptno, get_dname1(deptno) from emp e
    where rownum < 4
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "SCOTT.GET_DNAME1", line 4
    create or replace function get_dname2(p_deptno IN number) return varchar2 is
    PRAGMA AUTONOMOUS_TRANSACTION;
    v_dname dept.dname%type;
    begin
      update dept set dname = dname || '*' where deptno = p_deptno;
      commit;
      select dname into v_dname from dept where deptno = p_deptno;
      return v_dname;
    end;
    select empno, ename, deptno, get_dname2(deptno) from emp e
    where rownum < 4
    EMPNO,ENAME,DEPTNO,GET_DNAME2(DEPTNO)
    7369,SMITH,20,RESEARCH**
    7499,ALLEN,30,SALES***
    7521,WARD,30,SALES****
    create or replace function get_dname3(p_deptno IN number) return varchar2 is
    v_dname dept.dname%type;
    begin
      lock table emp_copy in share mode;
      select dname into v_dname from dept where deptno = p_deptno;
      return v_dname;
    end;
    select empno, ename, deptno, get_dname3(deptno) from emp e
    where rownum < 4
    EMPNO,ENAME,DEPTNO,GET_DNAME2(DEPTNO)
    7369,SMITH,20,RESEARCH**
    7499,ALLEN,30,SALES***
    7521,WARD,30,SALES****
    >

  • SQL Statement using Undo Tablespace

    Hi
    Is there a way to find out which SQL Statement is using the highest amount of Undo Tablespace ?

    Query v$undostat.
    Use column "MAXQUERYID" for identgifying long running queries.
    Refer Metalink Note 262066.1 for undo information.
    Regards
    Sethu

  • How to trace every dml statement for a schema/ database

    hi,
    how to trace every dml statement for a schema/ database
    PFile Entrie
    init.ora Parameter Example event='1401 trace name errorstack, level 12';
    tkprof orcl_ora_3632.trc b.txt
    after these two steps I am not able to see the sql statements in trace ...
    Please suggest.
    Thanks & Regards,

    Hi,
    Trace Event 1401 will create a trace file and dumps the information when ORA-01401 error occurs. This error occurs when "inserted value too large for column"
    You will see the trace file getting populated only when you encounter ORA-01401 error.
    Regards

  • DML statements

    Hi All,
    Kindly let me know the answer for the below quetion. it is very simple question i feel. but after refer the answer it is confusing me.
    Which are DML statements? (choose all the apply)
    A.Commit
    B.Merge
    C.Update
    D.Delete
    E.Create
    D.Dorp
    Thanks.
    Regards
    GG

    Hi,
    Gowthaman wrote:
    Hi All,
    Kindly let me know the answer for the below quetion. it is very simple question i feel. but after refer the answer it is confusing me.What is the answer that's confusing you? Post it. Why is it confusing you?
    Do you find the SQL Language manual confusing, too? Be specific.
    Which are DML statements? (choose all the apply)
    A.Commit
    B.Merge
    C.Update
    D.Delete
    E.Create
    D.DorpI don't blame you for being confused. This sounds like a very poorly written source.
    There are two answers labled "D."
    What is "Dorp"? If it's not a statement, then it can't be a DML statement. Do you suppose they meant "DROP"?
    There are several different commands that start with CREATE or DROP. For example "CREATE TABLE", "CREATE PROCEDURE", and "CREATE USER". None of them are DML statements, though.

  • DML statements notification

    Hello,
    I have about 300 tables in my database, which is in oracle 9i. If any DML statements are done on these tables, I need a notification like, inserts a row to a notification table or creates a notification file. Writting trigger on all these tables is not possible. Is there are any other ways??

    Writing triggers on each table should be possible if not practical. You discarded that idea so we'll explore another.
    You might be able to create a system level trigger on the schema(s) in question. Check the Oracle documentation to see if the system trigger events support DML activity; they do support DDL activity.

  • Calling PLSQL from DML Statements

    hello everybody,
    i have just a minor "problem". (this confuses me because of the 1z0-147 programming plsql exam)
    Oracle Documentation (10G R2 Application Developer's Guide - Fundamentals - 7 Coding PL/SQL Procedures and Packages) says:
    The following restrictions are enforced on subprograms:
    => A subprogram called from a DML statement may not read or modify the particular table being modified by that DML statement.
    i did some tests but they resulted not in an error (mutating table exception or whatever); so maybe Oracle's documentation is inaccurate here ?
    here is an example which works fine (10G R2):
    drop table ttestuh
    create table ttestuh ( s varchar2(19));
    insert into ttestuh values ( 'Oracle' );
    create or replace function getVal return varchar2 is
    retval ttestuh.s%type;
    begin
    select s into retval from ttestuh where rownum <2;
    return retval;
    end;
    create or replace function getVal2 return varchar2 is
    begin
    insert into ttestuh values ( 'ASDF');
    return 'ASDF';
    end;
    insert into ttestuh values ( getval );
    insert into ttestuh values ( getval2 );
    commit
    select * from ttestuh
    rows:
    Oracle
    Oracle
    ASDF
    ASDFit seems to be that even DML-doing PLSQL calls are allowed when called from an insert statement on the same table.
    (for update statements an mutating table exception is raised)
    thanks in advance for your opinions
    ulli

    I believe what docs are saying is correct. And also what you are seeing is correct. There may be a small issue in understanding the impact.
    SQL>  create or replace function fun1
      2   return number
      3   is
      4   begin
      5   delete test;
      6   end;
      7  .
    SQL>  create or replace function fun1
      2   return number
      3   is
      4   begin
      5   update test set owner='amn';
      6  end;
      7  /
    Function created.
    SQL> select fun1 from test;
    select fun1 from test
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "AMAN.FUN1", line 5
    SQL>  create or replace function fun1
      2   return number
      3   is
      4   begin
      5  insert into test(owner) values('new');
      6  end;
      7  /
    Function created.
    SQL> select fun1 from test;
    select fun1 from test
    ERROR at line 1:
    ORA-14551: cannot perform a DML operation inside a query
    ORA-06512: at "AMAN.FUN1", line 5
    SQL>The mutating error means that the data that you are trying to change is also read by the same session and this means, Oralce can't give a "dirty read" to you. That's why in the case of Update, the mutating error is returned. The insert statement is inserting new data which anyways your select can't see as long as its not committed and with it you haven't changed the existing one that's why its allowed.
    SQL> create or replace function fun1
      2  return varchar2
      3  is
      4  a varchar2(10);
      5  begin
      6  select owner into a from test where rownum<=1;
      7  end;
      8  /
    Function created.
    SQL> update test owner=fun1;
    update test owner=fun1
    ERROR at line 1:
    ORA-00971: missing SET keyword
    SQL> update test set owner=fun1;
    update test set owner=fun1
    ERROR at line 1:
    ORA-04091: table AMAN.TEST is mutating, trigger/function may not see it
    ORA-06512: at "AMAN.FUN1", line 6
    SQL>HTH
    Aman....

  • Which DML trigger i can use for timing

    hi all,
    Can I create a DML tirgger that should fire on particular time
    thanks in advance,
    Reg.
    aak

    You cannot explicitly call a trigger. Trigger will be invoked as part of a DML or DDL actions.
    Possible chance of achieving you requirement is,
    1. You can schedule a procedure to run at a particular time using DBMS_JOB. This procedure will contain the DML statements for a particular table on which you have created the trigger.
    When ever this procedure is called, the DML statements will be executed which will invoke the trigger.

  • If we use DML statement in function then that function can be used inside s

    if we use DML statement in function then that function can be used inside select query or any DML query?

    select f from t2;I think you meant to query t1.
    It works if the function is an autonomous transaction:
    create or replace function f return number
    is
    PRAGMA AUTONOMOUS_TRANSACTION;
    begin
        update t1 set c=2;
        commit;
        return 1;
    end;
    select f from t1But as Billy said why would you want to do DML this way. And this is not the way autonomous procedures should be used either.
    An an answer to an interview question though nothing wrong with it.

  • Looking for software or a service with which I can create a personalized photo calendar

    I am looking for software or a service with which I can create a personalized photo calendar. Any recommendations?
    Jerry

    Thanks for the reply.
    iPhoto, unfortunately, has some real problems in my opinion. Control over image placement and size is limited. This is compounded by the fact that Apple has not made the job any easier by refusing to publish information such as recommended aspect ratios and pixel sizes of images used to create a calendar. Obviously, these both change as the page layouts change. But, I don't think it is too much to ask that Apple supply image aspect ratios for each frame size, 2:3, 3:4, 1:1, or something else. What pixel sizes are required for each frame size/aspect? It is impossible to place 2 photos (or 1 photo and a name) on one date should 2 birthdays fall on one day.
    Further, there is no recommendation for color space to be used by the printer.
    I am tired of trying out a photo in the calendar only to find it looks bad at the pixel size and aspect I chose, then have to go back to the original, re-crop, resize, and wrestle with bringing it back to iPhoto. (I use Aperture to organize my images.)
    I must also add that I had a very bad experience with an iPhoto book earlier this year. Don't know if Apple has fixed the problems as I refuse to invest another 20 hours of time and more then $150.00 to find out.
    I am seriously looking for something to replace iPhoto (unless changes are made) to do the 10 or 15 calendars for my family again this year (and possibly redo my book).
    Jerry

Maybe you are looking for