Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to OracleIntroduction to Oracle
 Physical StructurePhysical Structure
 Logical StructureLogical Structure
...
Physical StructuresPhysical Structures
 Datafiles (*.dbf)Datafiles (*.dbf)
 The datafiles contain all the database data....
Physical Structures (cont’d)Physical Structures (cont’d)
 Archive Log Files (*.log)Archive Log Files (*.log)
 Oracle aut...
Logical StructuresLogical Structures
 TablespacesTablespaces
 A database is divided into logical storage units called ta...
Logical Structures (cont’d)Logical Structures (cont’d)
 ExtentsExtents
 The next level of logical database space is an e...
Logical Structures (cont’d)Logical Structures (cont’d)
 Schema OverviewSchema Overview
 A schema is a collection of data...
Oracle InstanceOracle Instance
An Oracle database server consists of anAn Oracle database server consists of an
Oracle dat...
System Global Area (SGA)System Global Area (SGA)
The System Global Area (SGA) is a shared memory region that contains data...
System Global Area (cont’d)System Global Area (cont’d)
 Redo Log Buffer of the SGARedo Log Buffer of the SGA
 The redo l...
Program Global Area (PGA)Program Global Area (PGA)
PGA is a memory buffer that contains data and control information for a...
Oracle Background ProcessesOracle Background Processes
An Oracle database uses memory structures and processes to manage a...
Background Processes (cont’d)Background Processes (cont’d)
 Process Monitor - PMONProcess Monitor - PMON
 This database ...
Background Processes (cont’d)Background Processes (cont’d)
 Log Writer - LGWRLog Writer - LGWR
 This background process ...
Background Processes (cont’d)Background Processes (cont’d)
 Checkpoint - CKPTCheckpoint - CKPT
 All modified information...
Computer Science DatabaseComputer Science Database
Server InformationServer Information
 Sun e4500Sun e4500
 8GB Ram8GB ...
Computer Science DatabaseComputer Science Database
 Instance Name : CS01 (v$database)Instance Name : CS01 (v$database)
 ...
Backup MethodsBackup Methods
 Cold Backup (aka Consistent Backups)Cold Backup (aka Consistent Backups)
 The only way to ...
Backup Methods (cont’d)Backup Methods (cont’d)
 Hot Backup (aka Inconsistent Backups)Hot Backup (aka Inconsistent Backups...
Backup Methods (cont’d)Backup Methods (cont’d)
 Logical backup (Export)Logical backup (Export)
 Logical backups are expo...
Administrative TasksAdministrative Tasks
 Daily ChecksDaily Checks
 Check database availabilityCheck database availabili...
Administrative Tasks (cont’d)Administrative Tasks (cont’d)
 Weekly TasksWeekly Tasks
 Collect statistics (database job)C...
Administrative Tasks (cont’d)Administrative Tasks (cont’d)
 OthersOthers
 Applying patchesApplying patches
 Database up...
More InformationMore Information
 Oracle 10g Release 2 Database DocumentationOracle 10g Release 2 Database Documentation
...
Introduction to oracle
Introduction to oracle
Introduction to oracle
Introduction to oracle
Upcoming SlideShare
Loading in …5
×

Introduction to oracle

2,382 views

Published on

Introduction to oracle(2) & concept explained easily

  • Be the first to comment

Introduction to oracle

  1. 1. Introduction to OracleIntroduction to Oracle  Physical StructurePhysical Structure  Logical StructureLogical Structure  SGA / PGASGA / PGA  Background ProcessesBackground Processes Backup MethodsBackup Methods  Computer Science Database – CS01Computer Science Database – CS01  Administrative TasksAdministrative Tasks
  2. 2. Physical StructuresPhysical Structures  Datafiles (*.dbf)Datafiles (*.dbf)  The datafiles contain all the database data. The data of logical databaseThe datafiles contain all the database data. The data of logical database structures, such as tables and indexes, is physically stored in the datafilesstructures, such as tables and indexes, is physically stored in the datafiles allocated for a database.allocated for a database.  Control Files (*.ctl)Control Files (*.ctl)  Every Oracle database has a control file. A control file contains entries thatEvery Oracle database has a control file. A control file contains entries that specify the physical structure of the database such as Database name and thespecify the physical structure of the database such as Database name and the Names and locations of datafiles and redo log files.Names and locations of datafiles and redo log files.  Redo Log Files (*.log)Redo Log Files (*.log)  The primary function of the redo log is to record all changes made to data. If aThe 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,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.then the changes can be obtained from the redo log, so work is never lost.
  3. 3. Physical Structures (cont’d)Physical Structures (cont’d)  Archive Log Files (*.log)Archive Log Files (*.log)  Oracle automatically archives log files when the database is in ARCHIVELOGOracle automatically archives log files when the database is in ARCHIVELOG mode. This prevents oracle from overwriting the redo log files before they havemode. This prevents oracle from overwriting the redo log files before they have been safely archived to another location.been safely archived to another location.  Parameter Files (initSID.ora)Parameter Files (initSID.ora)  Parameter files contain a list of configuration parameters for that instance andParameter files contain a list of configuration parameters for that instance and database.database.  Alert and Trace Log Files (*.trc)Alert and Trace Log Files (*.trc)  Each server and background process can write to an associated trace file. When an internalEach server and background process can write to an associated trace file. When an internal error is detected by a process, it dumps information about the error to its trace file. The alerterror is detected by a process, it dumps information about the error to its trace file. The alert log of a database is a chronological log of messages and errors.log of a database is a chronological log of messages and errors.
  4. 4. Logical StructuresLogical Structures  TablespacesTablespaces  A database is divided into logical storage units called tablespaces, which groupA database is divided into logical storage units called tablespaces, which group related logical structures together. One or more datafiles are explicitly created forrelated logical structures together. One or more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in aeach tablespace to physically store the data of all logical structures in a tablespace.tablespace.  Oracle Data BlocksOracle Data Blocks  At the finest level of granularity, Oracle database data is stored in 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 databaseOne 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_SIZEspace on disk. The standard block size is specified by the DB_BLOCK_SIZE initialization parameter.initialization parameter.
  5. 5. Logical Structures (cont’d)Logical Structures (cont’d)  ExtentsExtents  The next level of logical database space is an extent. An extent is a specificThe 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 anumber of contiguous data blocks, obtained in a single allocation, used to store a specific type of information.specific type of information.  SegmentsSegments  Above extents, the level of logical database storage is a segment. A segment isAbove 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 ofa set of extents allocated for a certain logical structure. The different types of segments are :segments are :  Data segment – stores table dataData segment – stores table data  Index segment – stores index dataIndex segment – stores index data  Temporary segment – temporary space used during SQL executionTemporary segment – temporary space used during SQL execution  Rollback Segment – stores undo informationRollback Segment – stores undo information
  6. 6. Logical Structures (cont’d)Logical Structures (cont’d)  Schema OverviewSchema Overview  A schema is a collection of database objects. A schema is owned by a databaseA 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 logicaluser and has the same name as that user. Schema objects are the logical structures that directly refer to the database's data. Schema objects includestructures that directly refer to the database's data. Schema objects include structures like tables, views, and indexes.structures like tables, views, and indexes.
  7. 7. Oracle InstanceOracle Instance An Oracle database server consists of anAn Oracle database server consists of an Oracle database and an Oracle instance.Oracle database and an Oracle instance. Every time a database is started, a systemEvery time a database is started, a system global area (SGA) is allocated and Oracleglobal area (SGA) is allocated and Oracle background processes are started. Thebackground processes are started. The combination of the background processescombination of the background processes and memory buffers is called an Oracleand memory buffers is called an Oracle instance.instance.
  8. 8. System Global Area (SGA)System Global Area (SGA) The System Global Area (SGA) is a shared memory region that contains data andThe System Global Area (SGA) is a shared memory region that contains data and control information for one Oracle instance. Users currently connected to an Oraclecontrol information for one Oracle instance. Users currently connected to an Oracle database share the data in the SGA. The SGA contains the following memorydatabase share the data in the SGA. The SGA contains the following memory structures :structures :  Database Buffer CacheDatabase Buffer Cache  Database buffers store the most recently used blocks of data. The set ofDatabase buffers store the most recently used blocks of data. The set of database buffers in an instance is the database buffer cache. The buffer cachedatabase buffers in an instance is the database buffer cache. The buffer cache contains modified as well as unmodified blocks. Because the most recently (andcontains modified as well as unmodified blocks. Because the most recently (and often, the most frequently) used data is kept in memory, less disk I/O isoften, the most frequently) used data is kept in memory, less disk I/O is necessary, and performance is improved.necessary, and performance is improved.
  9. 9. System Global Area (cont’d)System Global Area (cont’d)  Redo Log Buffer of the SGARedo Log Buffer of the SGA  The redo log buffer stores redo entries—a log of changes made to the database.The redo log buffer stores redo entries—a log of changes made to the database. The redo entries stored in the redo log buffers are written to an online redo log,The redo entries stored in the redo log buffers are written to an online redo log, which is used if database recovery is necessary. The size of the redo log iswhich is used if database recovery is necessary. The size of the redo log is static.static.  Shared Pool of the SGAShared Pool of the SGA  The shared pool contains shared memory constructs, such as shared SQL areas.The shared pool contains shared memory constructs, such as shared SQL areas. A shared SQL area is required to process every unique SQL statement submittedA shared SQL area is required to process every unique SQL statement submitted to a database. A shared SQL area contains information such as the parse treeto a database. A shared SQL area contains information such as the parse tree and execution plan for the corresponding statement.and execution plan for the corresponding statement.
  10. 10. Program Global Area (PGA)Program Global Area (PGA) PGA is a memory buffer that contains data and control information for aPGA is a memory buffer that contains data and control information for a server process. A server process is a process that services a client’sserver process. A server process is a process that services a client’s requests. A PGA is created by oracle when a server process is started. Therequests. A PGA is created by oracle when a server process is started. The information in a PGA depends on the oracle configuration. The PGA area isinformation in a PGA depends on the oracle configuration. The PGA area is a non-shared area of memory created by oracle when a server process isa non-shared area of memory created by oracle when a server process is started.started. The basic difference between SGA and PGA is that PGA cannot be sharedThe basic difference between SGA and PGA is that PGA cannot be shared between multiple processes in the sense that it is used only forbetween multiple processes in the sense that it is used only for requirements of a particular process whereas the SGA is used for the wholerequirements of a particular process whereas the SGA is used for the whole instance and it is shared.instance and it is shared.
  11. 11. Oracle Background ProcessesOracle Background Processes An Oracle database uses memory structures and processes to manage and accessAn Oracle database uses memory structures and processes to manage and access the database. All memory structures exist in the main memory of the computers thatthe database. All memory structures exist in the main memory of the computers that constitute the database system. Processes are jobs that work in the memory of theseconstitute the database system. Processes are jobs that work in the memory of these computers.computers. Oracle creates a set of background processes for each instance. The backgroundOracle creates a set of background processes for each instance. The background processes consolidate functions that would otherwise be handled by multiple Oracleprocesses consolidate functions that would otherwise be handled by multiple Oracle programs running for each user process. They asynchronously perform I/O andprograms running for each user process. They asynchronously perform I/O and monitor other Oracle processes to provide increased parallelism for bettermonitor other Oracle processes to provide increased parallelism for better performance and reliability.performance and reliability. The most common background processes are :The most common background processes are :  System Monitor – SMONSystem Monitor – SMON  This database background process performs instance recovery at the start of theThis database background process performs instance recovery at the start of the database. SMON also cleans up temporary segments that are no longer in usedatabase. SMON also cleans up temporary segments that are no longer in use and recovers dead transactions skipped during crash and instance recoveryand recovers dead transactions skipped during crash and instance recovery because of file-read or offline errors. It coalesces i.e. combines contiguous freebecause of file-read or offline errors. It coalesces i.e. combines contiguous free extents into larger free extents.extents into larger free extents.
  12. 12. Background Processes (cont’d)Background Processes (cont’d)  Process Monitor - PMONProcess Monitor - PMON  This database background process cleans up failed user processes. PMON isThis database background process cleans up failed user processes. PMON is responsible for releasing the lock i.e. cleaning up the cache and freeingresponsible for releasing the lock i.e. cleaning up the cache and freeing resources that the process was using. Its effect can be seen when a processresources that the process was using. Its effect can be seen when a process holding a lock is killed.holding a lock is killed.  Database Writer - DBWRDatabase Writer - DBWR  This background process is responsible for managing the contents of the dataThis background process is responsible for managing the contents of the data block buffer cache and dictionary cache. DBWR performs batch writes ofblock buffer cache and dictionary cache. DBWR performs batch writes of changed block. Since Oracle uses write-ahead logging, DBWR does not need tochanged block. Since Oracle uses write-ahead logging, DBWR does not need to write blocks when a transaction commits. In the most common case, DBWRwrite blocks when a transaction commits. In the most common case, DBWR writes only when more data needs to be read into the system global area and toowrites only when more data needs to be read into the system global area and too few database buffers are free. The least recently used data is written to thefew database buffers are free. The least recently used data is written to the datafiles first.datafiles first.  Although there is only one SMON and one PMON process running per databaseAlthough there is only one SMON and one PMON process running per database instance, one can have multiple DBWR processes running at the same time.instance, one can have multiple DBWR processes running at the same time. Note the number of DBWR processes running is set via theNote the number of DBWR processes running is set via the DB_WRITER_PROCESSES.DB_WRITER_PROCESSES.
  13. 13. Background Processes (cont’d)Background Processes (cont’d)  Log Writer - LGWRLog Writer - LGWR  This background process manages the writing of the contents of the redo logThis background process manages the writing of the contents of the redo log buffer to the online redo log files. LGWR writes the log entries in batch form. Thebuffer to the online 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 theRedo log buffers entries always contain the most up-to-date status of the database.database.  Archiver - ARCHArchiver - ARCH  The Archiver process reads the redo log files once Oracle has filled them andThe Archiver process reads the redo log files once Oracle has filled them and writes a copy of the used redo log files to the specified archive log destination(s).writes a copy of the used redo log files to the specified archive log destination(s). Actually, for most databases, ARCH has no effect on the overall systemActually, for most databases, ARCH has no effect on the overall system performance. On some large database sites, however, archiving can have anperformance. On some large database sites, however, archiving can have an impact on system performance.impact on system performance.
  14. 14. Background Processes (cont’d)Background Processes (cont’d)  Checkpoint - CKPTCheckpoint - CKPT  All modified information in database buffer in the SGA is written to the datafilesAll modified information in database buffer in the SGA is written to the datafiles by a database write process (DBWR). This event indicates a checkpoint. Theby a database write process (DBWR). This event indicates a checkpoint. The checkpoint process is responsible for signaling DBWR at checkpoints andcheckpoint process is responsible for signaling DBWR at checkpoints and updating all of the datafiles and control files of the database.updating all of the datafiles and control files of the database.  Recover - RECORecover - RECO  The recover process automatically cleans up failed or suspended distributedThe recover process automatically cleans up failed or suspended distributed transactions.transactions.  Job Queue ProcessesJob Queue Processes  Job queue processes are used for batch processing. They run user jobs. TheyJob queue processes are used for batch processing. They run user jobs. They can be viewed as a scheduler service that can be used to schedule jobs ascan be viewed as a scheduler service that can be used to schedule jobs as PL/SQL statements or procedures on an Oracle instance. Given a start date andPL/SQL statements or procedures on an Oracle instance. Given a start date and an interval, the job queue processes try to run the job at the next occurrence ofan interval, the job queue processes try to run the job at the next occurrence of the interval.the interval.
  15. 15. Computer Science DatabaseComputer Science Database Server InformationServer Information  Sun e4500Sun e4500  8GB Ram8GB Ram  8 x 400mhz CPU8 x 400mhz CPU  32GB Disk for32GB Disk for OracleOracle  4mm DAT DDS34mm DAT DDS3 Tape BackupTape Backup
  16. 16. Computer Science DatabaseComputer Science Database  Instance Name : CS01 (v$database)Instance Name : CS01 (v$database)  Instance Version : 8.1.6.0.0Instance Version : 8.1.6.0.0  Tablespaces : (dba_tablespaces)Tablespaces : (dba_tablespaces)  SYSTEM – holds all system tablesSYSTEM – holds all system tables  INDEX01 – user indexesINDEX01 – user indexes  USERS01 – user tablesUSERS01 – user tables  USERS02 – user tables (faculty)USERS02 – user tables (faculty)  RBS – rollback segmentsRBS – rollback segments
  17. 17. Backup MethodsBackup Methods  Cold Backup (aka Consistent Backups)Cold Backup (aka Consistent Backups)  The only way to make a consistent whole databaseThe only way to make a consistent whole database backup is to shut down the database with thebackup is to shut down the database with the NORMAL, IMMEDIATE, or TRANSACTIONALNORMAL, IMMEDIATE, or TRANSACTIONAL options and make the backup while the database isoptions and make the backup while the database is closed.closed.  Advantage : No recovery is required after datafiles areAdvantage : No recovery is required after datafiles are restored – quicker restorerestored – quicker restore  Disadvantage : No access to database during backupDisadvantage : No access to database during backup time (depends on size/system speed)time (depends on size/system speed)
  18. 18. Backup Methods (cont’d)Backup Methods (cont’d)  Hot Backup (aka Inconsistent Backups)Hot Backup (aka Inconsistent Backups)  If the database must be up and running 24 hours aIf the database must be up and running 24 hours a day, seven days a week, then you have no choice butday, seven days a week, then you have no choice but to perform inconsistent backups of the wholeto perform inconsistent backups of the whole database. A backup of online datafiles is called andatabase. A backup of online datafiles is called an online backup. This requires that you run youronline backup. This requires that you run your database in ARCHIVELOG mode.database in ARCHIVELOG mode.  Advantage : Database remains open during backupAdvantage : Database remains open during backup  Disadvantage : Large databases may haveDisadvantage : Large databases may have performance impact during backup, recovery takesperformance impact during backup, recovery takes longer and islonger and is slightlyslightly more complexmore complex
  19. 19. Backup Methods (cont’d)Backup Methods (cont’d)  Logical backup (Export)Logical backup (Export)  Logical backups are exports of schema objects, likeLogical backups are exports of schema objects, like tables and stored procedures, into a binary file.tables and stored procedures, into a binary file. Oracle utilities are used to move Oracle schemaOracle utilities are used to move Oracle schema objects in and out of Oracle.objects in and out of Oracle.  Not recommended for backup of a whole database,Not recommended for backup of a whole database, but useful for backing up individual objects orbut useful for backing up individual objects or schemas or moving data into another databaseschemas or moving data into another database
  20. 20. Administrative TasksAdministrative Tasks  Daily ChecksDaily Checks  Check database availabilityCheck database availability  Check logs / trace filesCheck logs / trace files  Check free space / resourcesCheck free space / resources  Check for invalid objectsCheck for invalid objects  Check for broken jobsCheck for broken jobs  Verify backupVerify backup
  21. 21. Administrative Tasks (cont’d)Administrative Tasks (cont’d)  Weekly TasksWeekly Tasks  Collect statistics (database job)Collect statistics (database job)  Archive / delete log filesArchive / delete log files  Run performance reports (statspack)Run performance reports (statspack)
  22. 22. Administrative Tasks (cont’d)Administrative Tasks (cont’d)  OthersOthers  Applying patchesApplying patches  Database upgradesDatabase upgrades  New Database installationsNew Database installations  Creating user accountsCreating user accounts
  23. 23. More InformationMore Information  Oracle 10g Release 2 Database DocumentationOracle 10g Release 2 Database Documentation  http://www.oracle.com/pls/db102/http://www.oracle.com/pls/db102/  Oracle Database / SQL HelpOracle Database / SQL Help  http://asktom.oracle.com/http://asktom.oracle.com/  http://www.oracle.com/technology//index.htmlhttp://www.oracle.com/technology//index.html  *FREE* Oracle Software Downloads*FREE* Oracle Software Downloads  http://www.oracle.com/technology/software/index.htmlhttp://www.oracle.com/technology/software/index.html  Oracle Database 10g Express EditionOracle Database 10g Express Edition  Oracle SQL DeveloperOracle SQL Developer  This DocumentThis Document  Computer Science Homepage -> On-Line helpComputer Science Homepage -> On-Line help

×