Recovery Journal


The Teradata database uses Recovery Journal to automatically maintain data integrity in the case of :

  • An interrupted transaction
  • An AMP failure

Recovery Journals are created, maintained and purged by the system automatically, so no DBA intervention is required. Recovery journal are tables stored in the storage medium so they take up the disk space on the system.

There are three types of Recovery Journal in Teradata-

  1. Transient Journal
  2. Down – AMP Recovery Journal
  3. Permanent Journal

Now we look on each of the recovery journal in details –


Transient Journal

A transient journal maintains data integrity when in-flight transactions are interrupted. Data is returned to its original state after transaction failure.

A transient journal is used during normal system operation to keep “before images” of changed rows so the data can be restored to its previous state if the transaction is not completed. This happens on each AMP as changes occur. When a transaction is started, the system automatically stores a copy of all the rows affected by the transaction in the transient journal until the transaction is completed. Once the transaction is completed the “before images” are purged.

In the event of transaction failure, the “before images” are reapplied to the affected tables and deleted from the journal, and the “rollback” operation is completed.

Down AMP Recovery Journal

The down AMP recovery journal allows continued system operation while an AMP is down. A down AMP recovery journal is used with fallback protected tables to maintain a record of write transactions (updates, creates, inserts, deletes, etc) on the failed AMP while it is unavailable.

The Down AMP recovery journal starts automatically after the loss of an AMP in a cluster. Any changes to the data in the failed AMP are logged into the Down AMP recovery journal by the other AMPs in the cluster. When the failed AMP is brought back online, the restart process includes applying the changes in the Down – AMP recovery journal to the recovered AMP.

The journal is discarded once the process is complete, and the AMP is brought online, fully recovered.

Permanent Journal

Permanent Journals are an optional feature used to provide an additional level of data protection. You specify the use of permanent journal at the table level. It provides full-table recovery to a specific point in time. It can also reduce the need for costly and time – consuming full table backups.

Permanent journals are tables stored on disk array like user data is, so they can take up additional disk space, on the system. The database administrator maintains the permanent journal entries (deleting, archiving, and so on).A database can have one permanent journal.

When you create a table with permanent journaling, you must specify whether the permanent journal will capture.

  • Before images – for rollback to “undo” a set of changes to a previous state.
  • After images – for roll forward to “redo” to a specific state.

Following is the syntax of giving permanent journal –


CREATE DATABASE teradatatech
FROM space_amount AS
PERM = 4000000    /* permanent space */
SPOOL = 2000000 /* spool space */
NO FALLBACK
ACCOUNT = ‘$admin’
NO BEFORE JOURNAL
AFTER JOURNAL
DEFAULT JOURNAL TABLE = teradata.journal;
Here Admin has opted   for only AFTER JOURNAL and he has name the journal table as “teradata.journal”.
When user creates a table in the database “teradatatech” , by default AFTER JOURNAL is available for him to protect his data when the hardware failure occurs.

He can opt for NO AFTER JOURNAL by overriding the default.

Scenario1 : Here  by default the table has AFTER JOURNAL option.

CREATE TABLE table_name
( field1 INTEGER,
field2 INTEGER)
PRIMARY INDEX field1;

Scenario2: in this case, user has specifically stated he wanted no AFTER JOURNAL for his data. This is how user can override the defult.

CREATE TABLE table_name
FALLBACK,
NO AFTER JOURNAL
( field1 INTEGER,
field2 INTEGER)
PRIMARY INDEX field1;

In this case whenever the user inserts/updates and the transaction is committed , then the affected rows will be taken backup in the journal table “teradata.journal”

 

 

 

17 comments

Skip to comment form

  1. Hi,

    Here there is something called ‘Fallback” in CREATE table statement, can you please explain about this….

    Thanks,
    Rajagopal

    • admin on May 24, 2014 at 9:32 am
      Author

    Hi All,

    We have started a new special online teradata training batch for developers and DBA profile. For those who are interested to learn teradata can register in this batch. Fees is quite less when you compare it with other batches and biggest advantage is that its a instructor led training batch so you can ask any doubt in the training itself. Also we’ll be covering latest version of Teradata i.e. Teradata 14.10

    Please check following link for more details about this batch –
    http://www.onlineteradatatraining.com/?page_id=96

    Limited Seats. So try to register ASAP.

    • Gopala on April 25, 2014 at 8:48 pm

    Admin

    What is the use of Fallback, i think this also keeps the copy of table data if we have any failure or crash with data is it?

      • admin on May 2, 2014 at 5:38 pm
        Author

      FALLBACK is used for data protection at table level.

    • Moorthy on June 25, 2013 at 3:22 am

    Hi…. i have doubt in below mentioned point
    “The Down AMP recovery journal starts automatically after the loss of an AMP in a cluster. Any changes to the data in the failed AMP are logged into the Down AMP recovery journal by the other AMPs in the cluster”

    But Each AMP will have only access to it’s own disk right?But How other AMPs will bring any changes in Other AMPS?

    Can you clarify on this?

      • yavuz on January 23, 2014 at 1:22 pm

      Did you find the asnwer? I also really wonder how it happens..

      • admin on January 23, 2014 at 2:02 pm
        Author

      Down AMP Recovery journal pulls all modified data from fallback sector of each AMP. Any changes to the base table is reflected in Fallback sector as well, so DARJ keeps on updating this modified data.
      Once AMP is online, first task teradata will do is to update the base table with modified data of DARJ.

    • priyanki on March 27, 2013 at 8:25 pm

    This is the kind of crash course on TD i was looking for..Nice topic n a great Explanation…Thanks

    • Nitin on October 9, 2012 at 5:45 am

    Thanks for sharing the info in such a simple manner.

    • raag on May 31, 2012 at 3:57 pm

    Hi,

    I have a question. if the no after journal is set in the second example, then how the affected data wil be taken backup in journal. i could not understand the difference between no after journal and after journal. can u please explain ?

    • Prasath on April 27, 2012 at 7:09 am

    Concepts are suberbly explained. Thanks.

    • Maria on September 23, 2011 at 3:00 pm

    Hi!
    I’ll take the Teradata 12 soon and I think this website helps a lot with informations about Teradata. Your site is amazing!

    • xinwei on September 6, 2011 at 10:15 am

    Howdy, a splendid read man. Good share. However I’m experiencing issue with ur rss feed. Fail to subscribe to it. Does anyone else obtaining same RSS issue? Anyone who can assist kindly reply. Thnx

      • admin on September 7, 2011 at 11:11 am
        Author

      hi
      There are lot of active RSS subscribers to my blog.

      can u give more details regarding what kind of error your facing

Comments have been disabled.