What is a Teradata Rollback?

A rollback reverses an incomplete transaction. Transactions can be unfinished for various reasons, such as user termination or database restart. Rollback ensures database integrity and is an essential aspect of an RDBMS. Rollbacks are implemented in Teradata using the DBC.TransientJournal table. A Before Image is stored in this table, i.e., before any changes are made.

What is the impact of a Teradata rollback on performance?

Rolling back many rows can negatively impact performance because it requires a lot of CPU. Furthermore, the table on which the rollback occurs can be locked for a long time. We know cases where the table was locked for days! Rollback needs to find a middle ground between the duration of the lock and the resources used.

How can rollbacks in Teradata be avoided?

Many rows should be deleted by multi-load since no transient journal is used here. If a table is populated from several source tables, using a multistatement INSERT/SELECT is better. With the Multi statement INSERT/SELECT, the Transient Journal only notes that the target table is empty.

How to Abort the Teradata Rollback

Executing a DML statement on a sizable table may trigger a prolonged ROLLBACK. In such cases, you must choose between waiting for the ROLLBACK to complete or terminating it.

Cancelling a rollback avoids wasting additional resources, particularly when the system cannot run in parallel due to high skew, which affects the entire workload.

Careful consideration is crucial, as the table in question may become inconsistent and practically unusable. Therefore, a ROLLBACK should only be terminated in the following cases:

  • The ROLLBACK is expected to take longer than restoring the table
  • It is a table that is only used temporarily and is therefore insignificant and can be rebuilt at any time

A practical example of Teradata Cancel Rollback

Assuming the execution of the following SQL statement on the DWHPRO.NUSI_TEST table, with a total of 100 million rows:

UPDATE DWHPRO.NUSI_TEST SET COL2 = 1 WHERE COL2 <= 80

After an additional hour of waiting, the task remains incomplete. Upon reviewing the Viewpoint, it becomes apparent that the ROLLBACK process is imbalanced and only completed on one AMP.

The table is only temporary, so it is not crucial to our operations. However, performing a ROLLBACK on an AMP will disrupt the parallelism of the Teradata system. Consequently, we choose to forego the ROLLBACK.

Teradata Cancel Rollback – Checklist

These are the necessary steps to follow:

Teradata Cancel Rollback in detail

On the Linux console, we execute the following command to see if a ROLLBACK is in progress at all:

awtmon 1 100
The first parameter is the interval (in seconds) in which the AMPs are tested. The second parameter determines how often the AMPs are tested in a loop (100 times).

Starting the Database Window

To do this, execute the following command in the Linux shell:
xdbw

Starting the Recovery Managers (rcvmanager)

Click on the icon “rcvmanager” to open the window to cancel the ROLLBACK (in the graphic above, it is the icon on the left side). The following window opens:

List the tables in ROLLBACK status

Type list rollback tables; (where it says “Enter a command”). Don’t forget the semicolon.

You get a list with TableID, database, and table name of the tables with the status “ROLLBACK”. Ours has the TableId “0000:0FF8”.

You can also see how many rows are still in the transient journal (TJ rows left) and how many have already been rolled back (TJ rows done), as well as an estimate of the expected runtime (to be used with caution, especially with solid skew)

Termination of the ROLLBACK

To cancel the ROLLBACK, you have to execute the following command:
cancel rollback on table 0000:0FF8

Confirm with ‘y’ that you want to cancel the rollback, and you will get the message “Rollback on “DATABASE”.”TABLE” is canceled.

You will also be reminded that the table is invalidated and only limits its use to a few cases.

What activities can be performed on the table after canceling the ROLLBACK?

  • DELETE DWHPRO.NUSI_TEST
  • The rebuilding of the table headers
  • DROP TABLE DWHPRO.NUSI_TEST
  • Restore the table from an archive
  • Dump the table into an archive

If you try to query the table, you will get this error message:

SELECT * FROM DWHPRO.NUSI_TEST;
SELECT Failed: [7562] Invalid operation on table DWHPRO.NUSI_TEST.

After deleting all rows, it can be used as usual again:

DELETE FROM DWHPRO.NUSI_TEST;
SELECT * FROM DWHPRO.NUSI_TEST;
SELECT completed. 0 Rows returned. Elapsed time = 00:00:00

Final Considerations

Teradata CANCEL ROLLBACK is a way of ending a ROLLBACK in an emergency.

Do not use this option casually, as it will make the table inoperable. Prior to taking this severe action, consult the recovery manager to ascertain the remaining rows in the Transient Journal and the rate at which they are decreasing.

  • … [Trackback]

    […] There you will find 2680 more Infos: dwhpro.com/teradata-cancel-rollback/ […]

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    You might also like

    >