KKW Unit 5 Database Security
KKW Unit 5 Database Security
➢ At a very general level, we can define a database as a persistent collection of related data, where data are facts that have an
implicit meaning.
➢ For instance, an employee's name, social security number, or dates of birth are all facts that can be recorded in a database.
➢ Typically, a database is built to store logically interrelated data representing some aspects of the real world, which must be
collected, processed, and made accessible to a given user population.
➢ The database is constructed according to a data model which defines the way in which data and interrelationships between
them can be represented.
➢ The collection of software programs that provide the functionalities for defining, maintaining, and accessing data stored in
a database is called a database management system (DBMS).
➢ Database security refers to the collective measures used to protect and secure a database or database management software
from illegitimate use and malicious threats and attacks.
➢ It is a broad term that includes a multitude of processes, tools and methodologies that ensure security within a database
environment.
➢ In other word database security is Protecting the database from unauthorized access, alteration or deletion.
➢ The data stored in the database needs to be protected from unauthorized access and spiteful destruction or modification.
➢ Security within the dbms protects the integrity of the data, records and databases.
➢ Major elements of DBMS Security include user authentication, user authorization, encryption of data and/or userid and
password and the auditing user actions.
Confidentiality
A secure system ensures the confidentiality of data. This means that it allows individuals to see only the data they are supposed
to see.
Privacy of Communications
The DBMS should be capable of controlling the spread of confidential personal information such as health, employment, and
credit records.
Authentication
One of the most basic concepts in database security is authentication, which is quite simply the process by which it system
verifies a user's identity, A user can respond to a request to authenticate by providing a proof of identity, or an authentication
token.
Authorization
Authorization is the process through which system obtains information about the authenticated user, including which database
operations that user may perform and which data objects that user may access.
A user may have several forms of authorization on parts of the database. There are the following authorization rights.
• Read authorization allows reading, but not modification, of data.
• Insert authorization allows insertion of new data, but not modification of existing data.
• Update authorization allows modification, but not deletion of data.
• Delete authorization allows deletion of data.
A user may be assigned all, none, or a combination of these types of authorization. In addition to these forms of authorization
for access to data, a user may be granted authorization to modify the database schema:
• Index authorization allows the creation and deletion of indexes.
• Resource authorization allows the creation of new relations.
• Alteration authorization allows the addition or deletion of attributes in a relation.
• Drop authorization allows the deletion of relations.
Integrity
A secure system ensures that the data it contains is valid. Data integrity means that data is protected from deletion and
corruption, both while it resides within the data-case, and while it is being transmitted over the network.
Availability
A secure system makes data available to authorized users, without delay.
The following example creates an external user, who must be identified by an external source before accessing the database:
b) Altering User
If we have create users and need to be able to do things like change their password, and change various attributes for the user.
We use the alter user command for these tasks. Here are some examples of the uses of the alter user command in action:
c) Deleting User
If we are going to create users, we better be able to remove them. The drop user command does just that. The command is as
simple as drop user followed by the user name.
Syntax- Drop User <User Name>;
Example: drop user myuser ;
5.4 Types of database users
1) Naive users: Are unsophisticated users who interact with the system by invoking one of the application programs that have
been written previously. Consider a user who wishes to find her account balance over the World Wide Web. Such a user may
access a form, where she enters her account number. An application program at the Web server then retrieves the account balance,
using the given account number, and passes this information back to the user.
2) Application programmers: Are computer professionals who write application programs. Application programmers can
choose from many tools to develop user interfaces. Rapid application development (RAD) tools are tools that enable an
application programmer to construct forms and reports with minimal programming effort.
3) Sophisticated user: Interact with the system without writing programs. Instead, they form their requests in a database query
language. They submit each such query to a query processor, whose function is to break down DML statements into instructions
that the storage manager understands. Analysts who submit queries to explore data in the database fall in this category.
4) Specialized users: Are sophisticated users who write specialized database applications that do not fit into the traditional
data-processing framework Among these applications are computer-aided design systems, knowledge base and expert systems,
systems that store data with complex data types (for example, graphics data and audio data), and environment - modeling
systems.
5) Database Administrator (DBA): Coordinates all the activities of the database system; the database administrator has a
good understanding of the enterprise’s information resources and needs.
Privileges
• A privilege is permission to access a named object in a prescribed manner
• For example, permission to query a table. Privileges can be granted enable a particular user to connect to the database
System privileges
A system privilege is the right to perform a particular action, on a particular type of object. For example, the privileges to
create tables. The most important system privileges are:
1. create session.
2. create table
3. create view
4. create procedure
5. sysdba
6. sysoper
SYSOPER privilege: allows operations such as: Startup a database, Shutdown a database, Backup a database, Recover a database
and create a database. This privilege allows the user to perform basic operational tasks without the ability to look at user data.
SYSDBA privilege: includes all SYSOPER privileges plus full system privileges (with the ADMIN option), plus 'CREATE
DATABASE' etc.
Object privileges
• An object privilege is a privilege or right to perform a particular action on a specific table, view, sequence, procedure,
function, or package.
• For example, the privilege to delete rows from the table DEPT is an object privilege.
• Object privileges granted for a table, view, sequence, procedure, function, or package apply whether referencing the
base object by name or using a synonym.
Examples:
1. Revoke all Privileges on Emp table FROM user Sachin.
SQL > REVOKE ALL ON EMP FROM Sachin;
The collection of operation that forms single logical unit of work is called as Transaction. This is a program whose execution
accesses & updates contents of database. After every transaction database should be in a Consistent state.
Ex.
Initially, A=500, B=400. Before & after transaction values of A & B must be in Consistent state.
T1:
Read (A);
A=A-50;
Write (A);
Read (B);
B=B+50;
End;
Isolation: Even though multiple transactions may execute concurrently, the system guarantees that, for every pair of transactions
Ti and Tj , it appears to Ti that either Tj finished execution before Ti started, or Tj started execution after Ti finished. Thus, each
transaction is unaware of other transactions executing concurrently in the system.
Durability:Durability refers After a transaction completes successfully, the changes it has made to the database persist, even if
there are system failures.
b]States of Transaction
• Active : This is the initial state; the transaction stays in this state while it is executing
• Partially committed:after the final statement has been executed transaction goes to partially Committed State.
• Failed:after the discovery that normal execution can no longer proceed transaction goes to failed state
• Aborted:after the transaction has been rolled back and the database has been restored to its state prior to the start of the
transaction
➢ Data loss can be caused by many things ranging from computer viruses to hardware failures to file corruption to fire, flood, or
theft (etc).
➢ Database backup is the process of backing up the operational state, architecture and stored data of database software.
➢ It enables the creation of a duplicate instance or copy of a database in case the primary database crashes, is corrupted or is lost.
• Hardware failures: Hardware failures may include memory errors, disk crashes, bad disk sectors, disk full errors and so
on. Hardware failures can also be attributed to design errors, inadequate (poor) quality control during fabrication,
overloading (use of under-capacity components) and wear out of mechanical parts.
• Software failures: Software failures may include failures related to software’s such as, operating system, DBMS software,
application programs and so on.
• Statement Failure :It is referred as the inability of database system to execute given SQL statement
• Media Failure: It occurs when proper data backup not taken on media such as CD, HDD etc. Ex. Disk head crash.
• Application Software Errors: It occurs when any application software fails to take input, resource limitation problem etc.
5.11Causes of Failure
There are many different types of failure that can affect database processing, each of which has to be dealt with in a different
manner. Some failures affect main memory only, while others involve non-volatile (secondary) storage. Among the causes of
failure are:
• System Crashes
• User Error
• Carelessness
• Sabotage (intentional corruption of data)
• Statement Failure
• Application software errors
• Network Failure
• Media Failure
• Natural Physical Disasters
1. Physical Backup:
a) Hot backup: Users can modify the database during a hot backup. Physical Backup Log files of changes made during
the backup are saved, and the logged changes are applied to synchronize the database and the backup copy. A hot
backup is used when a full backup is needed and the service level does not allow system downtime for a cold backup
b) Cold backup: Users cannot modify the database during a cold backup, so the database and the backup copy are
always synchronized. Cold backup is used only when the service level allows for the required system downtime.
2. Logical Backup
• A logical backup copies data, but not physical files, from one location to another.
• A logical backup is used to move or archive a database, tables, or schemas and to verify database structures.
• A full logical backup enables you to copy these items across environments that use different components, such as
operating systems and rule files
• A logical export backup generates necessary Structured Query Language (SQL) statements to obtain all table data that
is written to a binary file.
• A logical export backup does not contain database instance-related information, such as the physical disk location, so
you can restore the same data on another database machine.
• Periodic logical export backups (at least weekly) are recommended in case physical backups fail or the database
machine becomes unavailable.
• When a database disk fails, you can restore the most recent backup, then use roll-forward recovery to restore the
database to the condition it was in before you lost the disk.
• The Roll forward redoes the changes made by a transaction, after the committed transaction and over writes the
changed value once again to ensure consistency.
• To restore a database by using roll-forward recovery, you must already have a backup copy of the database.
• Roll-forward recovery recovers the entire database. You cannot use roll-forward recovery to restore individual tables.