oracle basics

Upload: raghunath-reddy

Post on 14-Apr-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Oracle Basics

    1/30

    1

    - Kishore Soma

    Oracle BasicsSAPs perspective

  • 7/29/2019 Oracle Basics

    2/30

    2

    Contents

    Oracle History

    Oracle architecture

    DB Startup options

    DB shut down options

    Database mode

    Backup types

    Limitations of Oracle database Troubleshooting tips

    References

  • 7/29/2019 Oracle Basics

    3/30

    3

    Oracle History

    History of Oracle

    1977Larry Ellison and friends founded software Development Laboratory

    1979 - SDL changed its company-name to "Relational Software, Inc." (RSI) and introduced itsproduct Oracle V2 as an early commercially-available relational database system

    1982: RSI in its turn changed its name, becoming known as "Oracle Corporation",

    1984: Oracle Corporation released Oracle version 4, which supported read-consistency.

    1985: Oracle Corporation released Oracle version 5, , which supported the client-server model

    1988: Oracle RDBMS version 6 came out with support for PL/SQL embedded within OracleForms v3, row-level locking and hot backups.

    1989: Oracle Corporation entered the application products market and developed its ERPproduct, (later to become part of the Oracle E-Business Suite

    1992: Oracle version 7 appeared with support for referential integrity, stored procedures andtriggers.

    1999: The release of Oracle8i aimed to provide a database inter-operating better with the Internet

    2001: Oracle9i went into release with 400 new features

    2003: Oracle Corporation released Oracle Database 10g. (Thegstands for "grid"; emphasizing amarketing thrust of presenting 10g as "grid-computing ready".)

    2005: Oracle Database 10.2.0.1also known as Oracle Database 10g Release 2 (10gR2)appeared

    2007: Oracle Corporation released Oracle Database 11g for Linux and for Microsoft Windows.

  • 7/29/2019 Oracle Basics

    4/30

    4

    Oracle Architecture

    Contd.

  • 7/29/2019 Oracle Basics

    5/30

    5

    Oracle Architecture Contd.,

    Oracle Memory structure

    Oracles memory structure consists of two memory areas known as:

    System Global Area (SGA): Allocated at instance startup, and is a

    fundamental component of an Oracle Instance- The parameter used to define SGA is SGA_MAX_SIZE

    Program Global Area (PGA): Allocated when the server process is started

  • 7/29/2019 Oracle Basics

    6/30

    6

    Oracle Architecture Contd.,

    The Oracle database has a logical layer and a physical layer. The physical layerconsists of the files that reside on the disk; the components of the logical layer

    map the data to these physical components.

    The physical structure

    The Logical structure

  • 7/29/2019 Oracle Basics

    7/307

    Oracle Architechture Contd.,

    The Physical Structure

    Data files

    - The datafiles contain all the database data. The data of logical database structures,

    such as tables and indexes, is physically stored in the datafiles allocated for a

    database.

    Control Files

    - Every Oracle database has a control file. A control file contains entries that

    specify the physical structure of the database such as Database name and the

    Names and locations of datafiles and redo log files.

    Redo Log Files

    - The primary function of the redo log is to record all changes made to data. If a

    failure prevents modified data from being permanently written to the datafiles,

    then the changes can be obtained from the redo log, so work is never lost.

  • 7/29/2019 Oracle Basics

    8/308

    Oracle Architecture Contd.,

    The physical structure (contd.,)

    Archive Log Files

    - Oracle automatically archives log files when the database is inARCHIVELOG mode. This prevents oracle from overwriting the redo logfiles before they have been safely archived to another location.

    Parameter Files

    - Parameter files contain a list of configuration parameters for that instanceand database.

    Alert and Trace Log Files

    - Each server and background process can write to an associated trace file.When an internal error is detected by a process, it dumps informationabout the error to its trace file. The alert log of a database is achronological log of messages and errors.

  • 7/29/2019 Oracle Basics

    9/309

    Oracle Architecture Contd.,

    Logical Structure

    Tablespaces

    - A database is divided into logical storage units called tablespaces, which group

    related logical structures together. One or more datafiles are explicitly created for

    each tablespace to physically store the data of all logical structures in a tablespace.

    Oracle Data Blocks

    - At the finest level of granularity, Oracle database data is stored in data blocks.

    One data block corresponds to a specific number of bytes of physical database

    space on disk. The standard block size is specified by the DB_BLOCK_SIZE

    initialization parameter.

  • 7/29/2019 Oracle Basics

    10/3010

    Oracle Architecture Contd.,

    Logical Structure (contd.,)

    Extents

    - The next level of logical database space is an extent. An extent is a specific number of

    contiguous data blocks, obtained in a single allocation, used to store a specific type of

    information.

    Segments

    - Above extents, the level of logical database storage is a segment. A segment is a set of extents

    allocated for a certain logical structure. The different types of segments are :

    Data segmentstores table data

    Index segmentstores index data

    Temporary segmenttemporary space used during SQL execution

    Rollback Segmentstores undo information

    Schema Overview

    - A schema is a collection of database objects. A schema is owned by a database user and has

    the same name as that user. Schema objects are the logical structures that directly refer to the

    database's data. Schema objects include structures like tables, views, and indexes.

  • 7/29/2019 Oracle Basics

    11/3011

    Oracle Architecture Contd.,

    Oracle Process Structure

    Oracle takes advantage of various types of processes:

    User process: Started at the time a database user requests connection to the

    Oracle server

    Server process: Connects to the Oracle Instance and is started when a user

    establishes a session

    Background processes: Started when an Oracle Instance is started

  • 7/29/2019 Oracle Basics

    12/3012

    Background process- DBWn (DBwriter) This background process is responsible for managing the

    contents of the data block buffer cache and dictionary cache. DBWR performsbatch writes of changed block.

    - PMONprocess cleans up failed user processes. PMON is responsible forreleasing the lock i.e. cleaning up the cache and freeing resources that the processwas using

    - CKPT All modified information in database buffer in the SGA is written to thedatafiles by a database write process (DBWR). This event indicates a checkpoint.The checkpoint process is responsible for signaling DBWR at checkpoints andupdating all of the datafiles and control files of the database.

    - LGWRprocess manages the writing of the contents of the redo log buffer to theonline redo log files. LGWR writes the log entries in batch form. The Redo log

    buffers entries always contain the most up-to-date status of the database.

    - Arch The Archiver process reads the redo log files once Oracle has filled themand writes a copy of the used redo log files to the specified archive logdestination(s).

    - SMON-process performs instance recovery at the start of the database.SMON also cleans up temporary segments that are no longer in use

    Oracle Architecture Contd.,

  • 7/29/2019 Oracle Basics

    13/3013

    Oracle Architecture Contd.,

    Directory structure of Oracle (As per SAP standards)

    There are the following main structures:

    $ORACLE_HOME for Oracle-specific objects with the default directory/oracle//

    $SAPDATA_HOME for SAP-specific objects with the default directory

    /oracle/ Executables with the directory /usr/sap//SYS/exe/run

    Oracle Home directory

    $ORACLE_HOME/dbs/- spfile.ora: Oracle spfile

    - init.ora: Profile for Oracle

    - init.sap: Profile for BR*Tools- cntrl.dbf: Database control file

    $ORACLE_HOME/bin/ contains binaries such as oracle, sqlplus, exp, imp

    rwsr-xr-x ora dba oracle

  • 7/29/2019 Oracle Basics

    14/3014

    Oracle Architecture Contd.,

    Online Redo-Logs directories- /oracle//origlogA/

    log_g11m1.dbf

    log_g13m1.dbf

    - /oracle//origlogB/

    log_g12m1.dbf

    log_g14m1.dbf

    - /oracle//mirrlogA/

    log_g11m2.dbf

    log_g13m2.dbf

    - /oracle//mirrlogB/

    log_g12m2.dbf

    log_g14m2.dbf

    SAPData directories

    - sapdata1/

    cntrl/cntrl.dbf: Database control file

    system_1/system.data1

    - sapdata/

  • 7/29/2019 Oracle Basics

    15/3015

    Oracle Architecture Contd.,

    saparch/ - This directory will have the log files of archive log backup takenwith brarchive

    sapbackup/ - This directory contains the backup log files, brbackup logs

    Sapcheck/ - This directory contains logs of update statistics, checkdb, cleanup

    logs, etc

    saptrace/- background/

    alert_.log: Oracle Alert file

    *.trc: Oracle trace files

    - usertrace/

    *.trc: User trace files

    oraarch/: Oracle offline redo log files

  • 7/29/2019 Oracle Basics

    16/3016

    Oracle Architecture Contd.,

    Naming conventi ons of Data F i les

    The naming conventions are as follows:

    - Directory: /sapdata/_

    - File: .data

    is the second half of the tablespace name, for example,

    UNDO for the tablespace PSAPUNDO. is the sequentially assigned number of the SAP directory in which the data

    file will be stored.

    is the sequentially assigned number of the data file in thetablespace. The same number also appears in the subdirectory that is createdfor each new file in a tablespace.

    For example, the first data file for PSAPUNDO is called:- Directory: /sapdata/undo_1

    - File: undo.data1

  • 7/29/2019 Oracle Basics

    17/3017

    Parameter files

    Parameter file

    init.ora file, which is a normal disk file. It is still used for viewing

    by many SAP transactions, so must be kept up-to-date with the newer spfile

    (see below).

    Spfile.ora, which is a new binary server-side parameter file

    introduced by Oracle, available as part of the standard installation from SAP

    Web AS 6.40. If your SAP system was upgraded from an older release, you

    have to create it yourself initially using SQL*Plus because it was not part of

    older SAP installations.

  • 7/29/2019 Oracle Basics

    18/3018

    DB startup options

    Type What Happens How

    No mount

    Database instance is built up

    Operating system resources are allocated using configuration

    information stored in the profile init.ora or the spfile.

    brspace -f dbstart -s nomount

    SQL> startup nomount

    MountDatabase control files are evaluated.Information about the file structure of the database is read

    Data files and logs are not yet opened.

    brspace -f dbstart -s mount

    SQL> startup mount

    Open

    All files in the database system are opened.

    If required, instance recovery is performed immediately after

    opening the database.Pending database transactions are ended.

    brspace -f dbstart

    SQL> startup

    http://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/46/af75292aad62d1e10000000a1553f7/content.htm
  • 7/29/2019 Oracle Basics

    19/3019

    DB shutdown options

    Type What Happens How

    Normal

    No new database logon possible.

    After all database user have logged off, the database is closed

    properly: all files are closed, the database is dismounted, and the

    instance is shut down.

    The database is consistent after shutdown.

    brspace -f dbshut -m normal

    SQL> shutdown

    Immediate

    Only the current commands are executed.

    PMON ends all sessions and performs a rollback of the open

    transactions.The database is then closed properly (as for a normal shutdown).

    The database is consistent after shutdown.

    DBWR and ARCH might require up to 1 hour post-processing

    time.

    brspace -f dbshut -m immediate

    SQL> shut immediate

    Transactional

    No new connections are allowed and no new transactions can be

    started.

    Oracle waits for all open transactions to finish, then disconnects all

    users (that is, work processes in the SAP system) and shuts downthe database.

    brspace -f dbshut -m transactional

    SQL>shut transactional

    Abort

    Emergency database shutdown

    Users are not logged off and open transactions are not rolled back.

    The database is notconsistent after shutdown.

    An instance recovery is automatically performed at the next

    database startup.

    brspace -f dbshut -m abort

    SQL> shut abort

    http://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htmhttp://help.sap.com/saphelp_nwpi71/helpdata/en/47/3093525d54341fe10000000a1553f6/content.htm
  • 7/29/2019 Oracle Basics

    20/30

    20

    Database Modes

    Noarchive log mode

    In this Mode, there will not be any offline redolog files archived. If the database

    is in noarchive log mode, online redo logs can (and will) be overwritten without

    making sure they are saved. This implies that a database cannot be recovered even

    if backups were made.

    Archive log mode

    If the database is in archive log mode, the database makes sure that online redo

    logs are not overwritten before the have been archived i.e., online redo logs are

    archived in this mode

    http://www.adp-gmbh.ch/ora/concepts/online_redo_logs.htmlhttp://www.adp-gmbh.ch/ora/concepts/online_redo_logs.html
  • 7/29/2019 Oracle Basics

    21/30

    21

    Backup Types

    OnlineThe starting point of the backup is set using the command ALTER

    TABLESPACE BEGIN BACKUP. The header of thetablespace files holds information on the checkpoint and redo log files, that is,the system change number (SCN). When the next redo log file switch orcheckpoint occurs (normal database operations continue), the headerinformation remains unchanged.

    Once the backup of the tablespace is complete, the command ALTERTABLESPACE END BACKUP makes sure that theheader information of the files is updated.

    Offline

    After an offline backup of the complete database, you have a backup of thedatabase that is consistent. If you work with the database after the backup, thebackup is no longer up-to-date. In this case, you have to recover the databaseafter you restore the backup, using the redo log files.

  • 7/29/2019 Oracle Basics

    22/30

    22

    Backup types Contd.,

    Online_cons- In this backup, the archive logs generated during the backup are also taken

  • 7/29/2019 Oracle Basics

    23/30

    23

    Backup Types Contd.,

    Whole backup

    Backs up all database files, but this backup is not cataloged as a level-0 backup, whichmeans that you cannot use it as a reference backup for an incremental backup withRMAN. The syntax for a whole backup is as follows:

    - In profile init.sap: backup_mode = all

    - With BRBACKUP: brbackup -m all

    Full backup

    Backs up all database files. You can perform a full backup with or without RMAN. If youdo not use RMAN, then RMAN is called separately to catalog the backup as level 0.This means that you can use this backup as a reference backup for an incrementalbackup with RMAN. The syntax for a full backup is:

    - In profile init.sap: backup_mode = full

    - With BRBACKUP: brbackup -m full

    In the context of the Recovery Manager this backup is an incremental level-0 backup

  • 7/29/2019 Oracle Basics

    24/30

    24

    Backup types Contd.,

    Incremental backupTo be able to make an incremental backup, we must first make a full backup

    (level 0). A full backup of the database backs up all Oracle database blocks

    that have already been used to store data.

    We can then make incremental backups. An incremental backup (level 1,

    cumulative) of the database backs up all Oracle database blocks that have

    changed since the last full backup (level 0).

  • 7/29/2019 Oracle Basics

    25/30

    25

    Limitations of Oracle

    Maximum number of files per database - DB_FILES- Soft limit

    The SAP software value for DB_FILES is 254.

    - Hard limit

    The hard limit for DB_FILES depends on the operating system but is usually 1022 per

    tablespace and 65533 per database.

    The Maximum data file size depends Operation System

    Minimum Oracle 10.2 patchset is 10.2.0.2

    - Oracle 10.2.0.1 is an UNSUPPORTED version

    - 10.2.0.3 is not supported in SAP environments

    Oracle version 9.2 left Oracle Customer Care support end July 2008- SAP customers who use Oracle 9.2 after 31 July 2010 will be affected regardless

    of where they purchased the Oracle license (from SAP or Oracle)

    Oracle version 10.1 left Oracle Customer Care support end Jan 2009

  • 7/29/2019 Oracle Basics

    26/30

    26

    SAPs Oracle support end dates

  • 7/29/2019 Oracle Basics

    27/30

    27

    Troubleshooting Tips

    Alert log file - Oracle's alert.log chronologically records messages and errorsarising from the daily database operation.

    - The directory where it is found can be determined by the

    background_dump_dest initialization parameter

    - The naming convention of the alert log file is alert_.log

    DB connectivity

    - The db connectivity can be test with SAP program; R3trans (R3trans is used to

    transport data between SAP Systems and for the migration between different SAP

    releases. )

    - To test the connectivity;

    R3transx or R3transd (this will logon to the database and check for the connectivity

    with SAP and DB)

  • 7/29/2019 Oracle Basics

    28/30

    28

  • 7/29/2019 Oracle Basics

    29/30

    29

    References

    http://Help.sap.com http://en.wikipedia.org

    http://service.sap.com

    http://sdn.sap.com/irj/dba

    http://help.sap.com/http://en.wikipedia.org/http://service.sap.com/http://sdn.sap.com/irj/dbahttp://sdn.sap.com/irj/dbahttp://service.sap.com/http://en.wikipedia.org/http://help.sap.com/
  • 7/29/2019 Oracle Basics

    30/30

    Kishore Soma

    Engineer

    SAP BASIS TeamGSMC

    Wipro Ltd (Infotech Div.)