Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How do blocks,segments,extents nad rbs and redo logs all tie together??

Re: How do blocks,segments,extents nad rbs and redo logs all tie together??

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sat, 07 Nov 1998 08:01:22 +0100
Message-ID: <3643F042.1E20EE00@sybrandb.demon.nl>


Give it a try though...

Look at the following 'picture'

controlfiles
database
redologfiles

As for the redo log mechanism the database is considered as an undividable unit.
Every transaction is being written to the redo log file before it is being written to the database. As soon as the transaction is committed, this is being written to the redo log files too. Every transaction has a number. The current SCN (system commit number) is being written in the control file, the redo log file and in the appropriate database file. As soon as there is a mismatch between those numbers because of a power dip or a disk crash the database needs to be recovered. This is why you need to run in ARCHIVELOG always. A limited number of redo log files is online and is being written in round-robin fashion. As soon as the redo log mechanism 'wraps', the oldest online redo log file needs to be archived. If you don't do that you will not be able to recover the database to just before it crashed.
The before image of a table (what it was before the update,insert or delete started) is being written to a rollback segment. If you don't commit, but roll back your transaction this info is being used to reconstruct the old situation. Now too make it a bit more complicated: as a rollback segment is in the database, it's changes are being written to the redo log file also. The after image of your transaction is being written to the redo log file immediately. This allows Oracle to piggy back transactions and to avoid multiple writes on hot spots.

Then look at the database.

A database consists of tablespaces (minimum 1, usually 4: SYSTEM, USERS, TEMP, RBS)
The systems tablespace contains the datadictionary, if you loose that, you have lost the database.
On the physical level the database consists of segments, the physical representation of tables, or indexes, or clusters etc. Each segment is in one tablespace. Each segment however can consist of multiple extents, as a file can consist of multiple extents. As soon as your records don't fit into the initial extent a next extent is created. An extent consist of multiple database blocks, the smallest unit Oracle will read and write. Each segment will have 1 header block.

Hth,

Sybrand Bakker, Oracle DBA

Dan Roberts wrote:

> Hello All..I know this is quite an order to expalin this...But I am
> looking for a simple explaination..because as a newbie DBA I am running
> into problems with understanding these ideas..
>
> I am running Oracle 7.3.3.0.0 on UNIX IRIX 6.4
> My question is..how and what are blocks, segments and extents and how
> are they used by tablespaces and etc??
>
> Also how does a redo log, rollback segement work together?/For
> example..If I would like to change my SSN in my employee table how does
> the rollback and redo logs all come into play?? The redo holds the old
> information from the table while the redo log contains the new info
> before it gets written to the dbf file??.>Thnaks for any and all
> help!!!>>Dan
Received on Sat Nov 07 1998 - 01:01:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US