Académique Documents
Professionnel Documents
Culture Documents
Introduction to Database
History of RDBMS Entity-Relationship Modeling Database Language
Introduction to Database
File-Based Approach
Each program defines and manages its own data Limitation
Separation and isolation of data Duplication of data Data dependence Incompatibility of files Fixed queries/proliferation of application program
Database Approach
A shared collection of logically related data, designed
Advantages of DBMS
- Control of data redundancy - Economy of scale - Data consistency - Balance of conflicting requirements - More information from the same amount of data - Sharing of data - Improved data accessibility and responsiveness - Improved data integrity - Increased productivity - Improved security - Improved maintenance through data independence - Enforcement of standards - Increased concurrency - Improved backup and recovery services
Disadvantages of DBMS
- Complexity, Size, Cost of DBMSs, Additional H/W costs - Cost of conversion, Performance, Higher impact of a failure
Conceptual Level
The community view of the database
Internal Level
The physical representation of the database on the computer
Functions of a DBMS
1. Data storage, retrieval, and update 2. A user-accessible catalog 3. Transaction support 4. Concurrency control services 5. Recovery services 6. Authorization services 7. Support for data communication 8. Integrity services 9. Services to promote data independence 10. Utility services
Components of a DBMS
Programmers
Application Programs
Users
Queries
DBA
Database Schema
DML
Query
DDL
DBMS
preprocessor
Program object code
processor
Database manager
compiler
Dictionary manager
Access
methods System buffers
File
manager Database and system catalog
Authorization control
Integrity checker
Query optimizer
Recovery manager
History of RDBMS
History of DBMS
1960s - Apollo moon-landing project, GUAM
mid 1960s - IMS by IBM (hierarchical DBMS) mid 1960s - IDS by GE (network DBMS) 1965 - CODASYL(Conference on Data SYStems
Language)
1967 -DBTG(Data Base Task Group) 1970 - E.F.Codd of the IBM Research Lab. Late 1970s - System R project at IBM
Terminology
Relation : a relation is a table with columns and rows
Attribute : an attribute is a named column of a relation Domain : a domain is the set of allowable values for one or more attributes
Properties of Relations
The relation has a name that is distinct from all other relation names Each cell of the relation contains exactly on atomic value
Structural rules
Rule 1 : Information representation Rule 6 : View updateing
Integrity rules
Rule 3 : Systematic treatment of null values Rule 10 : Integrity independance
Entity-Relationship Modeling
Attributes
A property of an entity or a relationship type
Relationship Types
A meaningful association among entity types
Normalization
A technique for producing a set of relations with desirable properties, given the data requirements of an enterprise
UNF is a table that contains one or more repeating groups 1NF is a relation in which the intersection of each row and column contains one
and only one value
BCNF is a relation in which every determinant is a candidate key 4NF is a relation that is in BCNF and contains no trivial multi-valued
dependency
Database Language
SQL
1974 - SEQUEL by D.Chamberlin (IBM) 1975 - SQUARE by Boyce (System R project) 1976 - SEQUEL/2 (SQL) by Chamberlin and Boyce) late 1970 - SQL(Oracle), QUEL(Ingres) 1982 - Relational Database Language(RDL) : ANSI 1987 - ISO standard 1989 - Integrity Enhancement Feature (ISO) 1992 - SQL2(SQL92) : ISO
DML
SELECT INSERT UPDATE DELETE
DDL
CREATE(DROP) SCHEMA CREATE(ALTER, DROP) DOMAIN CREATE(ALTER, DROP) TABLE CREATE(DROP) VIEW CREATE(DROP) INDEX
Advanced SQL
View Integrity Enhancement Feature
Primary key Unique Foreign key
New Features
SGA
Shared SQL Area Database Buffer Cashe
TL-812
4,000,000 KByte 1,200,000 KByte
2,100 KByte
Server
USER
DBW0
CKPT
LGWR
ARCH
Archive Log Mode(50M)
Dictionary Cache
- Parsed form of the SQL or PL/SQL statement - Execution plan for the SQL or PL/SQL statements - Data dictionary cache containing rows of data dictionary information
Library Cache
Control Structures for examples; Locks Library Cache handles and so on ...
- shared SQL area - private SQL area - PL/SQL procedures and package - control structures : lock and library cache handles
Dictionary Cache
- names of all tables and views in the database - names and datatypes of columns in database tables - privileges of all Oracle users
SHARED_POOL_SIZE
All users concurrently connected to the system share access to the buffer cache
Dirty List LRU List Size = DB_BLOCK_SIZE * DB_BLOCK_BUFFERS
SGA
Shared Pool
Shared SQL Area
Circular buffer containing information about changes made to the database save it redo entry Redo Entries is used when Database Recovery DBWR write contents of Redo Log Buffer to Online Redo Log LOG_BUFFER
Oracle Processes
SNPn Pnnn SMON PMON RECO LCK0
Snnn
DBWR Dnnn
User Process
LGWR
ARCH
CKPT
Control Files
Users
Data Files
Background Process
- A commit confirmation is not issued until the tx has been recorded in the rego log file
Contd
Contd
ARCH (Archiver)
- Copies redo log files to tape or disk for media failure - Operates only when a log switch occurs - Is optional and is only needed when in ARCHIVELOG mode - May write to a tape drive or to a disk
LCKn (Lock), Dnnn (Dispatcher), Snnn (Server), RECO (Recover), Pnnn(Parallel), SNPn(Job Queue), QMNn(Queue Monitor),
Server/User Process
User Processes
- A user process is used when a user runs an application program - Runs the tool/application and is considered the client - Passes SQL to the server process and receives the results
Server Processes
- A server process must place the data in the database buffer cache - Parce and execute SQL statements - Read data blocks from disk into the shred database buffers of the SGA - Return the results of SQL statements to the user process Parse : check syntax, security access, object resolution, optimization Execute : applies the parse tree to the data, perform a physical read and change Fetch : Passes data to the user (only SELECT)
Oracle Files
Datafile Redo Log Files Control Files Parameter File Archive File Log File (alert*.log, sqlnet.log, listener.log...) Trace File
Storage Architecture
Segment
96K
Extent
24K
2K 2K 2K 2K 2K 2K 2K 2K 2K 2K
Extent
72K
2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K 2K
Database Blocks
Database
System Tablespace
USER Tablespace
DATA1.ORA
DATA2.ORA
DATA3.ORA
Contd
INDEX
INDEX Table
Database Files
(Physical structures associated with only one tablespace)
Objects
(stored in tablespace may span serveral datafiles)
Block
Header
Table Dictionary
General Block Information (Block add, Segment type) 85 ~ 100 bytes Table info in Cluster
Row Data
using when New Row Insert or Update (pctfree, pctused) Table or Index Data
PCTFREE / PCTUSED
PCTFREE PCTUSED
PCTFREE = 20 Insert new row until 80% 20% use when Update
PCTUSED = 40 Can insert new row when below 60% When Usage is below 40% (61% Free space), block is listed in FREELIST
Extent
A
Extent
- The segment is created (INITIAL EXTENT) - The segments grows (NEXT EXTENT) - The table is altered to allocate extents.
Extent
- The segment is dropped and truncated. - The segment is larger than optimal and contains free extents (for rollback segments only)
Each
segment is created with at least on extend( initial extent ) TABLE table_name DEALLOCATE UNUSED
( Rollback segment : 2)
ALTER
Segment
a set of one or more extents that contains all the data for a specific type of logical storage structure within a tablespace Data Segment - A collection of extents that holds all of the data for a table or a cluster Index Segment - A collection of extents that holds all of the index data for search optimization on large tables and clusters Rollback Segment - A collection of extents that holds rollback data for rollback, read-consistency, or recovery Temporary segment - A collection of extents that holds data belonging to temporary tables created during a sort operation Bootstrap segment - An extent that contains dictionary definitions for dictionary tables to be loaded when the database is opened.
OLTP
Advanced Queuing XA rewrite Memory reduction Serially reusable memory New OCI Interface Improve Function Performance
Objects
Object Relational Database Object Type Object View
Network Computing
Simple User Integration Simple Maintenance Simple Development
OLTP
Publish and subscribe capabilities Database event trigger Single table hash cluster Object type column in partition table Partitioned index-organized table Stable optimizer execution plans
Application Development
Oracle Jserver, VM in Database Java stored procedure, function.. SQLJ: embedded SQL in Java WebDB
Security
Virtual Private Database LDAP integration N-tier authentication/authorization SSL and X.509v3, RAIDUS support Data encrypt, decrypt
specific capabilities and product bundles targeted at eBusiness environments. In addition, Oracle9i continues to add features and capabilities that extends existing investment in mission-critical infrastructure. Oracle9i has been designed with focus on certain key development areas.
Security
Development Platform Manageability
Packaged Application
Business Intelligence
Windows2000 Integration
NETWORK
Client Application
Client/Server
Server b
Server/Server
Server A
Benefit
of Client/Server Component - Database S/W work on Server - Minimize network resource - concurrency, consistency, transparency
- Only Server upgrade to increase size - Minimize Client H/W spec - concurrency, consistency, transparency
SQL*Net
What is SQL*Net?
- Oracles Client/Server middleware product - transparent connection from client tool to DB ( from on DB to another ) - works across multiple network protocol and operation system
What is TNS?
- Transparent Network Substrate - Oracles Network applications to access the underlying network protocols transparently - TNS-based application, Oracle Protocol Adapters, Network software like TCP/IP
Configuration File
- TNSNAME.ORA ( Client )
- TNSNAV.ORA ( Client ) - SQLNET.ORA ( Client, Server ) - LISTENER.ORA ( Server )
SQL*Net Configuration
TNSNAME.ORA
LISTENER.ORA
SQLNET.ORA
LISTENER= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=tcp) (HOST=brinfoa01) (PORT=1521) ) ) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (SID_NAME=BRBINFO1) (ORACLE_HOME=/oracle7/oracle7) (ENVS='EPC_DISABLED=TRUE') ) ) STARTUP_WAIT_TIME_LISTENER=0 CONNECT_TIMEOUT_LISTENER=0 LOG_DIRECTORY_LISTENER=/oracle7/oracle7/network/log LOG_FILE_LISTENER=listener TRACE_LEVEL_LISTENER=OFF
Net8
Networking Challenge
Support large mission-critical client/server, and provide migration path towards distributed object architecture Net8 Focus
1. Scalability : Connection Pooling, Multiplexing(Connection Manager) 2. Manageability : Configuration-free installation option,