You are on page 1of 4

Republic of the Philippines

PHILIPPINE STATE COLLEGE OF AERONAUTICS


Piccio Garden, Villamor, Pasay City, Philippines

Name: Catalan, Gabriele Angela L. SECTION: BSAIT 3-1

MODULE 8 SELF-CHECK
1. Explain the following statement: a transaction is a logical unit of work.

A transaction is a logical work unit. Each transaction is a set of logically related


commands that perform a single task and change the database's state from one
consistent to another. A transaction is a logical work unit that includes one or more SQL
statements. An atomic unit is a transaction. All the SQL statements in a transaction can
either be committed (applied to the database) or rolled back (undone from database). A
transaction starts with the first SQL statement that can be executed. A transaction is
committed or rolled back, either explicitly with the Commit or Rollback statements or
implicitly with the DDL statement.

2. What is a consistent database state, and how is it achieved?

All data integrity constraints must be met for the database to be consistent. A
transaction must move the database from one consistent state to another to establish
database consistency. Accepting an incomplete transaction will result in a database
state that is inconsistent. To avoid this, the database management system ensures that
all database activities associated with a transaction are completed before the
transaction is committed to the database.

3. List and discuss the five transaction properties.

a. Atomicity - Atomicity means an entire transaction occurs at a time and


committed or transaction does not do any changes otherwise not at all
happened. For example, when a ticket is booked for a passenger, ticket booking
status has to be updated and payment also happened, while the customer has
got ticket booked and his amount debited in his account

b. Consistency - When a transaction completes, data should be consistent. When a


customer pays a bill to an Internet service provider, the specific amount has to
be credited in the service provider account and the same amount has to be
deducted in the customer account.
Republic of the Philippines
PHILIPPINE STATE COLLEGE OF AERONAUTICS
Piccio Garden, Villamor, Pasay City, Philippines

c. Isolation - Isolation means multiple transaction occurs parallelly without


interfering each other.

d. Durability - When a successful transaction is completed, the data should not


change though there is some failure. While one person moves amounts from one
account to another, changes in each account should not be modified in the case
of system failure.

e. Serializability - is a property that explains that in a multiprogramming


environment, when the operating system is executing multiple transactions,
there is a possibility that one transaction will be added to some other
transactions.

4. What is a transaction log, and what is its function?

As the name implies, the Transaction Log keeps track of all transactions as well as
database changes that occur each day. Because it restores database consistency in the
event of a system failure, it is one of the most important elements in a database. Unless
you are completely certain of the consequences, you should never delete or move your
transaction log.

Functions of Transaction Log:

a. Recovering Individual Transactions - in-case of error in Database Engine such as


loss of the communication with client or issuing a ROLLBACK statement, log
records rollback the modifications done during the incomplete transaction.

b. Recovering Incomplete Transactions as SQL Server begins - in-case of failure in


server running the SQL Server, some of transactions are left incomplete. These
transactions and their modifications are rolled back when SQL Server instance
begins this is done to ensure integrity of the databases.

c. Restoration up to the Point of Failure - You can restore database to point of


failure first restore full database backup then differential database backup and
then leftover transaction log backup up to the point of failure. After restoring
each log backup Database Engine will apply necessary changes recorded in log
file and thereafter roll forward all the transactions.
Republic of the Philippines
PHILIPPINE STATE COLLEGE OF AERONAUTICS
Piccio Garden, Villamor, Pasay City, Philippines

d. Supporting Transactional Replication - Transaction log of every database is


monitored by a Log Reader Agent for purpose of transactional replication.

e. Log Shipping and Database Mirroring - Both processes rely predominantly on


Transaction log. In Log Shipping the active transaction log file of primary
database is sent to multiple destinations by primary server. In Database
Mirroring principal server instance is used for the sending all log records
instantly to mirror server instance.

5. Suppose your database system has failed. Describe the database recovery process and
the use of deferred-write and write-through techniques.

Deferred-Write - The transaction does not immediate update database, instead, only
update log file. Then when transaction reach commit point, it will update the physical
database.

Write-Through - The database is update right away during the transaction execution.

Database Recovery - Reconstructing the contents of all or part of a database from a


backup typically involves two phases: retrieving a copy of the datafile from a backup,
and reapplying changes to the file since the backup from the archived and online redo
logs, to bring the database to a desired SCN since the backup (usually, the present).

Restore - a datafile or control file from backup is to retrieve the file onto disk from a
backup location on tape, disk, or other media, and make it available to the database
server.

Recover - a datafile (also called performing recovery on a datafile), is to take a restored


copy of the datafile and apply to it changes recorded in the database's redo logs. To
recover a whole database is to perform recovery on each of its datafiles.

Database Recovery

 There are many situations in which a transaction may not reach a commit or
abort point.

a. An operating system crash can terminate the DBMS processes


Republic of the Philippines
PHILIPPINE STATE COLLEGE OF AERONAUTICS
Piccio Garden, Villamor, Pasay City, Philippines

b. The DBMS can crash

c. The system might lose power

d. A disk may fail, or other hardware may fail

e. Human error can result in deletion of critical data

 In any of these situations, data in the database may become inconsistent or lost.

 When a transaction completes 30 out of 40 scheduled writes to the database


before the DBMS crashes, the database may be in an inconsistent state because
only part of the transaction was completed.

You might also like