Académique Documents
Professionnel Documents
Culture Documents
ORACLE
Introduction
ORACLE
It is a DBMS, which manages a large amount of data in a multi user environment so that many users concurrently access the data. It Also provides security and Recovery. It stores and manages data using relational model. Oracle is the name of database management system developed by Oracle corporation.
ORACLE
ORACLE
Entry Level Technology Program
Oracle server manages data in the database. Users access Oracle server using SQL commands. So Oracle server receives SQL commands from users and execute them on the database. SQL commands
CLIENT Result Database CLIENT
Satyam Learning Center ORACLE
ORACLE SERVER
DATABASE ARCHITECTURE
Entry Level Technology Program
U1
U2
VL
SHADOW PAGE .. .. ..
.. .. .. T1
.. .. ..
.. .. ..
LL
T2
PL
ORACLE
Physical Level
Entry Level Technology Program
The Physical structure of the database is placed in Physical level. It is physically a set of operating system files. There are 3 types. Data Files
ORACLE
Physical structure
Entry Level Technology Program
Data Files It contains the data of the database. Every table that is stored in the database is a part of these files. Only Oracle Server can interpret these data files.
Redo Log Files Every database has a set of two or more Redo Log files. The set of redo log files is known as databases redo log. Redo Log files are used in failure recovery.
All changes made to the database are written to redo log file.. ( filenames redo01.log)
ORACLE
Physical Structure
Entry Level Technology Program
Control Files Every Oracle database has a control file. It contains vital data regarding the database. It contains ( Extension of file is ctl)
Database Name
ORACLE
Logical Structure
Entry Level Technology Program
Logical Structure is independent of Physical structure. Each Oracle database contains the following components. oTablespaces oSegments
oExtents
oBlocks
ORACLE
Tablespace
Entry Level Technology Program
Each Database is a collection of tablespaces.For example we can use a table space called PAYROLL to store all the data related to payroll application. Every database contains SYSTEM tablespace. This is automatically created when a database is created. SYSTEM tablespace contains the data dictionary tables. It is possible to make tablespace temporarily unavailable by making it off-line and make it available again by changing it to on-line.By making a tablespace off-line, DBA can take the backup.
ORACLE
SEGMENTS
Entry Level Technology Program
Data into tablespaces comes in the form of segments. Example Table is a segment An Oracle database requires upto 4 types of segments Data segments Index Segments It is used to store data of tables used to store indexes
ORACLE
Extents
Entry Level Technology Program
The storage space is allocated to segments is in the form of Extents.Each Tablespace contains 65536 data files N number of such Table spaces creates a database. An extent is made with in a data file N Number of continuous db blocks make up an Extent Table Table Segment Table space
ORACLE
Extents
QUERY PROCESS
Entry Level Technology Program
1 2 3
3 2
SERVER PROCESS
DB
CLIENT PROCESS
CLIENT
ORACLE
Oracle Instance
Entry Level Technology Program
. Every oracle database is associated with an Oracle Instance. Every time a database is started, a memory area called System Global Area(SGA) or Shared Global Area is allocated and one or more processes are started.
ORACLE
ORACLE
Scalability One Management Interface
9i
INTERNET
Reliability
Single Dev Model
Satyam Learning Center ORACLE
Features
Entry Level Technology Program
Oracle Offers a comprehensive high performance infrastructure for e-business.It is called Oracle9i.It provides every thing needed to develop, deploy and manage Internet Applications. Benefits Scalability from departments to enterprise e-business sites Reliable, available and secure architecture
9i Products
Entry Level Technology Program
There are two products. They provide a complete and simple infrastructure for internet applications.
IAS
DATABASE
9i
Satyam Learning Center ORACLE
9i
Application Server
Entry Level Technology Program
9i Application server runs all the applications and 9i database stores our data. Oracle 9i Application server runs Portals or web sites
ORACLE
Oracle9i : OORDBMS
Entry Level Technology Program
User-Defined data types and objects Fully compatible with relational database Support of multimedia and Large objects It also support client server and web based applications Oracle 9i can scale tens of thousands of concurrent users and support up to 512 petabytes of data ( A peta byte is 1000 tera bytes)
ORACLE
Environment
Entry Level Technology Program
Oracle uses two types of Environments for executing our SQL statements. SQL*plus and iSQL*plus. iSQL*plus is oAn Environment
oOracle proprietary
oKeywords can be abbreviated oRuns on a browser
Tools of Oracle
Entry Level Technology Program
ORACLE
SQL commands
Entry Level Technology Program
Data Definition Language (DDL) : CREATE, ALTER, DROP, TRUNCATE Data Manipulation Language (DML) : INSERT, UPDATE, DELETE Transaction Control Language (TCL) : COMMIT, ROLLBACK, SAVEPOINT Data Retrieval Language (DRL) : SELECT Data Control Language (DCL) : GRANT, REVOKE
ORACLE
Data Types
Entry Level Technology Program
VARCHAR2(size) bytes) CHAR (size) chars NUMBER (p,s) DATE LONG GB CLOB
Data Type
Variable-length character data(4000 Fixed-length character data up to 2000 Variable-length numeric data Date and time values Variable-length character data upto 2 Character data up to 4 GB Raw binary data (Raw is 2000 bytes and Long Raw is 4 GB)
ORACLE
Description
Data Types
Entry Level Technology Program
BLOB BFILE
NVARCHAR2(size)
Variable-length character data(4000 bytes/chars) depending upon National Character Set TIMESTAMP (precision) Date plus time
ORACLE
ORACLE
SELECT FROM
ORACLE
DESC[RIBE] DEPT
ORACLE
SQL statements are not case sensitive. SQL statements can be on one or more lines. Keywords cannot be abbreviated or split across lines. Clauses are usually placed on separate lines. Indents are used to enhance readability.
ORACLE
ORACLE
null is a value that is unavailable, unassigned, unknown, or inapplicable. A null is not the same as zero or a blank space.
ORACLE
ORACLE
A column alias: Renames a column heading Is useful with calculations Immediately follows the column name - there can also be the optional AS keyword between the column name and alias Requires double quotation marks if it contains spaces or special characters or is case sensitive
ORACLE
ORACLE
Concatenation Operator
Entry Level Technology Program
A concatenation operator: Concatenates columns or character strings to other columns Is represented by two vertical bars (||) Creates a resultant column that is a character expression
ORACLE
SELECT FROM
ORACLE
A literal is a character, a number, or a date included in the SELECT list. Date and character literal values must be enclosed within single quotation marks. Each character string is output once for each row returned.
ORACLE
ORACLE
Duplicate Rows
Entry Level Technology Program
ORACLE
Eliminate duplicate rows by using the DISTINCT keyword in the SELECT clause.
ORACLE
ORACLE
Objectives
Entry Level Technology Program
After completing this lesson, you should be able to do the following: Limit the rows retrieved by a query Sort the rows retrieved by a query
ORACLE
ORACLE
WHERE DEPTNO = 30 ;
ORACLE
Character strings and date values are enclosed in single quotation marks. Character values are case sensitive, and date values are format sensitive. The default date format is DD-MON-RR.
ORACLE
Comparison Conditions
Entry Level Technology Program
Meaning Equal to Greater than Greater than or equal to Less than Less than or equal to Not equal to
ORACLE
ORACLE
IN(set)
LIKE IS NULL
ORACLE
SELECT ENAME, SAL FROM WHERE EMP SAL BETWEEN 2500 AND 3500;
ORACLE
MGR
ORACLE
Use the LIKE condition to perform wildcard searches of valid search string values. Search conditions can contain either literal characters or numbers:
ORACLE
You can use the ESCAPE identifier to search for the actual % and _ symbols.
ORACLE
FROM
WHERE
EMP
MGR IS NULL;
ORACLE
Logical Conditions
Entry Level Technology Program
Operator AND OR
Meaning Returns TRUE if both component conditions are true Returns TRUE if either component condition is true Returns TRUE if the following condition is false
NOT
ORACLE
FROM
WHERE AND
EMP
SAL >=10000 JOB LIKE '%MAN%';
ORACLE
WHERE
OR
ORACLE
FROM
EMP
WHERE
JOB
ORACLE
Rules of Precedence
Entry Level Technology Program
Order Evaluated 1 2 3 4 5 6 7 8
Operator Arithmetic operators Concatenation operator Comparison conditions IS [NOT] NULL, LIKE, [NOT] IN [NOT] BETWEEN NOT logical condition AND logical condition OR logical condition
ORACLE
Rules of Precedence
Entry Level Technology Program
SELECT ENAME, JOB, SAL FROM WHERE OR EMP JOB = 'SALESMAN' JOB = 'PRESIDENT'
AND
ORACLE
Rules of Precedence
Entry Level Technology Program
ORACLE
ORDER BY Clause
Entry Level Technology Program
SELECT FROM
ORDER BY HIREDATE ;
ORACLE
SELECT
FROM
EMP
ORACLE
ORDER BY annsal;
ORACLE
FROM
EMP
ORACLE
Summary
Entry Level Technology Program
ORACLE
Exercise
Entry Level Technology Program
1) 2) 3) 4) 5) 6)
Display the names with single word Display the names with two words Display the names with exactly three words Display all the salaries beginning with digit 2 Display all the names with second letter as A Display the employees who joined between any two given dates 7) Display the names and experience of all the employees 8) How many employees does not draw salary between 5000 and 10000 9) Display all the names whose names contain underscore(_) 10)Calculate the experience in years for each employee and display along with their names, in descending order.
ORACLE