90 likes | 99 Views
Learn about Oracle database structures including tablespace, segments, and datafiles. Understand how to create tablespaces, manage segments, and work with data blocks and extents.
E N D
ISYS366 Oracle Disk Internals ISYS366, Oracle Disk Internals
Oracle Database Structures • Tablespace • Logical, because the physical implementation is the datafile. • Corresponds not only to one or more tables but also to one or more datafiles. • BUT, a table cannot span more than one tablespace. • SYSTEM is the first tablespace. Holds data dictionary. • Can be taken off line or dropped (except SYSTEM).
Oracle Database Structures • CREATE TABLESPACE tablespace_name DATAFILE datafile_name … • A word about raw files • UNIX and NT • Eliminates OS I/O • Backup Issues
Creating a Tablespace: Example Create Tablespace bigtbs_01 Datafile ‘bigtbs_f1.dat’ Size 20M AUTOEXTEND ON;
Oracle Database Structures • Segments: A unit of logical storage • One or more segments = Tablespace • Data segments • holds table data • one per table • Rollback segments • holds information used to make rollbacks • Index segment • holds data used in indexes • Temporary segment • used for executing certain SQL operations, such as sorting, that cannot be performed in memory
Oracle Database Structures • Extents • One or more extents = Segment • Data blocks • One or more data blocks = Extent • Size depends on operating system for a default (may be overridden by changing DB_BLOCK_SIZE in INITX.ORA)
Oracle Database Structures • Data blocks • Contains • Row data • Free space • Block information: block address (in datafile), segment • Type, tables and rows that use the block and other header information
Oracle Database Structures • Datafiles • Operating system files • One or more per tablespace • Datafile = is made up of segments • Redo logfiles • Restore the database to last physical backup • Restore the database to point in time of failure (must be running in ARCHIVELOG mode)
Oracle Database Structures • Initialization Parameter File (INIT<SID>.ORA) • D:\orawin\database\initorcl.ora • Only read at startup time • One per instance