Introduction To Oracle
Introduction To Oracle
Introduction To Oracle
range of tasks. It acts as a transparent interface between the physical storage and
the logical presentation of data.It provides a set of more or less flexible and
sofesticated tools for handling
information. Users can use the tools to ·
Define a Database
· Query the Database
· Add,Edit and Delete data.
· Modify the structure of the Database.
· Communicate with in the Networks.
· Exports and Imports the data.
· Security.
1. Database Management.
2. Data access and Manipulation.
3. Programming
4. Connectivity.
Database Management Tools
This (is usually known as RDBMS by oracle) includes the core programs for Oracle's
database management system, the Oracle database with its associated tables and
views, which are stores information related to every fact of the database
system.User name, user access rights, table attribute, storage information and
auditing data for disaster recovery are stored in the data dictionary.
WHY ORACLE ?
Oracle is an open system i.e. the database is accessing by different data access
languages like SQL, Visual Basic, Power Builders,Delphi,VC++,JAVA etc.
Oracle supports database upto gigabytes in size.
* Oracle supports large number of concurrent users.
* Oracle supports true client/server environment.if enable processing to be spilt
between
database server and the client application programs.
* Oracle provides high levelof data security in terms of users, passwords privileges,
and
permissions.
* Oracle database behaves same on all platform line Windows,Unix,Dos,Mainframes
etc.
STRUCTURE OF ORACLE
physical structure:
one or more data files, Two of more log files, One control file.
Logical structure:
Table spaces,
Segments, Extents, Data blocks.
The data files contain all user data in terms of tables, index, and views. The log files
contain the information to open and be recovered, of Undone after a
transaction(Rollback).
The control file physical data, media information to open and manage data files .If
the control file is damaged the server will not be able to open are use the database
even if the
database is undamaged.
What are the Back ground processes in Oracle and what are they. ?
There are basically 9 Processes but in a general system we need to mention the first
five background processes. They do the house keeping activities for the Oracle and
are common in
any system.
a) Data Base Writer(DBWR) :: Data Base Writer Writes Modified blocks from
Database buffer cache to Data Files.This is required since the data is not written
whenever a transaction is commited.
b)LogWriter(LGWR) :: LogWriter writes the redo log entries to disk. Redo Log data is
generated in redo log buffer of SGA. As transaction commits and log buffer fills,
LGWR writes log entries into a online redo
log file.
c) System Monitor(SMON) :: The System Monitor performs instance recovery at
instance startup. This is useful for recovery from system failure.
d)Process Monitor(PMON) :: The Process Monitor peforms process recovery when
user Process fails. Pmon Clears and Frees resources that process was using.
e) CheckPoint(CKPT) :: At Specified times, all modified database buffers in SGA are
written to data files by DBWR at Checkpoints and Updating all data files and control
files of database to indicate the
most recent checkpoint.
f)Archieves(ARCH) :: The Archiver copies online redo log files to archival storal when
they are busy. g) Recoveror(RECO) :: The Recoveror is used to resolve the
distributed transaction in network h) Dispatcher (Dnnn) :: The Dispatcher is useful in
Multi Threaded Architecture i) Lckn :: We can have upto 10 lock processes for inter
instance locking in parallel sql.
NORMALIZATION
Normalization is carried out for four reasons: · To Structure the data so that any
pertinent relationships between entities can be represented. · To permit simple
retrieval of data in response to query and report requests.
· To simplify the maintenance of the data through updates, insertions, and deletion
· To reduce the need to restructure or reorganize data when new application
requirements arise. · Normalization can improve the quality of design for an
application.
There are totally Five Normal Forms(Rules) out of which, any database should
necessarily satisfy
three of them, those Three Normal Forms are as follows:
First normal form is achieved when all repeating groups are removed so that a
record is of fixed length. A repeating group, the re-occurrence of a data item within a
record, is actually
another relation. Hence, it is removed from the record and treated as an additional
record structure,
or relation.
Second Normal form should be in first normal form and no partial dependency
exists. Means if we have a composite primary key(combination of 2 or more fields)
then all the non keys
must depend on the composite primary key. no attribute should depend upon the
part of key.(for
example if Rollno and SSno is a composite key, then no other field in that particular
table should
be depedent upon either Rollno or ssno individually)
Third Normal form is achieved when Transitive Dependencies are removed from a
record design.
The general case is as follows :
A,B and C are three data items in a record. If C is functionally dependent on B (2nd
N.F) and
B is functionally dependent on A Then C is functionally dependent on A Therefore, a
Transitive
Dependency exists. In data management, transitive dependency is a concern
because data can inadvertently be lost when the relationship is hidden. In the
general case above, if A is deleted, then B and C are
deleted also, whether or not this is intended. This problem is eliminated by designing
the record
for third normal form. Conversion to third normal form removes the transitive
dependency by
splitting the relation into two separate relations.
BCNF must be 3NF and every determinant is a candidate key. Candidate key is other
than primary key, which uniquely identify each row in the table.
for example ssno is PK then rollno becomes Candidate key.
4NF and 5NF are depends on instance. we can not give a proper def. bcz it all
depends on joins. "CODD's 12 RULES" for a fully Relational DBMS
INTRODUCTION According to Elmasri and Navathe (1994), Dr. E. F. Codd, the
originator of the relational data model, published a two-part article in ComputerWorld
(Codd, 1985) that lists 12 rules for
how to determine whether a DBMS is relational and to what extent it is relational.
These rules
provide a very useful yardstick for evaluating a relational system. Codd also
mentions that,
THE 12 RULES
Rule 2: Guaranteed Access Rule Each and every datum (atomic value) in a relational
database is guaranteed to be logically accessible by resorting to a table name,
primary key value, and column name. All Data is uniquely
identified and accessible via this identity.
Rule 3: Systematic Treatment of Null Values Null values (distinct from empty
character string or a string of blank characters and distinct from zero or any other
number) are supported in the fully relational DBMS for representing
missing information in a systematic way, independent of data type.
Rule 4: Dynamic On-line Catalog based on the Relational Model The database
description is represented at the logical level in the same way as ordinary data, so
authorized users can apply the same relational language to its interrogation as they
apply
to regular data.
Rule 6: View Updating Rule All views that are theoretically updateable are also
updateable by the system. Views are virtual tables. They appear to behave as
conventional tables except that they are built
dynamically when the query is run. This means that a view is always up to date. It is
not always
theoretically possible to update views. One problem exists when a view relates to
part of a table
not including a candidate key. This means that potential updates would violate the
entity integrity
rule.
Rule 7: High-level Insert, Update, and Delete The capability of handling a base
relation or a derived relation as a single operand applies not only to the retrieval of
data but also to the insertion, update, and deletion of data. i.e. The user
should be allowed to Delete, Update a set of tuples (rather than row by row)
CONCATENATE, INITCAP, LENGTH, LOWER, UPPER, LPAD, RPAD, LTRIM (removes the
character specified left side of word), RTRIM, SUBSTR (displays values from
specified location onwards), TRANSLATE (for single character), REPLACE (for more
than one
character ),CHR ( prints character of given ASCII value), ASCII (value of given
character ). ABS, CEIL, FLOOR, SQRT, POWER, SIGN, TRUNC, ROUND, EXP, MOD,
LOG, LN, GREATEST, LEAST, SYSDATE, ADD_MONTHS, MONTHS_BETWEEN.
What is a view ?
A view is stored procedure based on one or more tables, it's a virtual table.
What are various privileges that a user can grant to another user ? SELECT,
CONNECT, RESOURCES
What is difference between UNIQUE and PRIMARY KEY constraints ? A table can have
only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The
columns that compose PK are automatically define NOT NULL, whereas a column that
By using DISTINCT
What is difference between SQL and SQL*PLUS ? SQL*PLUS is a command line tool
where as SQL and PL/SQL language interface and reporting tool. Its a command line
tool that allows user to type SQL commands to be executed
directly against an Oracle database. SQL is a language used to query the relational
database(DML,DCL,DDL). SQL*PLUS commands are used to format query result, Set
options,
Edit SQL commands and PL/SQL.
LONG RAW data type is used for storing BLOB's (binary large objects).