oracle database training

Upload: devesh-bhole

Post on 06-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Oracle Database Training

    1/35

    Oracle Database Training

    4th February, 2012

    Confidential | Copyright 2011 MindCraft Software Pvt. Ltd. All Rights Reserved | www.mindcraft.in

  • 8/3/2019 Oracle Database Training

    2/35

    Oracle Database Server Architecture

    Oracle Instance Architecture

    Oracle Database Architecture

    Confidential | Copyright 2011 MindCraft Software Pvt. Ltd. All Rights Reserved | www.mindcraft.in

  • 8/3/2019 Oracle Database Training

    3/35

    Oracle

    Architecture

    Confidential | Copyright 2011 MindCraft Software Pvt. Ltd. All Rights Reserved | www.mindcraft.in

  • 8/3/2019 Oracle Database Training

    4/35

    Oracle Architecture

    InstanceAn Oracle instance:

    Is a means to access an Oracle database

    Always opens one andonly one databaseConsists of:

    Internal memory structures

    Processes

    Confidential | Copyright 2011 MindCraft Software Pvt. Ltd. All Rights Reserved | www.mindcraft.in

  • 8/3/2019 Oracle Database Training

    5/35

    Oracle Architecture

    Database buffer cache Used to holddata blocks readfrom datafiles byserver processes

    Contains dirty or modified blocks and clean

    or unusedor unchanged bocks Dirty and clean blocks are managedin listscalled the dirty list and the LRU

    Free space is created by DBWR writingout

    dirty blocks or agingout blocks from the LRU Size is managed by the parameterDB_BLOCK_BUFFERS

  • 8/3/2019 Oracle Database Training

    6/35

    Oracle Architecture

    Redo LogBuffer A circular buffer that contains redo entries

    Redo entries reflect changes made to the database

    Redo entries take upcontiguous, sequential

    space in the buffer Data storedin the redo log buffer is periodicallywritten to the online redo logfiles

    Size is managed by the parameter

    LOG_BUFFER Default is 4 times the maximum data block size forthe operating system

  • 8/3/2019 Oracle Database Training

    7/35

    Oracle ArchitectureShared Pool

    Consists of multiple smaller memory areas Library cache

    Shared SQL area Contains parsed SQL and executionplans for statements

    already run against the database Procedure andpackage storage

    Dictionary cache Names of all tables and views in the database Names anddatatypes ofcolumns in the database tables Privileges of all users

    Managed via an LRU algorithm Size determined by the parameterSHARED_POOL_SIZE

  • 8/3/2019 Oracle Database Training

    8/35

    Oracle Architecture

    Internal Memory Structures PGAProgram or process Global Area (PGA) Usedfor a single process

    Not shareable with other processes

    Writable only by the server process Allocated when a process is created anddeallocated when a process is terminated

    Contains: Sort area Usedfor any sorts required by SQL processing

    Sessioninformation Includes user privileges

    Cursor state Indicates stage of SQL processing

    Stack space Contains session variables

  • 8/3/2019 Oracle Database Training

    9/35

    Oracle Architecture

    Background Processes - DBWR DBWR writes todisk when:

    A server process cannot find a cleanreusable buffer

    A timeout occurs (3 sec)

    A checkpoint occurs

    DBWR cannot write out dirty buffers

    before they have been written to the onlineredo logfiles

  • 8/3/2019 Oracle Database Training

    10/35

    Oracle Architecture

    Background Processes - LGWR Writes contents of redo log buffers toonline redo logfiles

    Primary job is tokeep the redo log bufferclean

    Writes out redo log buffer blockssequentially to the redo logfiles

    May write multiple redo entries per writeduring high utilizationperiods

    Mandatory process

  • 8/3/2019 Oracle Database Training

    11/35

    Oracle Architecture

    Background Processes - LGWR LGWR writes todisk when:

    A transactionis COMMITED

    A timeout occurs (3 sec) The redo log buffer is 1/3 full

    There is more than 1 megabyte of redoentries

    BeforeDBWR writes out dirty blocks todatafiles

  • 8/3/2019 Oracle Database Training

    12/35

    Oracle Architecture

    Background Processes - SMON Performs automaticinstance recovery

    Reclaims space used by temporarysegments no longer in use

    Merges contiguous areas offree space inthe datafiles (if PCTINCREASE > 0)

    SMON wakes up regularly tocheck

    whether it is neededor it may be calleddirectly

    Mandatory process

  • 8/3/2019 Oracle Database Training

    13/35

  • 8/3/2019 Oracle Database Training

    14/35

    Oracle Architecture

    Background Processes - CKPT Forces all modifieddata in the SGA to bewritten todatafile

    Occurs whether or not the data has been

    committed CKPTdoes not actually write out buffer data onlyDBWR can write to the datafiles

    Updates the datafile headers This ensures all datafiles are synchronized

    Helps reduce the amount of time needed toperform instance recovery

    Frequency can be adjusted with parameters

  • 8/3/2019 Oracle Database Training

    15/35

    Oracle Architecture

    Background Processes - ARCH Automatically copies online redo logfilestodesignated storage once they havebecome full

  • 8/3/2019 Oracle Database Training

    16/35

    Oracle ArchitectureServer Processes

    Services a single user process in the dedicatedserver configurationor many user processes in theshared server configuration

    Use an exclusive PGA

    Include the Oracle Program Interface (OPI)

    Process calls generated by the client

    Return results to the client in the dedicatedserver configurationor to the dispatcher in theshared server configuration

  • 8/3/2019 Oracle Database Training

    17/35

    Oracle ArchitectureUser Processes

    Runon the client machine

    Are spawned when a tool or an

    applicationis invoked SQL*Plus, Server Manager, OracleEnterprise Manager, Developer/2000

    Custom applications

    Include the User Program Interface (UPI)

    Generate calls to the Oracle server

  • 8/3/2019 Oracle Database Training

    18/35

    The Physical Layer

    The physical layer of the database consists of three types offiles:

    One or more datafiles--Datafiles store the informationcontainedin thedatabase. You can have as few as one datafile or as many as hundreds ofdatafiles. The informationfor a single table can span many datafiles or manytables can share a set ofdatafiles. Spreading tablespaces over many datafilescan have a significant positive effect onperformance. The number ofdatafilesthat can be configuredis limited by the Oracle parameter MAXDATAFILES.

    Twoor more redo logfiles--Redo logfiles holdinformation usedforrecovery in the event of a system failure. Redo logfiles, known as the redo log,store a logof all changes made to the database. This informationis usedin theevent of a system failure to reapply changes that have been made andcommitted but that might not have been made to the datafiles. The redo logfiles must perform well and be protected against hardware failures (throughsoftware or hardware fault tolerance). If redo loginformationis lost, youcannot recover the system.

  • 8/3/2019 Oracle Database Training

    19/35

    Oracle Database The Physical Layer

    One or more control files--Control filescontaininformation used to start aninstance, such as the locationofdatafilesand redo logfiles; Oracle needs thisinformation to start the database instance.Control files must be protected. Oracle

    provides a mechanism for storing multiplecopies ofcontrol files.

  • 8/3/2019 Oracle Database Training

    20/35

    The Logical Layer

    The logical layer of the database consistsof the following elements:

    One or more tablespaces. The database schema, which consists ofitems such as tables, clusters, indexes,views, storedprocedures, database triggers,sequences, and soon.

  • 8/3/2019 Oracle Database Training

    21/35

    The Logical Layer

  • 8/3/2019 Oracle Database Training

    22/35

    Segments, Extents, andData Blocks

    Within Oracle, the space used to store data iscontrolled by the use of logical structures. Thesestructures consist of the following:

    Data blocks--A blockis the smallest unit ofstorage in an Oracle database. The database block

    contains header informationconcerning the blockitself as well as the data.

    Extents--Extents consist ofdata blocks. Segments--A segment is a set of extents usedto store a particular type ofdata, as shownin

  • 8/3/2019 Oracle Database Training

    23/35

    Segments, Extents, andData Blocks

  • 8/3/2019 Oracle Database Training

    24/35

    Installation Of Oracle Database onLinux

    Adddba group

    Addoinstall group

    Create & addoracle user tooinstall & dba

    group

    Set the Kernel parameters.

    set the parameters in limits.conf Set .bash_profile

  • 8/3/2019 Oracle Database Training

    25/35

    Installation Of Oracle Database onLinux ( rpms required for oracle 10g)

    cd /media/cdrom/RedHat/RPMS

    rpm -Uvh setarch-1*

    rpm -Uvh compat-libstdc++-33-3*

    rpm -Uvh make-3* rpm -Uvh glibc-2*

    rpm -Uvh openmotif-2*

    rpm -Uvh compat-db-4*

    rpm -Uvh libaio-0*

    rpm -Uvh gcc-3*

    rpm -Uvh compat-gcc-32-3*

    rpm -Uvh compat-gcc-32-c++-3*

  • 8/3/2019 Oracle Database Training

    26/35

    Oracle Network Enviroment

  • 8/3/2019 Oracle Database Training

    27/35

    Oracle Network Enviroment

  • 8/3/2019 Oracle Database Training

    28/35

    Oracle Network Enviroment

  • 8/3/2019 Oracle Database Training

    29/35

    Oracle Network Enviroment

  • 8/3/2019 Oracle Database Training

    30/35

    User Creation

  • 8/3/2019 Oracle Database Training

    31/35

    User Creation

    Syntax:

    CREATEUSER username IDENTIFIED {BYpassword | EXTERNALLY | GLOBALLY AS

    'external_name'} options; options: DEFAULTTABLESPACE tablespaceTEMPORARY TABLESPACE tablespace QUOTA int{K | M} ON tablespace QUOTA UNLIMITEDONtablespace PROFILE profile_name PASSWORDEXPIRE ACCOUNT {LOCK|UNLOCK}

  • 8/3/2019 Oracle Database Training

    32/35

    Backup & Recovery

    Types ofBackup

    Logical Backup

    ColdBackup Hot Backup

    RmanBackup

  • 8/3/2019 Oracle Database Training

    33/35

    RMAN Overview

    Recovery Manager (RMAN)

    Recovery manager is a platform

    independent utility for coordinating yourbackup and restoration procedures acrossmultiple servers

  • 8/3/2019 Oracle Database Training

    34/35

    RMAN

    Create Recovery Catalog

    Register Database

    Full Backup

    Restore & Recover The WholeDatabase

    Restore & Recover A Subset OfThe Database

    Incomplete Recovery

    Disaster Recovery

    Lists And Reports

  • 8/3/2019 Oracle Database Training

    35/35

    thank you

    Confidential | Copyright 2011 MindCraft Software Pvt. Ltd. All Rights Reserved | www.mindcraft.in