Monday, April 18, 2016

Teradata HUT lock vs Transaction lock

If we consider these locks only from blocking perspective then behavior of HUT lock and Transaction Lock are same.
  1. For example, 

  2. 1) A read lock prevents another job from claiming a write lock or exclusive lock. 
  3. 2)A write lock prevents a read lock, write lock, or exclusive lock. 
  4. 3) An exclusive lock prevents any other type of lock. 

  5. Conflicting HUT and transaction locks on an object block each other, just as if both were transaction locks or both were HUT locks. 
The two differences between transaction locks and HUT locks are: 

           A transaction lock exists only for the duration of a transaction; after the transaction completes or is                    aborted, the lock is released. A HUT lock is more permanent. It is only removed if an explicit                            RELEASE LOCK command is issued, or if the locking operation completes successfully 

           Transaction lock has session scope
           i.e. it applies to any command submitted by the session running the locking transaction. Another session            running against the same object(s) must claim its own locks, even if it is running under the same user 

           HUT lock has users scope
           i.e. it applies to any Teradata ARC operation that the user is performing on the object. A user must have            only one HUT lock against an object at a time. The HUT lock allows any Teradata ARC operation from            that user to access the locked object(s), but blocks other users from acquiring a conflicting HUT lock on            the object(s). 

Wednesday, April 13, 2016

The difference between copy and restore in teradata

The difference between copy and restore is as below

• A restore operation moves data from archived files back to the same Teradata Database from which it was archived or to a different Teradata Database so long as the database DBC is already restored.

• A copy operation moves data from an archived file back to a Teradata Database, not necessarily to the same system, and creates a new table if one does not already exist on the target database. When a selected partition is copied, the table must exist and be a table that was previously copied as a full-table copy.