<Insert Picture Here> 2. Oracle Physical Database Layout Tablespaces and Data Files • Oracle stores data logically in tablespaces and physically in data files. – Tablespaces: • Can belong to only one database at a time • Consist of one or more data files • Are further divided into logical units of storage – Data files: Database • Can belong to only one Tablespace tablespace and one database • Are a repository for schema object data Data files 1 Tablespaces in the Preconfigured Database – SYSTEM – SYSAUX – TEMP – UNDOTBS1 – USERS – EXAMPLE 2 3 Locally Managed Tablespaces • • • Reduced contention on data dictionary tables No undo generated when space allocation or deallocation occurs No coalescing required CREATE TABLESPACE userdata DATAFILE ‘d:\oradata\userdata01.dbf' SIZE 500M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K; 4-6 Copyright © 2004, Oracle. All rights reserved. 4 Segments, Extents, and Blocks • • • • Data blocks are mapped to OS blocks. Extents are a collection of data blocks. Segments are made of a collection of extents. Segments exist within a tablespace. OS blocks 44 Data blocks Extents Segment Copyright © 2004 Oracle All rights reserved Space Management in Tablespaces • Locally managed tablespace: – – – – • Free extents are managed in the tablespace. Bitmap is used to record free extents. Each bit corresponds to a block or group of blocks. Bit value indicates free or used. Dictionary-managed tablespace: – Free extents are managed by the data dictionary. – Appropriate tables are updated when extents are allocated or deallocated. 4-5 Copyright © 2004, Oracle. All rights reserved. 5 6 Managed by – Pctfree – Pctused 7 What Is a Schema? owns HR schema HR user Schemas • Schemas created as part of the database creation process: – SYS – SYSTEM – Sample schemas 8