Oracle Concepts: Clarity required on Instance Recovery

One of my colleague was discussing instance recovery with me.
We discussed about checkpoint position, instance recovery phases (rolling forward & rolling back ), then he asked me whats the point of rolling forward (applying redo logs) and then rolling back (applying undo blocks), why not applying only committed transactions?
I told him that this happens because:
1) roll forward to recreate the scenario just before when Instance crashed
2) roll forward/roll back is the fastest way to recover
I am not sure from where I got this learning, may be some blog or article (probably not from Oracle Docs), but is it correct?
Regards,
Ankit Rathi

OnB wrote:
The 2nd point is completely wrong!Let me elaborate the context of 2nd point, it was mentioned in context of applying only committed transactions during recovery. As all the change vectors go in the redo log files, had there been any mechanism to identify only committed transactions, it would have taken more time (its really hypothetical as there is no mechanism exists, right?) by that mechanism to identify committted transactions (from redo logs) than simply rolling forward and rolling back.There is no context in that point, it's wrong , plain and simple!
There is a mechanism to identify committed transactions and that's called commit . But when you are doing recovery, you are not recovering just the committed transactions but you are recreating the entire scene before the crash which means, you would be required to apply both the uncommitted and committed work/change vectors. Going by your logic, if Oracle would start searching for the committed transactions, it would have many issues. One, time taken would be more higher. Two, there may be an instance that the commit was issued but before the commit complete message could reach the user, instance got terminated so how about those blocks which may be now in data file and have got an active transaction status and are unsure whether they are committed or not. And last, the way LGWR writes is just to keep on pushing change vectors to the redo stream in the order of the SCN. So for doing a recovery, you would need to reapply all of that changed data in that same SCN ordering.
The meaning of instance recovery is that you are not having a physical file crashed or deleted but there was a memory loss and few buffers were left out from being written to the data files and now, data files , control file and log files are not in synch.
The second point, where you are saying its the fastest, is wrong because even for the instance recovery , it can take a very long time and it would depend on how much work was left over before the instance was crashed. Roll Forward is the way to bring the data files in synch with the redo log files and the control files. So if the data files were on Checkpoint Number 100 and the control files and redo log files recorded the number as 120, the missing 20 numbers gap would be reentered in the data files because only then, the database would be opened. Now, your friend's question that why not only committed transaction because you never say a transaction is only done when there is a commit. Whenever any DML is encountered , it's going to cause a transaction. And you do want that missing work to be recreated to ensure that if there was a commit issued before the instance was crashed , next time, Oracle would ensure that work is there and if not , it would be rolled back. And most importantly, in the redo log files all the change vectors go, not just for the committed transactions .This is fine, same understanding here.
Bring in your own thoughts now that how much you understood from this explanation before I start to get into more technical terms.I would like to know your view about the 1st point. Suppose, something went wrong (in terms of transactions) due to which instance crashed, if it rolls forward (as it happens automatically) during next start-up, will it crash again?
It would be rolled back in the case of the instance (next) startup. If all what you are doing is plain DML's they won't crash the instance as long as you haven't encountered any bug in the case of which, next time also the instance may crash.
Aman....

Similar Messages

  • Undo behavior during instance recovery

    i'm confused about 2 concepts in applying undoin the case of instance failure
    1.the common concepts of instance recovery which states :
    a) when instance crash, oracle automatically applies all redo in the redo file to roll the db forward to the last scn be4 the failure
    b) & redo data also contains the undo data, it also undo the uncommitted changes from the old valuesin the undo.
    that'sok
    2.but refereing to 10g database concepts (ch17 high availability-p317 if pdf)
    url: http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14220/high_av.htm#sthref2531
    it says:
    •With fast-start fault recovery, the Oracle database is opened for access by applications without having to wait for the undo, or rollback, phase to be completed.
    •The rollback of data locked by uncommitted transaction is done dynamically on an as needed basis.
    •If the user process encounters a row locked by a crashed transaction, then it just rolls back that row.
    •The impact of rolling back the rows requested by a query is negligible.
    •Fast-start fault recovery is very fast, because undo data is stored in the database, not in the log files.
    •Undoing a block does not require an expensive sequential scan of a log file.
    so which situation is applicable in case of instance recovery
    & do the undo behvior stated above in case of fast start fault recovery is an option or that's the default
    thnx alot

    Hi,
    Whatever changes are made to the database, are recorded in redo log buffer cache sequentially and then shifted to redo log files. Suppose redo logs recorded following changes in the database in following sequence.
    insert a row
    update a row
    commit;
    delete a row
    Now Instance crashes before these changes were written into the database (data remains in buffer cache until checkpoint)
    Now during instance recovery, data which was still in buffer cache and not written to the data files, will be applied in same sequence. All undo data for update/delete is in redo log files and will be applied in the same sequence.
    Salman

  • Oracle Concepts!!

    (ORACLE CONCEPT DOCS.)
    Log Writer (LGWR)..writes to files on the redo log files on the disk
    Database Writer (DBWn)...writes to files on Data file on the disk
    Log Writer Process (LGWR)
    The log writer process (LGWR) is responsible for redo log buffer
    management—writing the redo log buffer to a redo log file on disk.
    The redo log buffer is a circular buffer. When LGWR writes redo entries from the
    redo log buffer to a redo log file, server processes can then copy new entries over
    the entries in the redo log buffer that have beenwritten to disk.
    When a user issues a COMMIT statement, LGWR puts a commit record in the redo
    log buffer and writes it to disk immediately, along with the transaction’s redo
    entries. The corresponding changes to data blocks are deferred until it is more
    efficient to write them. This is called a fast commit mechanism. The atomic write of
    the redo entry containing the transaction’s commit record is the single event that
    determines the transaction has committed. Oracle returns a success code to the
    committing transaction, although the data buffers have not yet been written to disk.
    When a user commits a transaction, the transaction is assigned a system change
    number (SCN), which Oracle records along with the transaction’s redo entries in
    the redo log. SCNs are recorded in the redo log so that recovery operations can be
    synchronized in Oracle9i Real Application Clusters and distributed databases.
    so what happens in the mean time if somebody pulls plug of electricity..Data has been written to online redo files not on DATA files...so after a restart which oracle process makes/copies entire new values of commited transactions to DATA files from online redo files?

    SMON
    SMON process performs instance recovery during startup by using the online redo log files.
    When a user issues a COMMIT statement, LGWR puts a
    commit record in the redo
    log buffer and writes it to disk immediately, along > with the transaction’s redo
    entries. I think the above statement is false.evethough commit is done,it will not write immediately to data files.It will make the transactions much slower.change will take effect on datafiles only once checkpoint is happening.
    Can anyone verify this?
    ~

  • Instance recovery by SMON

    Hi,
    are you agree with the followings :
    Your database is running in the ARCHIVELOG mode. After an instance crash, you start up the database by issuing the STARTUP
    command. Instance recovery is initiated by the SMON background process.
    The information used for instance recovery will be derived from the control file.
    The uncommitted changes are rolled back using information in the undo segments.
    The committed and uncommitted changes stored in the online redo log are applied to the
    affected data blocks.Many thanks.

    Oracle instance recovery. I am remebering, one day i was talking with one of my the best and great oracle expert friend and i asked him; "Suppose you have got a chance to ask one question from OCM; what will you ask? He said; i will ask him explain how and when oracle perfrom instance recovery". So you can judge what is instance recovery and how much lengthy is this topic. But if i have to explain then first i will collect some notes from forum and google and the text will be as follow :
    1. The recovery is triggered by smon comparing thre control files and data file headers. If the stop scn of the datafile doesn't match with the checkpoint scn of control file, recovery is triggered(hope I remember correctly). After that recovery starts. There are changes in it from 9i but don't think its neded here. Read on the docs!
    Source:Re: instance recovery in oracle 9i
    Writer:Aman....
    Please read replies by Kamran and Pavan in the above thread.
    2. There is no Instance Recovery at the STARTUP and MOUNT phases. Instance Recovery is at the OPEN phase.
    Source:how oracle will come to know weather it is Instance recovery or Media Recovery
    Writer:Hemant K Chitale
    3. Re: crash recovery/ instance recovery
    Writer:Eduardo Legatti
    etc. etc.
    I mean if i wish to write a note on instance recovery i will collect some good and clear replies by forum experts (as i showed example above) and then will shape-up in my language and then; i will post that text in the forum; so that necessary correction too can be performed (if required).
    Regards
    Girish Sharma

  • Crash recovery/ instance recovery

    Hi,
    How do oracle identifies crash recovery/ instance recovery
    is required?
    Regards,
    Mathew

    Hi,
    >>But how do oracle identifies dabase is abnormally down and crash recovery is required?
    I think that the checkpoint information that is desynchronized in redo log files and datafiles. It is necessary understand what is a checkpoint and what the CKPT process do. A checkpoint is a moment in time when all the changes (dirty blocks) made in the database buffer cache are made to the data files. The checkpoint is performed by the CKPT process and it creates an entry in the control file to identify the point in the online redo log file from where the instance recovery should begin in case of an instance failure. One of the ways a checkpoint is initiated is by the data block writer (DBWR) process. The DBWR process initiates a checkpoint by writing all modified data blocks in the data buffers (dirty buffers) to the data files. After a checkpoint is performed, all committed transactions are written to the data files. If the instance were to crash at this point, only new transactions that occurred after this checkpoint would need to be applied to the database to enable a complete recovery. Therefore, the checkpoint process determines which transactions from the redo logs need to be applied to the database in the event of a failure and subsequent recovery.
    Cheers

  • Query on Oracle Concepts: Advantages of ASSM

    Hi,
    A query on Oracle Concepts, specifically on Advantages of ASSM.
    While I am able to understand 'Simplified administration' & 'Increased concurrency', can anyone mention this in simple terms:
    • Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment.I guess I know whats Oracle RAC but what it meant by 'Dynamic affinity of space to instances'?
    Regards,
    Ankit Rathi

    Hi Aman,
    I was going through Oracle® Database Concepts 11g Release 2, Chapter 12 Logical Storage Structures (link below):
    http://docs.oracle.com/cd/E11882_01/server.112/e25789/logical.htm#i19599
    *Automatic Segment Space Management*
    The ASSM method uses bitmaps to manage space. Bitmaps provide the following advantages:
    •Simplified administration
    ASSM avoids the need to manually determine correct settings for many storage parameters. Only one crucial SQL parameter controls space allocation: PCTFREE. This parameter specifies the percentage of space to be reserved in a block for future updates (see "Percentage of Free Space in Data Blocks").
    •Increased concurrency
    Multiple transactions can search separate lists of free data blocks, thereby reducing contention and waits. For many standard workloads, application performance with ASSM is better than the performance of a well-tuned application that uses MSSM.
    •Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment
    ASSM is more efficient and is the default for permanent, locally managed tablespaces.Regards,
    Ankit Rathi

  • Instance recovery mechanism

    Hi,
    I try to understand the mechanism of instance recovery of Oracle 8i/ Oracle 9i database and I am little bit confused, since I got some opposed information about that.
    Please find below my questions:
    1. Is SCN number assigned to all transactions or ONLY to committed transactions?
    2. Is the checkpoint number the highest SCN number after an checkpoint event?
    3. After checkpoint event, dirty buffer are written to database files by DBWR. Does DBWR write only dirty buffers of committet transactions or does DBWR write out all dirty buffers in the DB buffer cache?
    Thanks in advance for your answers!
    regards
    Peter

    1. The system change number (SCN) is updated whenever there is a commit.
    2. If you are talking about the checkpoint_change# in the v$database table, yes
    3. All dirty buffers are written to disk. Data files can and do contain uncommitted data
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Uncommited transactions remain after Instance Recovery

    After Instance Recovery, the database seems to contain uncommitted transactions. Please provide an explanation for the following:
    create table t1
    as
    select *
    from all_objects;
    commit;
    create table t2
    as
    select *
    from all_objects;
    update t2
    set object_id = 1 where rownum = 1;
    shutdown abort;
    Neither table t2 nor the update to it were committed (right?), therefore, once the database starts up t2 should not be there. On the contrary, it is still there. In the Oracle Database Backup and Recovery Advanced Guide 10g Release 2, page 11-9, explains how the uncommitted transactions are removed (rolled back) in the Roll Backward step (transaction recovery) of the Instance recovery process.
    Any insight on this is highly appreciated. Thanks.

    Note also following scenario run with SYSDBA privileges:
    bas002> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    bas002>
    bas002> drop table t2;
    drop table t2
    ERROR at line 1:
    ORA-00942: table or view does not exist
    bas002> create table t2
      2  as
      3  select *
      4  from all_objects;
    Table created.
    bas002>
    bas002> update t2
      2  set object_id = 1 where object_id=258;
    1 row updated.
    bas002>
    bas002> shutdown abort;
    ORACLE instance shut down.
    bas002> startup
    ORACLE instance started.
    Total System Global Area  192937984 bytes
    Fixed Size                  1288484 bytes
    Variable Size             130025180 bytes
    Database Buffers           54525952 bytes
    Redo Buffers                7098368 bytes
    Database mounted.
    Database opened.
    bas002>
    bas002> select count(*) from t2 where object_id=1;
      COUNT(*)
             0
    bas002>Message was edited by:
    Pierre Forstmann

  • Oracle XE Listener Requiring Service To Be Set To 'Automatic (Delayed Start

    Can anyone offer any insight/explanation as to why the Oracle Listener would require the service to be set to 'Automatic (Delayed Start)' When it is set to just automatic, it does not even try to start. No output to the listener log, and nothing to the event viewer. It is as if it never even tries to start. Once switched to 'Automatic (Delayed Start)' it works as expected. Additionally if you manually start the service due to it not starting automatically, it works fine as well.
    OS: Windows 7 64BIT
    Service is being run by the local system account and is set to allow to interact with desktop. -Local system account is part of the administrator group.

    OS: Windows 7 64BITFirst point, win7 isn't on the 10g XE "supported OS" list. The installer is nearly as old as Firefox 1.0. Not to say folks haven't been able to get it working, plenty of other threads cover that topic.
    Delayed start, auto start ... how critical is that functionality for your install? My suggestion, set it to Manual, and if you need the database, start the listener and then start the database service. If the database isn't needed keep your RAM and system resources available for other stuff.
    Sorry can't be more helpful (esp. for win7, don't have it, don't use it, same for vista) but XE is more of a "playground" environment for test drives, kicking the tires, etc., a practice resource intended as an introduction to managing an oracle instance.
    And always start the listener service first, that allows the database to register with the listener as it completes its startup processing. If startup goes the other way around, the Apex might not be immediately available, but a sqlplus system connection and `alter system register;` command will fix that.

  • Oracle APPS DBA requirement

    Hi All,
    There is a requirement for Oracle APPS DBA with 2+ sound practical experience on managing Oracle APPS( modules financial,CRM,Inventory,Purchase) in a telecom company in Northern India.
    Salary package will be best in the market and depends on the technical knowledge and practical experience.
    Interested candidates can send their resume at
    [email protected]
    Regards,
    Neeraj

    Here's your chance to work in a team environment supporting Oracle E-Business Suite and releated applications at a fortune 500 company in Dallas, TX with a great work environment, benefits, and salary.
    We are engaged in a search for an experienced Oracle Apps DBA for a key client of ours. This is a full-time (permanent) position. Local candidates strongly preferred.
    In this role, your specific responsibilities will include:
    • Oracle E-Business Suite installation/upgrade/operations
    • Working with Oracle Financial modules and E-Business Suite R11.5.10+
    • Oracle E-Business Suite System Administration
    • Oracle E-Business Suite printing setup and administration
    • Performing Oracle E-Business Suite Patch administration, review, testing, deployment
    • Performing Oracle E-Business Suite maintenance with minimal downtime
    • Implementing and configuring Oracle E-Business Suite monitoring tools
    • Developing and implementing security schemes for Oracle E-Business Suite
    • Measuring Oracle E-Business Suite performance and availability
    Oracle RDBMS
    • Installation and upgrading the Oracle 10g RDBMS
    • Database backup and recovery using RMAN
    • Database operations monitoring using scripts and OEM
    • Copying databases/renaming files and creating control files
    • Focus on providing a high availability database
    • Tuning SQL and PL/SQL
    • Physical and logical tuning of Oracle Database
    • Performing patch administration, review, testing, deployment
    • Performing database maintenance with minimal downtime
    • Implementing and configuring database monitoring tools
    • Developing and implementing security schemes
    • Measuring database performance and availability
    • Database Performance Tuning: Resolving locks, pinning, latches and waits
    Requirements
    This position requires a minimum of 8 years DBA experience, with at least 6 years of those with the Oracle Applications/E-Business Suite. Proficiency with Oracle 10g Application Server installation/upgrade/patching/operations a plus.
    You must have excellent communication, verbal, written and presentation skills. Excellent customer service skills and the ability to work within a team environment are needed. The person in this position must possess strong skills in analyzing, conceptualizing and problem solving. SQL/PL SQL and UNIX shell scripting experience is a must.
    Benefits:
    The company provides on going training, excellent benefits, and a positive work environment. This is a great place to work and grow your career. If your interested send your resume to [email protected]

  • Need Instance Recovery?

    I have a very strange situation right now:
    1) Turn on Archive log Mode
    2) Everything works fine ( both database & oracle apps)
    3) Weekly full backup successful
    4) Daily backup successful
    5) Oracle databas hangs (shutdown & startup the database, same problem)
    6) Turn off Archive log Mode
    7) delete all archive logs
    8) Everything works fine ( both database & oracle apps)
    9) Try to turn on Archive log Mode again.
    Failure: with message need to instance recovery???? How come it is? The Archive Log Mode is off and the database and oracle application works fine.
    Any ideas? Or how to fix it?
    FAN
    Message was edited by:
    user623471

    Without really knowing the time gap and transaction volumes (ie archivelog rates) at these steps, and the exact message ...... possibly speculating ....
    but I think that the most likely cause is that the ArchiveLog Destination filesystem is out of space for new archivelogs. That would cause
    a. The "hang" at step 5 {because Oracle can't archive the active/current redolog}
    b. The "hang" at startup in step 5 {because Oracle *still* cant archive ...}

  • Undo tablespace  and instance recovery

    Is UNDO tablespace is mandatory during instance recovery. ?
    Suppose my undo tablespace has some active transaction and instance crashes making undo tablespace inaccessible.
    Will database search for that undo tablespace during startup or I can simply create a new one and set as new undo tablespace ?
    With Regards
    Amt

    Hi,
    >>I am actually confused
    Keep in mind that If an Oracle instance crashes, any changes that are made in the SGA are not written to the data files. When you restart the instance, the SMON background process automatically performs instance recovery by performing the following tasks:
    • Rolling forward changes that are made in the online redo log files but not in the data files. Since all the committed transactions are written to the online redo log files, these are successfully recovered as result of rolling forward changes from the online redo log files to the data files.
    • Opening the database. After the database is opened, users can log on and access any data that is not locked by un-recovered transaction.
    • Rolling back all the uncommitted transactions.
    In resume, during database recovery, undo records are used to undo any uncommitted changes applied from the redo log to the datafiles.
    But if your UNDO tablespace crashed, then you will need recover it, using steps like
    1) shutdown abort (If the instance yet is up)
    2) cp -a /backup/undo01.dbf /u01/oradata (restore the latest recent backup file)
    3) startup mount
    4) recover database or recover datafile '/u01/oradata/undo01.dbf'
    5) alter database open;
    In some cases, re-create it, also resolve the problem:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:5669213349582
    Missing UNDO tablespace in restore backup
    >>I checked in test setup and it is actually waiting for missing UNDO tablespace.
    Which exactly test you are doing?
    Cheers

  • Instance recovery

    SMON process perform instance recovery from online redo log files.
    does this means that data in undo segment, is not available at next instance startup, is it only available in memory?
    if undo data is available in undo tablespace, why redo log files are used to perform instance recovery?

    Tell me did you try find the answer or explanation in documentation first? I don't think so.
    Oracle is one of best documented database (IMHO) and there are still people who are omitting this good documentation (honestly I don't understand why they do that).
    Now back to your question.
    During instance recovery there are two phases:
    rollforward phase (cache recovery) - applying informations from redo logs
    rollback phase (transaction recovery) - rollback all uncommited transactions. This phase uses undo segments (if undo management = auto) or roll back segments (if undo management = manual).
    Maybe you should try read more documentation rather than books with lack explanation.

  • Crash & instance recovery

    what is the difference between crash recovery and instance recovery???

    From http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96519/recov.htm#1004618
    Crash recovery is used to recover from a failure either when a single-instance database crashes or all instances of an Oracle Real Application Clusters database crashes. Instance recovery refers to the case where a surviving instance recovers a failed instance in an Oracle Real Application Clusters database.

  • CheckPoint and  Instance Recovery

    hi,
    what is checkpoint Exactly.How it will Preform Instance Recovery.
    thanks
    with Regards

    hi,
    thanks for reply.I read the documents and books,but i am not clear Exact point so that i have been posting here.
    for example
    semantic checking
    Twq User a,b.Both of them has Emp tables but different Columns.
    user A
    select * from Emp;
    User B
    select * from Emp;
    here i have doubts after B executing the query. how oracle take this, i think is it Semantic.
    I am n't going to learn without Meaning a single word....
    some terms not understanding so i am posting here
    thanks
    with regards

Maybe you are looking for