CHAPTER 4 Tablespaces and Datafiles. Introduction After installing the binaries, creating a database, and configuring your environment, the next logical.

Slides:



Advertisements
Similar presentations
Rollback Segments Nilendu Misra (MAR99)
Advertisements

Introduction to Oracle
CHAPTER 13 Data Pump. Tool that replaces legacy exp/imp utilities Data Pump is a scalable, feature-rich utility that allows you to extract objects and.
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
ITEC474 Control File Maintenance
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
Primer on Structure& Storage Analysis Primer on Structure & Storage Analysis This presentation is supposed to give a simple and brief overview for storage.
Basic Storage Concepts and Settings
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Architectural Components
Harvard University Oracle Database Administration Session 5 Data Storage.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
Database Backup and Recovery
INTRODUCTION TO ORACLE
RMAN Restore and Recovery
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
Introduction to Oracle Backup and Recovery
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
Oracle Database Administration Database files Logical database structures.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
CHAPTER 11 Large Objects. Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most.
IT Database Administration Section 03. Tablespaces and the DBA  Important for DBAs – logical units of database storage Made up of physical operating-system.
Database Administration TableSpace & Data File Management
CHAPTER 2 Implementing a Database. Introduction to Creating Databases After you’ve installed the Oracle software, the next logical step is to create a.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
7202ICT Database Administration Lecture 7 Managing Database Storage Part 2 Orale Concept Manuel Chapter 3 & 4.
Extents, segments and blocks in detail. Database structure Database Table spaces Segment Extent Oracle block O/S block Data file logical physical.
Introduction to SEQUEL. What is SEQUEL? Acronym for Structural English Query Language Acronym for Structural English Query Language Standard language.
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
CHAPTER 5 Managing Control Files and Online Redo Logs.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
14 Copyright © 2006, Oracle. All rights reserved. Tuning Block Space Usage.
IT Database Administration Section 09. Backup and Recovery Backup: The available options Full Consistent (cold) Backup Database shutdown, all files.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Database Storage Structures
44 Creating a Database. 4-2 Objectives Preparing the operating system Preparing the parameter file Creating the database Preparing the operating system.
Harvard University Oracle Database Administration Session 6 Object Storage.
6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.
Oracle 10g Database Administrator: Implementation and Administration Chapter 5 Basic Storage Concepts and Settings.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
Week 2 Lecture 1 Creating an Oracle Instance. Learning Objectives  Learn the steps for creating a database  Understand the prerequisites for creating.
Creating an Oracle Database. Considerations before creating a DB Planning for Database Creation –Select the standard database block size. –Use an undo.
Managing Tablespaces and Data Files
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
G Copyright © 2006, Oracle. All rights reserved. Miscellaneous Topics.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Week 2 Lecture 2 Data Dictionary Views and Control Files.
Physical Database Structure .
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
Recovery Catalog Creation and Maintenance
Database structure and space Management
Oracle 10g Database Administrator: Implementation and Administration
Database structure and space Management
Physical Database Structure .
Introduction To Oracle 10g
Managing Tablespaces and Data Files
ISYS366, Oracle Disk Internals
Database administration
Presentation transcript:

CHAPTER 4 Tablespaces and Datafiles

Introduction After installing the binaries, creating a database, and configuring your environment, the next logical step is to prepare the database to house application data. DBAs must be knowledgeable of creating and maintaining tablespaces and corresponding datafile operations.

Tablespaces Usually Created by Default SYSTEM SYSAUX UNDO TEMP USERS

Relationships of Oracle Storage Objects

Creating Additional Tablespaces create tablespace tools datafile '/ora01/dbfile/INVREP/tools01.dbf' size 100m extent management local uniform size 128k segment space management auto;

Locally Managed Tablespaces Use the EXTENT MANAGEMENT LOCAL clause A locally managed tablespace uses a bitmap in the datafile to efficiently determine whether an extent is in use. When using locally managed tablespaces, you dont need to worry about the storage parameters of NEXT, PCTINCREASE, MINEXTENTS, MAXEXTENTS, and DEFAULT Dont create tablespaces using the old dictionary managed extents.

Automatic Segment Space Management within a Tablespace The SEGMENT SPACE MANAGEMENT AUTO clause instructs Oracle to manage the space within the block. There is no need to specify parameters such as PCTUSED, FREELISTS, and FREELIST GROUPS.

Creating an autoextend tablespace with a maximum size create tablespace tools datafile '/ora01/dbfile/INVREP/tools01.dbf' size 100m autoextend on maxsize 1000m extent management local uniform size 128k segment space management auto;

Using Ampersand Variables when Creating Tablespaces define tbsp_large=5G define tbsp_med=500M -- create tablespace reg_data datafile '/ora01/oradata/INVREP/reg_data01.dbf' size &&tbsp_large extent management local uniform size 128k segment space management auto; -- create tablespace reg_index datafile '/ora01/oradata/INVREP/reg_index01.dbf' size &&tbsp_med extent management local uniform size 128k segment space management auto;

Best Practices for Creating Tablespaces Create separate tablespaces for different applications using the same database. For an application, separate table data from index data in different tablespaces. Dont use the AUTOALLOCATE feature for datafiles. If you do use AUTOALLOCATE, specify a maximum size. Create tablespaces as locally managed. You shouldnt create a tablespace as dictionary managed. For a tablespaces datafile naming convention, use a name that contains the tablespace name followed by a two-digit number thats unique within datafiles for that tablespace. Try to minimize the number of datafiles associated with a tablespace. In tablespace CREATE scripts, use ampersand variables to define aspects such as storage characteristics.

Renaming a Tablespace SQL> alter tablespace foobar rename to users; Rename to conform better to standards Rename to better align with the use of the objects within the tablespace

Creating a Tablespace with Nologging create tablespace inv_mgmt_data datafile '/ora02/dbfile/O11R2/inv_mgmt_data01.dbf'' size 100m extent management local uniform size 128k segment space management auto nologging;

Nologging This minimizes the generation redo for direct path operations (this feature has no effect on regular DML operations) Use a direct path loading feature, such as the following: INSERT /*+ APPEND */ on queries that use a subquery for determining which records are inserted. INSERT /*+ APPEND_VALUES */ on queries that use a VALUES clause CREATE TABLE…AS SELECT Direct path SQL*Loader

Changing a Tablespaces Write Mode SQL> alter tablespace inv_mgmt_rep read only; SQL> alter tablespace inv_mgmt_rep read write;

Check for Objects within the Tablespace before Dropping Before dropping a tablespace, run a script similar to this to determine if any objects exist in the tablespace: select owner, segment_name, segment_type from dba_segments where tablespace_name=upper('&&tbsp_name');

Dropping a Tablespace Consider taking the tablespace offline before dropping it SQL> alter tablespace inv_data offline; Dropping a tablespace and removing the datafiles SQL> drop tablespace inv_data including contents and datafiles;

Using Oracle Managed Files The Oracle Managed File (OMF) feature automates many aspects of tablespace management, such as file placement, naming, and sizing You control OMF by setting the following initialization parameters: DB_CREATE_FILE_DEST DB_CREATE_ONLINE_LOG_DEST_N DB_RECOVERY_FILE_DEST

Creating a Bigfile Tablespace Tablespace contains only one datafile Allows for very large datafiles (128 TB) create bigfile tablespace inv_big_data datafile '/ora02/dbfile/O11R2/inv_big_data01.dbf' size 100g extent management local uniform size 128k segment space management auto;

Displaying Tablespace Size DBA_FREE_SPACE DBA_DATA_FILES

Altering Tablespace Size You alter a tablespaces size by modifying the size of one or more of its datafiles or adding a datafile: SQL> alter database datafile '/ora01/oradata/INVREP/reg_data01.dbf' resize 5g; SQL> alter tablespace reg_data add datafile '/ora01/dbfile/INVREP/reg_data02.dbf' size 100m;

Taking a Datafile Offline ALTER TABLESPACE... OFFLINE NORMAL ALTER TABLESPACE... OFFLINE TEMPORARY ALTER TABLESPACE... OFFLINE IMMEDIATE ALTER DATABASE DATAFILE... OFFLINE ALTER DATABASE DATAFILE... OFFLINE FOR DROP

Renaming or Relocating a Datafile 1. Use the following query to determine the names of existing datafiles: SQL> select name from v$datafile; 2. Take the datafile offline using either the ALTER TABLESPACE or ALTER DATABASE DATAFILE statement (see the previous section for details on how to do this). You can also shut down your database and then start it in mount mode; the datafiles can be moved while in this mode because they arent open for use. 3. Physically move the datafile to the new location using either an OS command (like mv or cp) or the COPY_FILE procedure of the DBMS_FILE_TRANSFER built-in PL/SQL package. 4. Use either the ALTER TABLESPACE... RENAME DATAFILE... TO statement or the ALTER DATABASE RENAME FILE... TO statement to update the control file with the new datafile name. 5. Alter the datafile online.

Using ORADEBUG to Display the Trace Files Name When youre working with a trace file, another way of showing the files name and location is to use the oradebug command: SQL> oradebug setmypid SQL> alter database backup controlfile to trace noresetlogs; SQL> oradebug tracefile_name Here is some sample output after running the last statement: /oracle/app/oracle/diag/rdbms/o11r2/O11R2/trace/O11R2_ora_9 628.trc This way, you can directly display the name of the trace file that you generated with the ALTER DATABASE BACKUP statement.

Summary Tablespaces are logical containers for a group of datafiles. Datafiles are the physical files on disk that contain data. Tablespaces allow you to separate the data of one application from another. Tablespaces provide a way to better manage applications that have different availability and backup and recovery requirements. As a DBA you must be proficient in managing tablespaces and datafiles