Introduction to Oracle

Physical Structure  Logical Structure  SGA / PGA  Background Processes Backup Methods Computer Science Database – CS01  Administrative Tasks

so work is never lost.log)  The primary function of the redo log is to record all changes made to data.  Redo Log Files (*. . The data of logical database structures.Physical Structures  Datafiles (*. is physically stored in the datafiles allocated for a database.ctl)  Every Oracle database has a control file.  Control Files (*.dbf)  The datafiles contain all the database data. If a failure prevents modified data from being permanently written to the datafiles. 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. then the changes can be obtained from the redo log. such as tables and indexes.

This prevents oracle from overwriting the redo log files before they have been safely archived to another location.  Parameter Files (initSID. The alert log of a database is a chronological log of messages and errors.trc)  Each server and background process can write to an associated trace file. When an internal error is detected by a process.Physical Structures (cont’d)  Archive Log Files (*.log)  Oracle automatically archives log files when the database is in ARCHIVELOG mode. it dumps information about the error to its trace file.ora)  Parameter files contain a list of configuration parameters for that instance and database. .  Alert and Trace Log Files (*.

Oracle database data is stored in data blocks. . The standard block size is specified by the DB_BLOCK_SIZE initialization parameter.Logical Structures  Tablespaces  A database is divided into logical storage units called tablespaces. One data block corresponds to a specific number of bytes of physical database space on disk. which group related logical structures together.  Oracle Data Blocks  At the finest level of granularity. One or more datafiles are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace.

used to store a specific type of information. obtained in a single allocation.Logical Structures (cont’d)  Extents  The next level of logical database space is an extent. An extent is a specific number of contiguous data blocks. The different types of segments are :     Data segment – stores table data Index segment – stores index data Temporary segment – temporary space used during SQL execution Rollback Segment – stores undo information . the level of logical database storage is a segment.  Segments  Above extents. A segment is a set of extents allocated for a certain logical structure.

A schema is owned by a database user and has the same name as that user. . and indexes. views.Logical Structures (cont’d)  Schema Overview  A schema is a collection of database objects. Schema objects are the logical structures that directly refer to the database's data. Schema objects include structures like tables.

.

The combination of the background processes and memory buffers is called an Oracle instance.Oracle Instance An Oracle database server consists of an Oracle database and an Oracle instance. . a system global area (SGA) is allocated and Oracle background processes are started. Every time a database is started.

and performance is improved. the most frequently) used data is kept in memory. Users currently connected to an Oracle database share the data in the SGA. The buffer cache contains modified as well as unmodified blocks. less disk I/O is necessary. Because the most recently (and often.System Global Area (SGA) The System Global Area (SGA) is a shared memory region that contains data and control information for one Oracle instance. The SGA contains the following memory structures :  Database Buffer Cache  Database buffers store the most recently used blocks of data. . The set of database buffers in an instance is the database buffer cache.

A shared SQL area is required to process every unique SQL statement submitted to a database. such as shared SQL areas.  Shared Pool of the SGA  The shared pool contains shared memory constructs. A shared SQL area contains information such as the parse tree and execution plan for the corresponding statement. The redo entries stored in the redo log buffers are written to an online redo log.System Global Area (cont’d)  Redo Log Buffer of the SGA  The redo log buffer stores redo entries—a log of changes made to the database. The size of the redo log is static. which is used if database recovery is necessary. .

. A PGA is created by oracle when a server process is started. The PGA area is a non-shared area of memory created by oracle when a server process is started. A server process is a process that services a client’s requests.Program Global Area (PGA) PGA is a memory buffer that contains data and control information for a server process. The information in a PGA depends on the oracle configuration. The basic difference between SGA and PGA is that PGA cannot be shared between multiple processes in the sense that it is used only for requirements of a particular process whereas the SGA is used for the whole instance and it is shared.

It coalesces i. SMON also cleans up temporary segments that are no longer in use and recovers dead transactions skipped during crash and instance recovery because of file-read or offline errors. Processes are jobs that work in the memory of these computers. They asynchronously perform I/O and monitor other Oracle processes to provide increased parallelism for better performance and reliability. All memory structures exist in the main memory of the computers that constitute the database system. Oracle creates a set of background processes for each instance. combines contiguous free extents into larger free extents.e.Oracle Background Processes An Oracle database uses memory structures and processes to manage and access the database. The most common background processes are :  System Monitor – SMON  This database background process performs instance recovery at the start of the database. . The background processes consolidate functions that would otherwise be handled by multiple Oracle programs running for each user process.

Background Processes (cont’d)  Process Monitor . .DBWR   This background process is responsible for managing the contents of the data block buffer cache and dictionary cache.  Database Writer . PMON is responsible for releasing the lock i. DBWR does not need to write blocks when a transaction commits. Note the number of DBWR processes running is set via the DB_WRITER_PROCESSES. The least recently used data is written to the datafiles first.e. In the most common case. DBWR performs batch writes of changed block. DBWR writes only when more data needs to be read into the system global area and too few database buffers are free. Its effect can be seen when a process holding a lock is killed. one can have multiple DBWR processes running at the same time. Although there is only one SMON and one PMON process running per database instance. cleaning up the cache and freeing resources that the process was using. Since Oracle uses write-ahead logging.PMON  This database background process cleans up failed user processes.

LGWR writes the log entries in batch form.  Archiver . The Redo log buffers entries always contain the most up-to-date status of the database. for most databases.LGWR  This background process manages the writing of the contents of the redo log buffer to the online redo log files. archiving can have an impact on system performance. Actually.ARCH  The 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). ARCH has no effect on the overall system performance. .Background Processes (cont’d)  Log Writer . however. On some large database sites.

Given a start date and an interval.  Job Queue Processes  Job queue processes are used for batch processing.RECO  The recover process automatically cleans up failed or suspended distributed transactions.CKPT  All modified information in database buffer in the SGA is written to the datafiles by a database write process (DBWR). The checkpoint process is responsible for signaling DBWR at checkpoints and updating all of the datafiles and control files of the database. They run user jobs. This event indicates a checkpoint. .Background Processes (cont’d)  Checkpoint .  Recover . They can be viewed as a scheduler service that can be used to schedule jobs as PL/SQL statements or procedures on an Oracle instance. the job queue processes try to run the job at the next occurrence of the interval.

.

Computer Science Database Server Information      Sun e4500 8GB Ram 8 x 400mhz CPU 32GB Disk for Oracle 4mm DAT DDS3 Tape Backup .

0.Computer Science Database    Instance Name : CS01 (v$database) Instance Version : 8.0 Tablespaces : (dba_tablespaces)      SYSTEM – holds all system tables INDEX01 – user indexes USERS01 – user tables USERS02 – user tables (faculty) RBS – rollback segments .6.1.

.

Backup Methods  Cold Backup (aka Consistent Backups)    The only way to make a consistent whole database backup is to shut down the database with the NORMAL. IMMEDIATE. or TRANSACTIONAL options and make the backup while the database is closed. Advantage : No recovery is required after datafiles are restored – quicker restore Disadvantage : No access to database during backup time (depends on size/system speed) .

Backup Methods (cont’d)  Hot Backup (aka Inconsistent Backups)    If the database must be up and running 24 hours a day. This requires that you run your database in ARCHIVELOG mode. A backup of online datafiles is called an online backup. seven days a week. recovery takes longer and is slightly more complex . then you have no choice but to perform inconsistent backups of the whole database. Advantage : Database remains open during backup Disadvantage : Large databases may have performance impact during backup.

like tables and stored procedures. Oracle utilities are used to move Oracle schema objects in and out of Oracle. Not recommended for backup of a whole database. into a binary file.Backup Methods (cont’d)  Logical backup (Export)   Logical backups are exports of schema objects. but useful for backing up individual objects or schemas or moving data into another database .

Administrative Tasks  Daily Checks       Check database availability Check logs / trace files Check free space / resources Check for invalid objects Check for broken jobs Verify backup .

Administrative Tasks (cont’d)  Weekly Tasks    Collect statistics (database job) Archive / delete log files Run performance reports (statspack) .

Administrative Tasks (cont’d)  Others     Applying patches Database upgrades New Database installations Creating user accounts .

com/technology//index.oracle.html  *FREE* Oracle Software Downloads  http://www.com/pls/db102/  Oracle Database / SQL Help   http://asktom.oracle.com/ http://www.oracle.oracle.html   Oracle Database 10g Express Edition Oracle SQL Developer  This Document  Computer Science Homepage -> On-Line help .More Information  Oracle 10g Release 2 Database Documentation  http://www.com/technology/software/index.

6..

%1636/9:5.7.:065.3.9:..46:.5.

6..

./. 1..:..:6.: 909..1..

909.

.50  .916363:650"9. .03. % '9097960::9.65 : 0..69..479694..91.: 69 .:.65.0676.:331./.0./.:1916363:..:560.51 9.9050.5.479694.6.::.1:.33 ::.5.4.65::.33 6946:.1.9036 1:.:701.:: %..547.50 "5:643.

..029651#960::: 065.1 02765.

. 02765.

...35%.3: /./.:. ' 002765.51 71..5..: %069..:. #' 3346115694.&:9.002765.002765./.3:.6551.510.6...:/95.1.1..1.336..7960:: % ':5..7960:::9:765:/369:5...../.9633:6.:9.5.51065.1.

%069.

3 ..1.3169::75111:..5:7..3303.64.50 5.65: 6/$#960::: 6/87960:::.0.0.695.55.0.60099506 .07960::5 '95:96/: ' 0.9:169/.5/1.:0139:90.9.6/.3 .5"9.5:..:.45.9.9.... %" '90697960::.9/.:.5.035:....6:0136/:.:69796019:65..5/:1.9.51 .5.6/87960:::...1 .9.: #&$:.

.

65 &5 %.9&050..7..027 ./.03 44'& '.647.4 4# :269 "9.: &995694..

647./3: ..4./3:7.: 5:.509:65     '.03..50!.4&  1./3:  ! ! :951: &%& &%& :9.: ..33::..: 5:./.0: &&'  631:....02:45.0: 1/../3:7. %& %& 9633/...9&050./.../3: &%& &%& :9.

.

 !"%   ' 69'%!&'"!67.4 1751:65:::.5.65::.61: 631.027 ...027:..514./../.:.5.65: .027 .69 :.00::..5..027 .691 80299:.91...027: '653.2...2.1.065::.1.631../.4:71 ..!6.././.99:..691 ..!69069:9891.: /.165.0273.::036:1 1..2.5.3: .64..1.61.6:.99:.:195/.

.5.: /.69569 1.1 6../.56.:5%"461  1.51::3.3::0./.:.5047.61: 065..027 9069./.5:675195/.6796945065::.2 ./.1.51955569:.. 79694.027665351.027 ':989:..027:6..3 3659..331.3 46906473 .5 6535/..::4....:94.027: .5065::.1...91.5.2.027 ./.0. 1.56060/.195/./7..027 ...5./.51::3.63 1..5..:4:. :51. ..027 :.2: 3659.....

./.: 32 .:694651.9:1../5.3.027 .6.6"9.03:04.3/.93  "9.03 !6.56.36/0.5.631.51:. 60.9064451169/.:6:04./3:.6.646"9.6/0.516.691796019: 5..: . 6/0.91..:369/.03.3/.61: 065.:  /.1 60..:69 :04.027:..027 769.:.9769.0257511.:5.0276../..

/.9.302: 021..316/0./3.03: 029:7..027 ..09:690: 02695.'. 0236:..145:.9.: 0269/96256/: 9/.3.:2: .:.

:2: 065.363: %579694.:.: :.:..02 ...:2: 6330.:6/ 9013.9.'..:7.145:...1 23'../.0: 1.509769.

.9...'.: ./...1 "...65: 9.1: !.5:9.:5:..0: .9: 77357.0065./.:2: 065.:79..145:.33.

03%3..03.03.:79::1..96536.43 "9.695694.:.03 064 ..0563651 ..7 69.03 06473:1/ "9...03 064.951 .65 .43 % "9.03&6.../.03&$3679 ':6045.05636:6..9&050647.65 "9...:&$37 .1: ....65 "9.64 69.7./.7 69. 647.03 064.7 69../.:6045..:2.

"5.

9&050647. 647. .

"5.

537 .

Sign up to vote on this title
UsefulNot useful