0% found this document useful (0 votes)
23 views28 pages

DMS Unit 5

Uploaded by

dixaxi2767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views28 pages

DMS Unit 5

Uploaded by

dixaxi2767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Chapter 5

Database Security and transaction


processing
Different types of Database Users
1.Database Administrator (DBA) :
Database users are categorized based up on their interaction with the
data base.These are seven types of data base users in DBMS.
Database Administrator (DBA) :
Database Administrator (DBA) is a person/team who defines the schema
and also controls the 3 levels of database.
The DBA will then create a new account id and password for the user if
he/she need to access the data base.
DBA is also responsible for providing security to the data base and he
allows only the authorized users to access/modify the data base.
• DBA also monitors the recovery and back up and provide
technical support.
• The DBA has a DBA account in the DBMS which called a system or
superuser account.
• DBA repairs damage caused due to hardware and/or software
failures.
2.Naive / Parametric End Users :
Parametric End Users are the unsophisticated who don’t have any DBMS
knowledge but they frequently use the data base applications in their daily
life to get the desired results.For examples, Railway’s ticket booking users
are naive users. Clerks in any bank is a naive user because they don’t have
any DBMS knowledge but they still use the database and perform their
given task.

3.System Analyst :
System Analyst is a user who analyzes the requirements of parametric end
users. They check whether all the requirements of end users are satisfied.

4.Sophisticated Users :
Sophisticated users can be engineers, scientists, business analyst, who are
familiar with the database. They can develop their own data base
applications according to their requirement. They don’t write the program
code but they interact the data base by writing SQL queries directly
through the query processor.
5,Data Base Designers :
Data Base Designers are the users who design the
structure of data base which includes tables, indexes,
views, constraints, triggers, stored procedures. He/she
controls what data must be stored and how the data
items to be related.

6.Application Program :
Application Program are the back end programmers who
writes the code for the application programs.They are the
computer professionals. These programs could be written
in Programming languages such as Visual Basic, Developer,
C, FORTRAN, COBOL etc.
Types of privileges

System privileges Object Privileges

system: This includes permissions for creating session,


table, etc and all types of other system privileges.

Object: This includes permissions for any command or


query to perform any operation on the database tables.
How to Create a New User
In editing in MySQL as the root user, with full
access to all of the databases. However, in
cases where more restrictions may be required,
there are ways to create users with custom
permissions.
•CREATE USER username' IDENTIFIED BY 'password';
In DCL we have two commands,

•GRANT: Used to provide any user access privileges or other


priviliges for the database.

•REVOKE: Used to take back permissions from any user.

Role:

User Roles. A role groups several privileges and roles, so that they can
be granted to and revoked from users simultaneously. A role must be
enabled for a user before it can be used by the user. Oracle provides
some predefined roles to help in database administration.
Transaction
A transaction is a unit of work that is performed
against a database. Transactions are units or
sequences of work accomplished in a logical order,
whether in a manual fashion by a user or automatically
by some sort of a database program.
A transaction is the propagation of one or more
changes to the database. For example, if you are
creating a record or updating a record or deleting a
record from the table, then you are performing a
transaction on that table. It is important to control
these transactions to ensure the data integrity and to
handle database errors.
Properties of Transactions
Transactions have the following four standard properties, usually
referred to by the acronym ACID.

Atomicity − ensures that all operations within the work unit are
completed successfully. Otherwise, the transaction is aborted at the
point of failure and all the previous operations are rolled back to
their former state.

Consistency − ensures that the database properly changes states


upon a successfully committed transaction.

Isolation − enables transactions to operate independently of and


transparent to each other.

Durability − ensures that the result or effect of a committed


transaction persists in case of a system failure.
Transaction Control
The following commands are used to control
transactions.
COMMIT − to save the changes.
ROLLBACK − to roll back the changes.
SAVEPOINT − creates points within the groups
of transactions in which to ROLLBACK.
.
States of Transactions
States of Transactions

Active − In this state, the transaction is being executed. ...

Partially Committed − When a transaction executes its


final operation, it is said to be in a partially
committed state.

Failed − A transaction is said to be in a failed state if any


of the checks made by the database recovery system fails.
Physical Backup

The operating system saves the database files onto tape or some other media. This
is useful to restire the system to an earlier point whenever needed.

Logical Backup
In logical backup technique, the IMPORT/EXPORT utilities are used to create the
backup of the database. A logical backup backs-up the contents of the database. A
logical backup can be used to restore the database to the last backup. However,
unlike physical back, it should not be used to create an OS back up copy because
restoring using this approach would make it possible to correct the damaged
datafiles. Therefore in these situations physical backups should be preferred.
Database recovery

Database recovery is the process of restoring


the database to a correct (consistent) state in
the event of a failure. In other words, it is the
process of restoring the database to the most
recent consistent state that existed shortly
before the time of system failure.
Log-based Recovery
Deferred database modification − All logs are
written on to the stable storage and the database is
updated when a transaction commits.
Immediate database modification − Each log follows
an actual database modification.

That is, the database is modified immediately after


every operation.
Checkpoint :

Checkpoint is a mechanism where all the previous


logs are removed from the system and stored
permanently in a storage disk.

Checkpoint declares a point before which the


DBMS was in consistent state, and all the
transactions were committed.
Shadow Paging recovery
Shadow Paging is recovery technique that is used to
recover database. In this recovery technique, database is
considered as made up of fixed size of logical units of storage which
are referred as pages. pages are mapped into physical blocks of
storage, with help of the page table which allow one entry for each
logical page of database. This method uses two page tables
named current page table and shadow page table. The entries
which are present in current page table are used to point to most
recent database pages on disk. Another table i.e., Shadow page
table is used when the transaction starts which is copying current
page table. After this, shadow page table gets saved on disk and
current page table is going to be used for transaction. Entries
present in current page table may be changed during execution but
in shadow page table it never get changed. After transaction, both
tables become identical. This technique is also known as Cut-of-
Place updating.
To understand concept, consider above figure. In this 2 write operations are
performed on page 3 and 5. Before start of write operation on page 3, current page
table points to old page 3. When write operation starts following steps are performed
:
Firstly, search start for available free block in disk blocks.
After finding free block, it copies page 3 to free block which is represented by Page 3
(New).
Now current page table points to Page 3 (New) on disk but shadow page table points
to old page 3 because it is not modified.
The changes are now propagated to Page 3 (New) which is pointed by current page
table.
COMMIT Operation : To commit transaction following steps should be done :
All the modifications which are done by transaction which are present in buffers are
transferred to physical database.
Output current page table to disk.
Disk address of current page table output to fixed location which is in stable storage
containing address of shadow page table. This operation overwrites address of old
shadow page table. With this current page table becomes same as shadow page table
and transaction is committed.
Data Warehouse

A Data Warehouse (DW) is a relational database


that is designed for query and analysis rather
than transaction processing. It includes historical
data derived from transaction data from single
and multiple sources.
A Data Warehouse provides integrated,
enterprise-wide, historical data and focuses on
providing support for decision-makers for data
modeling and analysis.
Subject-Oriented
A data warehouse target on the modeling and analysis of data for decision-makers.
Therefore, data warehouses typically provide a concise and straightforward view around a
particular subject, such as customer, product, or sales, instead of the global organization's
ongoing operations. This is done by excluding data that are not useful concerning the
subject and including all data needed by the users to understand the subject.
Integrated
A data warehouse integrates various heterogeneous data sources like RDBMS, flat files,
and online transaction records. It requires performing data cleaning and integration
during data warehousing to ensure consistency in naming conventions, attributes types,
etc., among different data sources.

Time-Variant
Historical information is kept in a data warehouse. For example, one can retrieve files from
3 months, 6 months, 12 months, or even previous data from a data warehouse. These
variations with a transactions system, where often only the most current file is kept.

Non-Volatile
Non-Volatile defines that once entered into the warehouse, and data should not change.
S.N Data Warehouse Data Mart
0.
1. It is a centralised system. It is not a centralised system.

2. Data warehouse defines a top-down model. Data mart defines a bottom-up model.
Difference between Data Warehouse and Data Mart
3. Slightly denormalization is involved in data warehouses. Highly denormalization is involved in data mart.

4. It is tough to build a data warehouse. It is easy to build a data mart.

5. Fact constellation schema is preferred in data warehouses. Star schema and snowflake schema are preferred
in data mart.

6. It is more flexible as compared to the data mart. It is not flexible.

7. It is data-oriented in behaviour. Data mart is project-oriented in behaviour.

8. They mostly have longer life spans. It has a shorter life span.

9. Here we get the data in a detailed format. Here we get the summarised version of data.

10. The data warehouse is huge in size. It is smaller as compared to the data warehouse.
KDD PROCESS
Data mining is a subset of the KDD process. The KDD
process is a comprehensive approach to extracting
useful knowledge and insights from large datasets,
while data mining is a specific task within the KDD
process that involves finding patterns and
relationships in data using computational algorithms
Data Selection - The first step in the KDD process is identifying and selecting the
relevant data for analysis.
Data Preprocessing - After selecting the data, the next step is data preprocessing. This
step involves cleaning the data, removing outliers, and removing missing,
inconsistent, or irrelevant data.
Data Transformation - Once the data is preprocessed, the next step is to transform it
into a format that data mining techniques can analyze.
Data Mining - This is the heart of the KDD process and involves applying various data
mining techniques to the transformed data to discover hidden patterns, trends,
relationships, and insights.
Pattern Evaluation - After the data mining, the next step is to evaluate the discovered
patterns to determine their usefulness and relevance.
Knowledge Representation - This step involves representing the knowledge extracted
from the data in a way humans can easily understand and use. This can be done
through visualizations, reports, or other forms of communication that provide
meaningful insights into the data.
Deployment - The final step in the KDD process is to deploy the knowledge and
insights gained from the data mining process to practical applications.
Difference between RDBMS and MongoDB:
RDBMS MongoDB

It is a non-relational and document-


It is a relational database. oriented database.
Not suitable for hierarchical data
Suitable for hierarchical data storage.
storage.
It is horizontally scalable i.e we can add more
It is vertically scalable i.e increasing RAM.
servers.

It has a predefined schema. It has a dynamic schema.

It is quite vulnerable to SQL injection. It is not affected by SQL injection.

It is row-based. It is document-based.

It is slower in comparison with MongoDB. It is almost 100 times faster than RDBMS.

Supports complex joins. No support for complex joins.

It is column-based. It is field-based.

It does not provide JavaScrip t client for


It provides a JavaScript client for querying.
querying.
Difference between DynamoDB and MongoDB

Feature DynamoDB MongoDB


Database
NoSQL, document-oriented NoSQL, document-oriented
Type
Data Model Key-value store Document store

Scalability Auto-scaling with built-in sharding Auto-scaling with built-in sharding

ACID ACID-compliant for single-item


Not fully ACID-compliant
Compliance updates

Limited query language and support Rich query language and flexible
Querying
for secondary indexes indexing

Data Strong consistency model for read Eventual consistency model for read and
Consistency and write operations write operations

Geospatial
No support for geospatial data Supports geospatial data
Data
Supports transactions across multiple
Transactions Supports multi-document transactions
tables
Free community version or paid
Pay-per-request or provisioned
Pricing enterprise version with multiple pricing
capacity
options

You might also like