oracle product detail

Upload: yogendra-rajavat

Post on 11-Oct-2015

25 views

Category:

Documents


0 download

DESCRIPTION

oracle

TRANSCRIPT

ORACLE Architecture

What is Oracle ?Oracle is a relational database management system.It is a management system which uses the relational data model.In the relational data model, data is seen by the users in form of tables alone. Oracle Server:Is a database management system that provides an open, comprehensive, integrated approach to information management.Consists of an Oracle Instance and an Oracle databaseOracle in IndustryIn todays world, data is the key for businessEvery organization stores its data in multiple databasesOne of the most widely used database in industry is OracleOracle can work on various Operating Systems (Windows, Unix, etc.) The demand for Oracle in todays world is immenseMany projects across the industry use Oracle as back-end for deploying its various applications.

Database Architecture - IntroductionThree Major Instances: Database instanceFile StructureData Structures

Database Instance:

Oracle Database consists of Software Modules & Database Files

Instance After the complete installation of Oracle 10g, when you start the Oracle database , then you have what is referred to as anOracle 10g Database Instance. It is the actual execution of DBMS software that manages data in the databases tablespace.Properties Of Database InstanceCreated on loading the software from disk to memory.It is an aggregation of processes and memory structures It is sharable thus allowing multiple users to access the same database.File Structure- Three Basic Oracle FilesControl FilesRedo Log FilesData FilesidentifiesidentifiesProvides changes toParameter File123Data StructuresTablespacesDatabaseInstanceExtentsTablespacesExtentsExtentsExtentsData BlocksData BlocksData BlocksData BlocksData BlocksSegmentsOverview of Oracle ArchitectureSGAShared SQL AreaDatabase Buffer CasheKByte1,200,000 KByteRedo LogBufferKByte2,100 KBytePMONLGWRData File Raw DeviceServerUSERARCH

TL-812Archive Log Mode(50M) * Fixed Size : 70 Kbyte* Variavle Size : 490 MByte4,000,000 KByte * Total SGA Size : 1700 MbyteDBW0CKPTSMONRECOD000S000P00071. ?2. Overview3. SGA, SGA 3 SGA 4. Background Process ( )5. Instance = SGA + Background Process6. Server Process/User Process7. File

1) Fixed size access user data parameter . instance ,os .

2) Variable size size parameter file(initSID.ora) SHARED_POOL_SIZE . SHARED_POOL_SIZE byte OS shared memory segment . InitSID.ora file instance parameter parameter SGA . SGA SHARED_POOL_SIZE parameter . parameter . *DB_FILES - 10 6K *DML_LOCKS - 100 9.7K *PROCESSES - 10 19.5K *SEQUENCE_CACHE_ENTRIES - 10 1.17K *ROW_CACHE_ENQUEUES - 100 3.5K *SESSIONS - 10 5.3K : : parameter SGA V$SGASTAT .(select * from v$sgastat;)Memory Structure : Shared Pool Shared PoolLibrary CacheShared SQL AreaPL/SQL Procedures and PackageControl Structuresfor examples;

LocksLibraryCache handlesand so on ...Dictionary CacheControl Structuresfor example:

Character SetConversion MemoryNetwork Security Attributes

and so on .. Shared Pool Contents - Text of the SQL or PL/SQL statement - 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 - 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_SIZEReusableRuntimeMemory8 3) Database Buffer Cache SGA disk data performance . size disk i/o. DB_BLOCK_BUFFERS buffer .byte DB_BLOCK_BUFFERS * DB_BLOCK_SIZE .

4) Log Buffers redo log log buffer size . byte LOG_BUFFERS .

1. SGA - data control information . - SGA non-paged, non-swapped memory - 1/3 .2. - software code areas : - the system global area (SGA) the database buffer cache, the redo log buffer, the shared pool - program global areas (PGA) : (Server,background) data control .( stack areas, data areas ) - sort areas (SORT_AREA_SIZE )3. Shared Pool - Identical SQL (by Hashing algorithm)Oracle ProcessesSnnnUsersDBWRSGADatabase Buffer CacheRedo Log BufferData FilesRedo Log FilesControl FilesOffline Storage DeviceDedicated Server ProcessLCK0RECOPMONSMONCKPTUser ProcessDnnnLGWRARCHSNPnPnnn91. Background Process - PMON, SMON, DBWR, LGWR : mandatory processes - 4 instance : Instance Restart - the other processes are optional2. Server Process/User Process

3. Legend - LCKn : Lock process (parallel server system Instance locking) - RECO : Recoverer process ( failure ) - PMON : Process monitor - SMON : System monitor - CKPT : Checkpoint - ARCH : Archiver - DBWR : Database writer - LGWR : Log writer - Pnnn : Parallel processes - SNPn : Snapshot process (Replication) Background Process (P51)Background ProcessDBWR (Database Writer) - write all dirty buffers to datafiles - Use a LRU algorithm to keep most recently used blocks in memory - Defers write for I/O optimizationdirty list reaches a threshold lengthA process scnas a specifed number of buffer in the LRU without finding free bufferA time-out occursDBWR checkpoint occursLGWR (Log Writer) - writes redo log entries to diskCommit occursThe redo log buffers pool becomes one-third fullDBWR completes cleaning the buffer blocks at a checkpointLGWR time-out - A commit confirmation is not issued until the tx has been recorded in the rego log file101. Properties LGWR - 1 1 LGWR - Transaction redo log file Commit . (? failure) - User Commit LGWR flush commit commit I/O piggyback. ( ) - Long Transaction 1/3 redo log buffer .

2. Log Switch - log switch : LGWR redo log group => redo log write - log switch check point - Redo log , DBA ALTER SYSTEM SWITCH LOGFILE - 1 .

3. Log Sequence #

ContdPMON (Process Monitor) - Cleans up abnormally terminated connection - Rolls back uncommited transactions - Releases locks held by a terminated process - Frees SGA resources allocated to the failed processes - Database maintenance

SMON (System Monitor) - Performs automatic instance recovery - Reclaims space used by temporary segments no longer in use - Merges contiguous area of free space in the datafile11* PMON clean-up alter system kill session , => serial# ContdCKPT (Check Point) - is enabled by setting the parameter CHECKPOINT_PROCESS=TRUE - If enabled, take over LGWRs task of updating files at a checkpoint - Updates header of datafiles and control files at the end of checkpoint - More frequent checkpoint reduce recovery time from instance failure - CKPT improve the performance of database with many database filesARCH (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 diskLCKn (Lock), Dnnn (Dispatcher), Snnn (Server), RECO (Recover), Pnnn(Parallel), SNPn(Job Queue), QMNn(Queue Monitor),120. When Do Checkpoint - every log switch - LOG_CHECKPOINT_TIMEOUT - LOG_CHECKPOINT_INTERVAL - instance shutdown (not abort) - ALTER SYSTEM CHECKPOINT (by DBA) - tablespace offline while at least one of its files is online

1. RECO : Failure 2. LCKn : Parallel Server system locking .3. Pnnn ( Parallel Query process) : parallel query, parallel index creation, parallel data loading, parallel CREATE TABLE AS SELECT4. SNPn (Snapshot process) : Automatic refreshes of snapshot (read-only replicated tables), the server job queues and replication queues5. QMNn (Queue Monitor) : message queue Oracle Advanced Queuing

1. The parallel query option 2. The procedural option is required for snapshots. It is included with the Oracle7 licensed product.3. The distributed option is required for distributed transactions. 4. The replication option Server/User ProcessUser 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 processParse : check syntax, security access, object resolution, optimizationExecute : applies the parse tree to the data, perform a physical read and changeFetch : Passes data to the user (only SELECT)131. Single Task, Two-Task - Single-Task : User(Application Code) Server(Oracle Server Code) Process Batch 30% . Re-make .Oracle Files Datafile Redo Log Files Control Files Parameter File Archive File Log File (alert*.log, sqlnet.log, listener.log...) Trace File141. - Datafile : Database data . Table, Index Logical . - Redo Log Files : Recovery . record . 2 redo log group , 2 Size . . - Control File : Status . Database file, log file, database name, Synchronization information disk 2 . - Parameter File : - Alert File : chronological log of message and errors internal error (ORA-600), block corruption error(ORA-1578), dead lock errors(ORA-60), DDL, Server Manager statement(startup, shutdown..) BACKGROUND_DUMP_DEST - Trace File : BACKGROUND_DUMP_DEST, USER_DUMP_DEST

2. Control file . . CONTROL FILE , BACKUP FILE . . DATA FILE, LOG FILE MAX alter database backup controlfile to trace noresetlogs; Storage ArchitecturePhysical storage structuresData filesSegmentsExtentsBlocksLogical storage structuresTablespacesTables / Clusters / IndexesRowsColumns151. Physical storage structure - Datafile : a physical datafile belonging to a single tablespace - Segment : a set of one or more extents that contains all the data for a specific structure within a tablespace - Extents : a set of contiguous data blocks in a database - Block : multiple physical file blocks allocated from an existing datafile

2. Logical storage structure - Tablespace : a logical repository for physically grouped data - Table / Clusters / IndexesPhysical Storage Architecture Relationship among Segments, Extents, and BlocksExtent24K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2K2KExtent72KSegment96KDatabase Blocks16Logical Storage ArchitectureRelationship between tablespaces and datafilesUSER TablespaceSystem TablespaceDatabaseDATA3.ORADATA1.ORADATA2.ORA17< Tablespace >1. tablespace OS .2. Tablespace database online .3. SYSTEM, RBS tablespace offline .4. Read-write Read-only 5. tablespace .

1. Controlling space allocation and assign space quotas to users2. tablespace online, offline 3. Data storage I/O .4. backup recovery .5. Static data read-only tablespace .

< SYSTEM tablespace>1. Database operation 2. Data dictionary , stored procedures/package/trigger definition3. SYSTEM rollback segment4. Can contain user data

ContdObjects stored in tablespacesTableTableTableINDEXINDEXINDEXINDEXINDEXINDEXINDEXINDEXINDEXINDEXTablespace (one or more datafiles)Database Files(Physical structures associatedwith only one tablespace)Objects(stored in tablespace mayspan serveral datafiles)18< Non-system Tablespace >1. Database 2. Rollback segment, temporary segment, application data/index, user space3. Rollback segment tablespace 4. Temporary Tablespace : data, index , dba ( V$SORT_SEGMENT )5. Resizing datafile (AUTOEXTEND option)6. Read-only tablespace : online, no active tx, no active rbs, not online backup

BlockHeaderTable DictionaryRow DictionaryFree SpaceRow DataGeneral Block Information(Block add, Segment type)85 ~ 100 bytes

Table info in Cluster

Row info in Block(2 byte per row)

using when New Row Insert orUpdate (pctfree, pctused)

Table or Index Data

191. Block - Header : general block information - Table directory : information about the table - Row directory : row information about the actural rows in the block (1row 2bytes) - Free space : for insert or updates of rows, or for additional transaction entries - Row data : stores table or index data

2. Space Management Parameters - PCTFREE : udpate (default 10) - PCTUSED : pctused freelist row insert(40) - INITRANS : block header tx entries ( tx entry 23bytes) - MAXTRANS : block access tx (255) block free space . , tx pctfree

3. Chaning and Migration - Analyze table table_name list chained rows; - utlchain.sql (create chained_rows)ExtentA set of contiguous database blocks within a datafile.Extent are allocated when. - The segment is created (INITIAL EXTENT)- The segments grows (NEXT EXTENT)- The table is altered to allocate extents.Extent are de-allocated when the - 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 ) ( Rollback segment : 2)ALTER TABLE table_name DEALLOCATE UNUSED201. Storage Parameter - INITIAL : 5 blocksNEXT : 5blocksMAXEXTENTS - MINEXTENTSPCTINCREEASEOPTIMAL - FREELISTSFREELIST GROUPS(OPS)2. Storage Parameter - table, clusters, indexes, rollback segments, tablespaces(default setting only)3. Object level > tablspace level > system level

4. initial -> next -> next*(1+pctincrease/100)Segmenta set of one or more extents that contains all the data for a specific type of logical storage structure within a tablespaceData Segment - A collection of extents that holds all of the data for a table or a clusterIndex Segment- A collection of extents that holds all of the index data for search optimization on large tables and clustersRollback Segment - A collection of extents that holds rollback data for rollback, read-consistency, or recoveryTemporary segment- A collection of extents that holds data belonging to temporary tables created during a sort operationBootstrap segment- An extent that contains dictionary definitions for dictionary tables to be loaded when the database is opened. 211. Segment Oracle Client/Server Architecture

NETWORK

Server AServer bClientApplicationServer/ServerClient/Server 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, transparency22