Rdbms Ass
Rdbms Ass
A database view is a logical table query that permits the database architect to
create a special view of data without having to have a larger complex query
used each time. This makes the query run faster than even using prepared
statements.
For example, you might create a view to show the last 10 blog posts, which
would allow you to simply say:
instead of
select * from post order by post date desc limit 10 where public = true and
owner id = 5
As you can see, using a view can greatly the preparation time of a query, and
also allows you to change the implementation of the underlying view without
having to go to each place where that query takes place and update the code
multiple times.
Various database management system have extended the views from read-only
subsets of data
The normal forms (abbrev. NF) of relational database theory provide criteria for
determining a table's degree of vulnerability to logical inconsistencies and
anomalies. The higher the normal form applicable to a table, the less vulnerable
it is to inconsistencies and anomalies. Each table has a "highest normal form"
(HNF): by definition, a table always meets the requirements of its HNF and of
all normal forms lower than its HNF; also by definition, a table fails to meet the
requirements of any normal form higher than its HNF.
The normal forms are applicable to individual tables; to say that an entire
database is in normal form n is to say that all of its tables are in normal form n.
System privileges
Schema object privileges
System Privileges
Table
View
Sequence
Procedure
Function
Package
Different object privileges are available for different types of schema objects.
For example, the privilege to delete rows from the departments table is an object
privilege.
Some schema objects, such as clusters, indexes, triggers, and database links, do
not have associated object privileges. Their use is controlled with system
privileges. For example, to alter a cluster, a user must own the cluster or have
the ALTER ANY CLUSTER system privilege.
A schema object and its synonym are equivalent with respect to privileges. That
is, the object privileges granted for a table, view, sequence, procedure, function,
or package apply whether referencing the base object by name or using a
synonym.
You grant privileges to users so these users can accomplish tasks required for
their job. You should grant a privilege only to a user who absolutely requires
the privilege to accomplish necessary work. Excessive granting of unnecessary
privileges can compromise security. A user can receive a privilege in two
different ways:
You can grant privileges to users explicitly. For example, you can
explicitly grant the privilege to insert records into the employees table to
the user SCOTT.
You can also grant privileges to a role (a named group of privileges), and
then grant the role to one or more users. For example, you can grant the
privileges to select, insert, update, and delete records from the employees
table to the role named clerk, which in turn you can grant to the users .
Because roles allow for easier and better management of privileges, you
should normally grant privileges to roles and not to specific users.
Only users who have been granted a specific system privilege with the ADMIN
OPTION or users with the system privileges GRANT ANY PRIVILEGE or
GRANT ANY OBJECT PRIVILEGE can grant or revoke system privileges to
other users. Schema object privileges can be granted to and revoked from users
and roles. If you grant object privileges to roles, you can make the privileges
selectively available. Object privileges for users and roles can be granted or
revoked using the following:
If the referring pages must also be updated via shadow paging, this procedure
may recurse many times, becoming quite costly. One solution, employed by the
WAFL file system is to be lazy about making pages durable (i.e. write-behind
caching). This increases performance significantly by avoiding many writes on
hotspots high up in the referential hierarchy (eg: a file system superblock) at the
cost of high commit latency.
Write ahead logging is a more popular solution that uses in-place updates.
Shadow paging is similar to the old master-new master batch processing
technique used in mainframe database systems. In these systems, the output of
each batch run (possibly a day's work) was written to two separate disks or other
form of storage medium. One was kept for backup, and the other was used as
the starting point for the next day's work.
Shadow paging is also similar to purely functional data structures, in that in-
place updates are avoided.
- To commit a transaction :
* Flush all modified pages in main memory to disk.
* Output current page table to disk.
* Make the current page table the new shadow page table, as follows:
1. Keep a pointer to the shadow page table at a fixed (known) location on disk.
2. To make the current page table the new shadow page table, simply update the
pointer to point to current page table on disk.
- Once pointer to shadow page table has been written, transaction is committed.
- No recovery is needed after a crash: New transactions can start right away,
using the shadow page table.
- Pages not pointed to from current/shadow page table should be freed (garbage
collected).
Protocol layer implements the external interface to SQL Server. All operations
that can be invoked on SQL Server are communicated to it via a Microsoft-
defined format, called Tabular Data Stream (TDS). TDS is an application layer
protocol, used to transfer data between a database server and a client. Initially
designed and developed by Sybase Inc. for their Sybase SQL Server relational
database engine in 1984, and later by Microsoft in Microsoft SQL Server, TDS
packets can be encased in other physical transport dependent protocols,
including TCP/IP, Named pipes, and Shared memory. Consequently, access to
SQL Server is available over these protocols. In addition, the SQL Server API is
also exposed over web services.
Data storage
The main unit of data storage is a database, which is a collection of tables with
typed columns. SQL Server supports different data types, including primary
types such as Integer, Float, Decimal, Char (including character strings), Var
char (variable length character strings), binary (for unstructured blobs of data),
Text (for textual data) among other
Buffer management
SQL Server buffers pages in RAM to minimize disc I/O. Any 8 KB page can be
buffered in-memory, and the set of all pages currently buffered is called the
buffer cache. The amount of memory available to SQL Server decides how
many pages will be cached in memory. The buffer cache is managed by the
Buffer Manager. Either reading from or writing to any page copies it to the
buffer cache. Subsequent reads or writes are redirected to the in-memory copy,
rather than the on-disc version.
ORACLE SERVER
the Oracle Application Server 10g (the "g" stands for grid), consists of an
integrated, standards-based software platform. It forms part of Oracle
Corporation's Fusion Middleware technology stack. The heart of Oracle
Application Server consists of Oracle HTTP Server (based on Apache HTTP
Server) and OC4J (Oracle AS Containers for Java EE) which deploys Java EE-
based applications. The latest version of OC4J offers full compatibility with the
Java EE 1.4 specifications.
Oracle Application Server became the first platform designed for grid
computing as well as with full life-cycle support for service-oriented
architecture (SOA).
The current release of Oracle Application Server, 10g R3, does not feature a
metadata repository tier, relying instead on metadata repositories provided in
previous releases.
Database Buffering
Q8. What are triggers? How are they differ from a insertion?
Triggers are special kind of stored procedures that get executed automatically
when an INSERT, UPDATE or DELETE operation takes place on a table.
Triggers are generally used to implement business rules, auditing. Triggers can
also be used to extend the referential integrity checks, but wherever possible,
use constraints for this purpose, instead of triggers, as constraints are much
faster. There are many types of triggers available. To state a
few are namely:
Row-Level Triggers
Statement-Level Triggers
Before Trigger
After Trigger
Schema Triggers
Database level Triggers