Beruflich Dokumente
Kultur Dokumente
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
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.
DATABASE ARCHITECTURE
U1
U2
VL
SHADOW PAGE .. .. ..
.. .. ..
.. .. ..
.. .. ..
LL
T1
T2
PL
Physical Level
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 Redo log files Control files
Physical structure
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)
Physical Structure
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 Names and locations of data files and redo log files.
Logical Structure
Logical Structure is independent of Physical structure. Each Oracle database contains the following components. Tablespaces Segments Extents Blocks
Tablespace 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 table space. This is automatically created when a database is created. SYSTEM table space contains the data dictionary tables.
It is possible to make table space 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.
BUSINESS INFORMATION MANAGEMENT 2010 Capgemini. All rights reserved. 9 9
SEGMENTS
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
Extents 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
Extents
BUSINESS INFORMATION MANAGEMENT 2010 Capgemini. All rights reserved. 11 11
QUERY PROCESS
1 2 3
3 2
SERVER PROCESS
DB
CLIENT PROCESS
CLIENT
Oracle Instance
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.
11i
INTERNET Reliability Common Skill Sets
Features 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
9i Products There are two products. They provide a complete and simple infrastructure for internet applications.
IAS
DATABASE
9i
9i
Application Server
9i Application server runs all the applications and 9i database stores our data.
Oracle9i : OORDBMS
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)
Environment
Oracle uses two types of Environments for executing our SQL statements. SQL*plus and iSQL*plus. iSQL*plus is An Environment
Oracle proprietary
Keywords can be abbreviated Runs on a browser
Tools of Oracle
SQL commands Data Definition Language (DDL) : CREATE, ALTER, DROP, TRUNCATE Data Manipulation Language (DML) : INSERT, UPDATE, DELETE Transaction Control Language (TCL) : COMMIT, ROLLBACK, SAVEPOINT
Data Types
Data Type VARCHAR2(size) CHAR (size) NUMBER (p,s) DATE LONG CLOB RAW and LONG RAW Description Variable-length character data (4000 bytes) Fixed-length character data up to 2000 chars Variable-length numeric data Date and time values Variable-length character data upto 2 GB Character data up to 4 GB Raw binary data (Raw is 2000 bytes and Long Raw is 4 GB)
BUSINESS INFORMATION MANAGEMENT 2010 Capgemini. All rights reserved. 22 22
Data Types
BLOB
Binary data up to 4 GB
BFILE
NVARCHAR2(size)
SELECT FROM
DESC[RIBE] DEPT
Writing SQL Statements 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.
null is a value that is unavailable, unassigned, unknown, or inapplicable. A null is not the same as zero or a blank space.
Concatenation Operator
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
SELECT FROM
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.
Duplicate Rows
Eliminate duplicate rows by using the DISTINCT keyword in the SELECT clause.
Objectives
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
Character Strings and Dates 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.
SELECT ENAME, JOB, DEPTNO FROM WHERE EMP ENAME = 'WARD';
Comparison Conditions
Operator = >
>=
< <=
<>
Not equal to
FROM
WHERE
EMP
SAL <= 3000;
Lower limit
Upper limit
MGR
Using the LIKE Condition Use the LIKE condition to perform wildcard searches of valid search string values. Search conditions can contain either literal characters or numbers:
% denotes zero or many characters. _ denotes one character.
SELECT FROM WHERE ENAME EMP ENAME LIKE 'S%';
FROM
WHERE
EMP
ENAME LIKE '_o%';
You can use the ESCAPE identifier to search for the actual % and _ symbols.
BUSINESS INFORMATION MANAGEMENT 2010 Capgemini. All rights reserved. 50 50
Logical Conditions
Operator AND
OR
NOT
SELECT EMPNO, ENAME, JOB, SAL FROM WHERE OR EMP SAL >= 10000 JOB LIKE '%MAN%';
FROM
EMP
WHERE
JOB
Rules of Precedence
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
Rules of Precedence
SELECT ENAME, JOB, SAL FROM WHERE OR AND EMP JOB = 'SALESMAN' JOB = 'PRESIDENT' SAL > 15000;
Rules of Precedence
OR
AND
JOB = 'PRESIDENT')
SAL > 15000;
ORDER BY Clause
ORDER BY HIREDATE ;
SELECT
FROM
EMP
ORDER BY annsal;
FROM
EMP
Use the WHERE clause to restrict rows of output Use the comparison conditions
Exercise 1) Display the names with single word 2) Display the names with two words 3) Display the names with exactly three words 4) Display all the salaries beginning with digit 2 5) Display all the names with second letter as A 6) 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.