Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept
Slide Titel Page Footer Part I Oracle database architecture
Slide Titel Page Footer Overview Chapter 1 Chapter 2 Chapter 3 Oracle Instance Logical structure of an Oracle database Physical structure of an Oracle database
Slide Titel Page Footer Chapter 1 The Oracle Instance
Logical database structure: The Oracle Instance Page Footer An Oracle Instance consists of: Memory Structures Configurable chunks of internal server memory used to optimize database actions like storing data blocks and database language commands (SQL). The Memory structures together form the Shared Global Area (SGA) Background Processes Generic processes to perform certain database functions like monitoring processes and writing changed data back to datafiles.
Oracle Logical Database Structure Page Footer Shared Pool Database Buffer Cache Large Pool Java Pool Redo Log Buffer Library Cache Library Cache Library Cache Data Dictionary Cache Data Dictionary Cache Data Dictionary Cache Library Cache Data Dictionary Cache Data Dictionary Cache Data Dictionary Cache PMONSMONDBWRLGWRCKPTOthers Shared Global Area Oracle Instance
Logical database structure: Shared Global Area (1 of 2) Page Footer The Shared Global Area (SGA) consists of: Library Cache Structure used to store SQL commands for reuse Data Dictionary Cache Structure used to store Meta information (information about the database objects like table-columns and object-privileges Database Buffer Cache Structure used to store data read from data files. If data is changed, it is always done in the Database Buffer Cache (never direct on disk) Redo Log Buffer Buffer used to cache information about database transaction. From this buffer the redo data is written to the Online Redo Log Files Sharted Pool
Logical database structure: Shared Global Area (2 of 2) Page Footer The Shared Global Area (SGA) consists of: Large Pool The Large Pool is an optional Memory structure which is used to store large memory allocations. Especially when RMAN (Backup and Recovery Manager) is used, it is recommended to configure the Large Pool Java Pool The Java Pool is only used to execute Java Stored Procedures. If no Java is used in the database, the size of the Java Pool can set up 0 (default)
Logical database structure: Background processes Page Footer Oracle Background Processes: Execute general database task Are automatically started when database is started Mandatory and optional background processes serveral instances of some background processes can start (heavy use) Background processes are visible in V$BGPROCESS
Logical database structure: Shared Global Area (1 of 2) Page Footer The Shared Global Area (SGA) consists of: Library Cache Structure used to store SQL commands for reuse Data Dictionary Cache Structure used to store Meta information (information about the database objects like table-columns and object-privileges Database Buffer Cache Structure used to store data read from data files. If data is changed, it is always done in the Database Buffer Cache (never direct on disk) Redo Log Buffer Buffer used to cache information about database transaction. From this buffer the redo data is written to the Online Redo Log Files
Oracle Instance: Background Processes Page Footer The Shared Global Area (SGA) consists of: Large Pool The Large Pool is an optional Memory structure which is used to store large memory allocations. Especially when RMAN (Backup and Recovery Manager) is used, it is recommended to configure the Large Pool Java Pool The Java Pool is only used to execute Java Stored Procedures. If no Java is used in the database, the size of the Java Pool can set up 0 (default)
Logical database structure: Background Processes (1/2) Page Footer Oracle basic Background processes: SMON PMON DBWR LGWR CKPT ARCH J000 : System Monitor : Process Monitor : Database Writer : Log Writer : Checkpoint Process : Archiver Process : Job Queue Process
Logical database structure: Program Global Area (PGA) Page Footer Oracle basic Background processes: SMON PMON DBWR LGWR CKPT ARCH J000 : System Monitor : Process Monitor : Database Writer : Log Writer : Checkpoint Process : Archiver Process : Job Queue Process
Slide Titel Page Footer Chapter 2 Logical structure of an Oracle database
Logical database structure: Overview Page Footer Logical database structure: Tablespace Segment Extent Data Block : Container for tables, indexes, Undo or Temporary structures : The type of the segment (table, index, undo or temporary segment) : Unit of allocation of storage for specific segment : Smallest unit in which data is stored
Logical database structure: Overview Page Footer Oracle Tablespace: Logical container for segments (e.g. table, index, temporary) An Oracle database have several mandatory tablespaces (system, sysaux, undo, temporary) Default storage clause for tables and indexes can be set on tablespace level Tablespace can be permanent (datafiles) or temporary (tempfiles) Tablespace can be locally managed or dictionary managed Tablespace can be set offline (data in tablespace is not accessible) Storage quotum for users or applications can be set on tablespace
Logical database structure: Mandatory tablespaces Page Footer An Oracle database has several mandatory tablespace: System: Sysaux: Undo: Temp: contains the data dictionary and store temporary segments when no default temporary tablespace is defined is used to store information for specific database functions like OLAP, RMAN and Ultra Search the Undo tablespace is used for storing Undo information (changes made in transactions). No other objects can be created in the Undo tablespace. Tablespace used to execute sorts which are too big to do in memory by using temporary segments
Logical database structure: Tablespaces Page Footer Free space management in an Oracle tablespace: Data Dictionary Managed tablespaces (DMT) Free space management is done in the system tablespace Default management mode in Oracle 8i and previous versions Locally Managed Tablespaces (LMT) Free space management is done in the tablespace itself A bitmap structure is used to map and identifiy free blocks in the tablespace Default management mode in Oracle 9i and onwards Combination of DMT and LMT tablespace possible in database as long as system tablespace is dictionary managed.
Logical database structure: BigFile Tablespaces Page Footer BigFile Tablespaces: Data Dictionary Managed tablespaces (DMT) Free space management is done in the system tablespace Default management mode in Oracle 8i and previous versions Locally Managed Tablespaces (LMT) Free space management is done in the tablespace itself A bitmap structure is used to map and identifiy free blocks in the tablespace Default management mode in Oracle 9i and onwards
Logical database structure: Segments Page Footer Oracle Segments: Oracle has four types of segments: Table, Index, Undo and Temporary Logical container for extents (e.g. table, index or temporary) All extents within a segment are used to store similar object (e.g. Table) DBA_SEGMENTS records information about segments.
Logical database structure: Extents Page Footer Segment: Logical container for segments (e.g. table, index, temporary)
Logical database structure: Blocks Page Footer Blocks: A blocks is the smallest unit used in storage a Block has a header in which meta-data is stored Default block size is configured by parameter DB_BLOCK_SIZE if space in block is insufficient Row Migrating and Row Chaining will occur
Logical database structure: Segments, extents and blocks Page Footer Relationship among segments, extents and blocks: 8k Data blocks Extent 192k Extent 64k Segment 256k
Slide Titel Page Footer Chapter 3 Physical structure of an Oracle database
Physical database structure: Overview Page Footer The physical structure of an Oracle database comprises of: Data files Temp files Online redo log files Control files Parameter or initialization file Password file
Physical database structure: Data files Page Footer Oracle Data files: Permanent tablespaces using data files for storage Every tablespace has at least 1 data file A data file can be configured to grow automatically (autoextent) A data file can be set Online or Offline The view DBA_DATA_FILES contains information about the data files
Physical database structure: Temp files Page Footer Oracle Temp files: Temporary tablespaces using temp files for storage Temp tablespaces are mainly used for big sorting operations Creation of temp files is fast. Only header and last block are written Temp files are not recorded in the control file It is not necesarry to backup temp files (with RMAN)
Physical database structure: Redo Log Files Page Footer Oracle Redo Log files: Redo log files are transaction journals At least two redo log groups must be defined in an Oracle database Every redo log group must contain at lease 1 member It is recommended to multiplex Redo log members A filled up redo log file is archived when database is running is archive log mode Redo log groups and members information is recorded in the control file
Physical database structure: Control Files Page Footer Oracle Control files: Control file contains physical information about the Oracle databas Control file is read in nomount-phase of database startup Control file can be dumped with SQL-command: alter database backup controlfile to trace Control files must be multiplexed to ensure availability during operation Locations of control files are included in the parameter file
Physical database structure: Password File Page Footer Oracle Password file: Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Physical database structure: Oracle Managed Files Page Footer Oracle Managed Files (OMF): Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Slide Titel Page Footer Chapter X Creating an Oracle database
Creating an Oracle Database: Parameter file Page Footer Oracle Managed Files (OMF): Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Creating an Oracle Database: Basic initialization parameters Page Footer Oracle Managed Files (OMF): Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Creating an Oracle Database: Creating an Oracle Database Page Footer Oracle Managed Files (OMF): Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Creating an Oracle Database: Manually creating an Oracle Database Page Footer Oracle Managed Files (OMF): Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Creating an Oracle Database: Creating an Oracle Database using DBCA Page Footer Oracle Managed Files (OMF): Used to authenticate sysdba & sysoper users when database is not running Is created with Oracle utility $ORACLE_HOME/bin/orapwd Can be shared among databases on same server or can be dedicated to single database on server (recommended) Parameter REMOTE_LOGIN_PASSWORDFILE is used to configure use The view V$PWFILE_USERS gives an overview of users recorded in file
Starting en Stopping Oracle: Startup phases Page Footer Nomount Parameter file (PFILE or SPFILE) is read SGA (memory) is allocated and the background processes are started Mount Control file is read Open Data files and temp files are opened Database become available for users Startup nomount Startup Startup mount
Starting en Stopping Oracle: Start Oracle with alternative pfile Page Footer Parameter file: The use of a SPFILE is recommended over the use of the PFILE
Starting en Stopping Oracle: PFILE and SPFILE Page Footer Parameter file: The use of a SPFILE is recommended over the use of the PFILE
Oracle user management: Oracle database users (overview) Page Footer Syntax for creating a database user: CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE tablespace PROFILE profile ; Username is a 30-length string and should not start with digit TEMPORARY TABLESPACE is obsolete (In 10g default temporary tablespace) Resource requirements can set in the profile (like number of invalid logins) Privileges and rights cannot be assigned in CREATE-command
Oracle user management: Creating database users Page Footer Syntax for creating a database user: CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE tablespace PROFILE profile ; Username is a 30-length string and should not start with digit TEMPORARY TABLESPACE is obsolete (In 10g default temporary tablespace) Resource requirements can set in the profile (like number of invalid logins) Privileges and rights cannot be assigned in CREATE-command
Oracle user management: Profiles Page Footer Syntax for creating a database user: CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE tablespace PROFILE profile ; Username is a 30-length string and should not start with digit TEMPORARY TABLESPACE is obsolete (In 10g default temporary tablespace) Resource requirements can set in the profile (like number of invalid logins) Privileges and rights cannot be assigned in CREATE-command
Oracle user management: Privileges Page Footer Syntax for creating a database user: CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE tablespace PROFILE profile ; Username is a 30-length string and should not start with digit TEMPORARY TABLESPACE is obsolete (In 10g default temporary tablespace) Resource requirements can set in the profile (like number of invalid logins) Privileges and rights cannot be assigned in CREATE-command
Oracle user management: Roles Page Footer Syntax for creating a database user: CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE tablespace TEMPORARY TABLESPACE tablespace PROFILE profile ; Username is a 30-length string and should not start with digit TEMPORARY TABLESPACE is obsolete (In 10g default temporary tablespace) Resource requirements can set in the profile (like number of invalid logins) Privileges and rights cannot be assigned in CREATE-command