Вы находитесь на странице: 1из 41

Oracle Database Files Concepts

The final components of the Oracle architecture are the physical files where our
information resided on disk. Oracle has several types for data files, each for a different
purpose:
* Database datafiles
* Control files
* Online redo logs
* Parameter files
* Other database related files
Let?s look at each of these physical files in a bit more detail.

Database datafiles
Database datafiles are physical files stored on disk. These files are used to store data
on disk. Database datafiles are only written to by the DBWR processes that we
introduced you to earlier (there is an exception or two to this statement, but for now,
assume that this point this true).
These database datafiles are associated with Oracle ?tablespaces?, which are ?logical?
containers for tables and indexes.

Control files
The Control File of the database is a binary file that contains a great deal of database
information. The control file contains the database name, data about the database log
files. Oracle cannot function without valid control files.
Because the control file is so important, Oracle allows you to maintain duplicate
copies of the control file. When you have more than one control file, then you are said
to be multiplexing your control files. It is a good practice to put these multiple copies
on different disks to protect the control file. Later in this book, we will demonstrate
how to do this.

Online redo logs concepts


Think of the online redo logs like a tape recorder that records every change in the
Oracle database. As changes occur, they are regularly recorded in the online redo logs,
just like you might record a movie on your VCR.
In the event that a disk crashes, you may have to replace the disk and restore the disk
data from a backup tape. If this backup tape was several days ago, you have lost a lot
of data.
Fortunately, Oracle can ?replay? the saved transactions in the online redo logs, and reapply lost transactions back into the database. Many times, this means that Oracle can
recover from a crash without the DBA having to do anything other than just telling the
database to startup. We will cover the topic of online redo log files and how they
relate to database recovery in later chapters of this book.
At a minimum, Oracle requires that you have two online redo logs assigned to the
database. Oracle will write redo to the first log, and when the first log is full, Oracle
will switch to the second log and write the same redo. Each of these individual online
redo logs is known as an online redo log group.
The reason we call them groups is that there can be mirrored copies of the online redo
log files in each group. Like control files, it?s a good idea to have multiplexed copies
of the Online redo logs. Oracle allows you to define multiple copies of these files.
Each copy is called a member. Each redo log group can have one or more members.
We will discuss the online redo log files in more detail in later chapters.

Oracle Parameter file Concepts


The parameter file (sometimes called init.ora) contains configuration information for
the database to use at startup time. The parameter file you configure how much RAM
the database is going to use, where to find the control files, where to write trace files,
and a whole host of other information. In most cases the database will not start
without a parameter file. Oracle allows you to have a manual parameter file (called a
PFILE) or a server-side parameter file (called a SPFILE).
Other Database Related Files
When working with the Oracle database you will be introduced to a number of
different kinds of files. The following table is a list of the most common files and their
general purpose. As we proceed through the chapters of this book, you will be
introduced to many of these files in more detail.

* Oracle Trace Files - Created by Oracle in a number of different situations. These can
be created as a result of a database crash, a session failure, an unexpected but nonfatal database failure, or based on specific user operational commands.
* Alert log - This is the general log file for each Oracle database.
Networking configuration files - These files are used to configure the different
network components of the Oracle database. These include files such as tnsnames.ora
and listener.ora.
* Oracle Database Software Binaries - The Oracle Database software includes the
basic programs that allow the database to function

A binary file is computer -readable but not human-readable. All executable programs are stored
in binary files, as are most numeric data files. In contrast, text files are stored in a form
(usually ASCII) that is human-readable.

data files

contain just text or pictures which are not executable.

Executable file :
An executable file (sometimes called an appshort for "application") is a
computer file containing step-by-step instructions in a form that the computer can follow. By
contrast,

Executable file is a file that is used to perform various functions or

operations on a computer. Unlike a data file, an executable file cannot


be read because it has been compiled. On an IBM compatible
computer,

Common executable files are


.BAT, .COM, .EXE, and .BIN.
Depending on the operating system and its setup

Extension

Format

Operating System(s)

ACTION

Automator Action

Mac OS

APK

Application

Android

APP

Executable

Mac OS

BAT

Batch File

Windows

BIN

Binary Executable

Windows, Mac OS, Linux

CMD

Command Script

Windows

COM

Command File

Windows

COMMAND

Terminal Command

Mac OS

CPL

Control Panel Extension

Windows

CSH

C Shell Script

Mac OS, Linux

EXE

Executable

Windows

GADGET

Windows Gadget

Windows

INF1

Setup Information File

Windows

INS

Internet Communication Settings

Windows

INX

InstallShield Compiled Script

Windows

IPA

Application

iOS

ISU

InstallShield Uninstaller Script

Windows

JOB

Windows Task Scheduler Job File

Windows

JSE

JScript Encoded File

Windows

KSH

Unix Korn Shell Script

Linux

LNK

File Shortcut

Windows

MSC

Microsoft Common Console Document

Windows

MSI

Windows Installer Package

Windows

MSP

Windows Installer Patch

Windows

MST

Windows Installer Setup Transform File

Windows

OSX

Executable

Mac OS

OUT

Executable

Linux

PAF

Portable Application Installer File

Windows

PIF

Program Information File

Windows

PRG

Executable

GEM

PS1

Windows PowerShell Cmdlet

Windows

REG

Registry Data File

Windows

RGS

Registry Script

Windows

RUN

Executable

Linux

SCR

Screensaver Executable

Windows

SCT

Windows Scriptlet

Windows

SHB

Windows Document Shortcut

Windows

SHS

Shell Scrap Object

Windows

U3P

U3 Smart Application

Windows

VB

VBScript File

Windows

VBE

VBScript Encoded Script

Windows

VBS

VBScript File

Windows

VBSCRIPT

Visual Basic Script

Windows

WORKFLOW

Automator Workflow

Mac OS

WS

Windows Script

Windows

WSF

Windows Script

Windows

WSH

Windows Script Preference

Windows

Extension Format

Program

0XE

Renamed Virus File

F-Secure Internet Security

73K

TI-73 Application

TI Connect

89K

TI-89 Application

TI Connect

A6P

Authorware 6 Program File

Adobe Authorware

AC

GNU Autoconf Script

Autoconf

ACC

GEM Accessory File

Gemulator

ACR

ACRobot Script

ACRobot

ACTM

AutoCAD Action Macro

AutoCAD

AHK

AutoHotkey Script

AutoHotkey

AIR

Adobe AIR Installation Package

Adobe AIR

APP

FoxPro Application

Visual FoxPro

ARSCRIPT ArtRage Script

ArtRage Studio

AS

Adobe Flash ActionScript File

Adobe Flash

ASB

Alphacam Stone VB Macro

Alphacam

AWK

AWK Script

AWK

AZW2

Kindle Active Content App File

Kindle Collection Manager

BEAM

Compiled Erlang File

Erlang

BTM

4DOS Batch File

4DOS

CEL

Celestia Script

Celestia

CELX

Celestia Script

Celestia

CHM

Compiled HTML Help File

Firefox, IE, Safari

COF

MPLAB COFF File

MPLAB IDE

CRT

Security Certificate

Firefox, IE, Chrome, Safari

DEK

Eavesdropper Batch File

Eavesdropper

DLD

EdLog Compiled Program

Edlog

DMC

Medical Manager Script

Sage Medical Manager

DOCM

Word Macro-Enabled Document

Microsoft Word

DOTM

Word Macro-Enabled Template

Microsoft Word

DXL

Rational DOORS Script

Rational DOORS

EAR

Java Enterprise Archive File

Apache Geronimo

EBM

EXTRA! Basic Macro

EXTRA!

EBS

E-Run 1.x Script

E-Prime (v1)

EBS2

E-Run 2.0 Script

E-Prime (v2)

ECF

SageCRM Component File

SageCRM

EHAM

ExtraHAM Executable

HAM Programmer Toolkit

ELF

Nintendo Wii Game File

Dolphin Emulator

ES

SageCRM Script

SageCRM

EX4

MetaTrader Program File

MetaTrader

EXOPC

ExoPC Application

EXOfactory

EZS

EZ-R Stats Batch Script

EZ-R Stats

FAS

Compiled Fast-Load AutoLISP File

AutoCAD

FKY

FoxPro Macro

Visual FoxPro

FPI

FPS Creator Intelligence Script

FPS Creator

FRS

Flash Renamer Script

Flash Renamer

FXP

FoxPro Compiled Program

Visual FoxPro

GS

Geosoft Script

Oasis Montaj

HAM

HAM Executable

Ham Runtime

HMS

HostMonitor Script

HostMonitor

HPF

HP9100A Program File

HP9100A Emulator

HTA

HTML Application

Internet Explorer

IIM

iMacro Macro

iMacros (Firefox Add-on)

IPF

SMS Installer Script

Microsoft SMS

ISP

Internet Communication Settings

Microsoft IIS

JAR

Java Archive

Firefox, IE, Chrome, Safari

JS

JScript Executable Script

Firefox, IE, Chrome, Safari

JSX

ExtendScript Script

Adobe ExtendScript Toolkit

KIX

KiXtart Script

KiXtart

LO

Interleaf Compiled Lisp File

QuickSilver

LS

LightWave LScript File

LightWave

MAM

Access Macro-Enabled Workbook

Microsoft Access

MCR

3ds Max Macroscript or Tecplot Macro

3ds Max

MEL

Maya Embedded Language File

Maya 2013

MPX

FoxPro Compiled Menu Program

Visual FoxPro

MRC

mIRC Script

mIRC

MS

3ds Max Script

3ds Max

MS

Maxwell Script

Maxwell Render

MXE

Macro Express Playable Macro

Macro Express

NEXE

Chrome Native Client Executable

Chrome

OBS

ObjectScript Script

ObjectScript

ORE

Ore Executable

Ore Runtime Environment

OTM

Outlook Macro

Microsoft Outlook

PEX

ProBoard Executable

ProBoard BBS

PLX

Perl Executable

ActivePerl or Microsoft IIS

POTM

PowerPoint Macro-Enabled Design Template

Microsoft PowerPoint

PPAM

PowerPoint Macro-Enabled Add-in

Microsoft PowerPoint

PPSM

PowerPoint Macro-Enabled Slide Show

Microsoft PowerPoint

PPTM

PowerPoint Macro-Enabled Presentation

Microsoft PowerPoint

PRC

Palm Resource Code File

Palm Desktop

PVD

Instalit Script

Instalit

PWC

PictureTaker File

PictureTaker

PYC

Python Compiled File

Python

PYO

Python Optimized Code

Python

QPX

FoxPro Compiled Query Program

Visual FoxPro

RBX

Rembo-C Compiled Script

Rembo Toolkit

ROX

Actuate Report Object Executable

eReport

RPJ

Real Pac Batch Job File

Real Pac

S2A

SEAL2 Application

SEAL

SBS

SPSS Script

SPSS

SCA

Scala Script

Scala Designer

SCAR

SCAR Script

SCAR

SCB

Scala Published Script

Scala Designer

SCRIPT

Generic Script

Original Scripting Engine1

SMM

Ami Pro Macro

Ami Pro

SPR

FoxPro Generated Screen File

Visual FoxPro

TCP

Tally Compiled Program

Tally Developer

THM

Thermwood Macro

Mastercam

TLB

OLE Type Library

Microsoft Excel

TMS

Telemate Script

Telemate

UDF

Excel User Defined Function

Microsoft Excel

UPX

Ultimate Packer for eXecutables File

Ultimate Packer for eXecutables

URL

Internet Shortcut

Firefox, IE, Chrome, Safari

VLX

Compiled AutoLISP File

AutoCAD

VPM

Vox Proxy Macro

Vox Proxy

WCM

WordPerfect Macro

WordPerfect

WIDGET

Yahoo! Widget

Yahoo! Widgets

WIZ

Microsoft Wizard File

Microsoft Word

WPK

WordPerfect Macro

WordPerfect

WPM

WordPerfect Macro

WordPerfect

XAP

Silverlight Application Package

Micrsoft Silverlight

XBAP

XAML Browser Application

Firefox, IE

XLAM

Excel Macro-Enabled Add-In

Microsoft Excel

XLM

Excel Macro-Enabled Workbook

Microsoft Excel

XLSM

Excel Macro-Enabled Workbook

Microsoft Excel

XLTM

Excel Macro-Enabled Template

Microsoft Excel

XQT

SuperCalc Macro

CA SuperCalc

XYS

XYplorer Script

XYplorer

ZL9

Renamed Virus File

ZoneAlarm

executable file
A file in a format that the computer can directly execute. Unlikesource files, executable files cannot be read by
humans. To transform a source file into an executable file, you need to pass it through a compiler or assembler.
In DOS systems, executable files have either a.COM or.EXEextension and are called COM files and EXE files,
respectively.

An executable file (sometimes called an appshort for "application") is a


computer file containing step-by-step instructions in a form that the computer can follow. By
contrast, data files contain just text or pictures which are not executable.

SAP Executables
List of interesting SAP Executables in alphabetical order:
car - The Compression Tool of SAP for nearly all delivered files and
executables. CAR is the name for old releases and the SAPCAR is the
name as of 4.6D. It works a bit similar to WinZip.
dipgntab - Activation and adjustment of the nametabs with the ABAP
Dictionary.
dw - disp+work - "Dispatcher & Workprocess" - "The complete Kernel"
- Here the complete ABAP is processed ...
niping - Small Client and Server in order to test the saprouter internally
with the NI-Protocol (SAP Network Interface).
lib_dbsl - The Database-Shared Library for the kernel programs (as of
4.5A).

librfc - The RFC (Remote Function Call) Library, that is available for any
platform to develop and run a RFC Server or RFC Client.
ntscmgr.exe - ntscmgr - the tool for installing the SAProuter as service.
It is part of every Windows SAP Kernel. As it has no known errors, it is
not necessary, to patch it. Just use ntscmgr.exe from your existing
windows kernel.
r3check - This is a tool, that can Cluster-Tables for errors.
r3ldctl - The tool for exporting all table structures to the file system
during a OS/DB-Migration.
r3load - The table import & export tool of SAP during Installation,
Upgrade and Migration.
r3setup - The Installation (and Migration) Tool for all SAP systems up to
Release 6.10.
r3szchk - The tool for determing the sizes of the different tables in the
target database during the import in an OS/DB-Migration.
r3trans - This is the tool, that does the real work for tp. tp controls the
import and export of changes and r3trans does them using scripts, that
were generated from tp.
r3up - The tool that controls the Upgrade (Moving to higher SAP
Releases) of an SAP System.
rfcexec - The tool to start other programs from within SAP (ABAP) on
the OS level via the gateway on any other (or the same) server.
rfcoscol - Similar to saposcol. It is needed, when no SAP instance is
running on the Database Server.
sapcar - The Compression Tool of SAP for nearly all delivered files and
executables. It works a bit similar to WinZip.
sapevt - This program is able to trigger events within the SAP system.
The tp tool uses this feature. It can be used as trigger for self-written
interfaces as well.

sapftp - FTP Client, that can be used from within the SAP system (from
ABAP) to communicate with other FTP servers.
saphttp - HTTP Client, that can be used from within the SAP system
(from ABAP) to communicate with other HTTP servers - e.g. for
interfaces.
sapinst - The Installation (and Migration) Tool for all SAP systems as of
Release 6.20.
saplicense - The Tool for the installation of a new SAP License. This is
needed when the license expires e.g. because of a hardware change.
saposcol - The SAP Interface to the Operating System for Performance
Data. The Operating System Collector collects CPU Usage, Disk
Performance, Paging etc.
sappad - Very nice & small Editor a lot better than notepad. It handles
LF and CR/LF correctly as well.
sappfpar - This tool can be used for checking the profiles after changes
and before restarting the SAP system.
saprouter - The program for the Router Connection from customers to
SAP and vice versa.
sapxpg - The tool for starting OS commands from within SAP Systems.
sapwebdisp - The SAP Web dispatcher is used for load balancing for
an setting up an SAP Internet scenario. It is the only application, that
needs to be located in the DMZ. Everything "behind" this can (and
should) be located in your intranet. So, only one port on one IP adress
needs to be opened to internet and the SAP Web dispatcher can handle
the traffic with the different SAP instances.
startrfc - The tool is a very easy SAP command line interface to start all
of the implemented function modules of SAP systems.
tp - "The" Transport Tool. This program coordinates the complete
import and export of program and table changes made within the SAP

system in order to transport them through the complete System


Landscape.
complete kernel - Here you can see an overview of all 6.20 Kernel
programs. This overview is created from Windows with MaxDB

**********************************************************************************

HOW TO EXTEND TABLE SPACE SAPTEMP with brtools


1.Analyze what tablespace should be extent, please check the available space
carefully before decide to extent table space
2.Go to server login with adm
3.Run brtools
4.Go to space management (option number 2)
5.Go to extend tablespace (option number 1)
6.Check the option, if its ok wih the default setting type c then enter to continue to next brspace process
7.Go to extend tablespace (option number 1)
8.All tablespaces will be appeared enter to scroll down choose the tablespace which will be extended
9.Mandatory option to be checked is option number 3 (New file to be added (file))
use to locate where new datafile will be created
10.Also check option number 5 (Size of the new file in MB (size) make sure destination is enough to create new
datafile
11.Continue
12.When system ask to add next data file automatically please dont choose yes
chose no / continue to continuing the process on normal condition next datafiles should be defined one by one
13.Dont forget to choose exit after finish.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2

How to Add an Oracle datafile using BRTOOLS


1.
2.
3.
4.
5.
6.
7.

Logon to the systems as ora<sid>


Execute brtools
Select 2 Space management
Select 1 Extend tablespace
Select 3 tablespace name
Select C Continue
Select 3 New file to be added (file path) (Optional)

8. Select 5 Size of the new file in MB (Optional)


9. Select 6 Auto extend (Yes/No) (Optional)
10.Select 7 Maximal file size in MB (Maxsize) (Optional)
11.You can see the sql statement in option 9 SQL command. (Optional)
12.To continue select C Execute the sql command.
13.Select continue and confirm the return to BRTOOLS menu.
14.Exit from the Space management menu using b (back)
15.Now it is possible to exit from BRTOOLS using option 9 Exit program.
NOTE: Check next page for a detailed procedure

How to extend an Oracle datafile using


BRTOOLS
Summary

1.
2.
3.
4.
5.
6.
7.

Logon to the systems as ora<sid>


Execute brtools
Select 2 Space management
Select 4 Alter data file
Select 3 Alter data file action (action) and type resize
Select 4 Tablespace name (tablespace) and type the tablespace name
Select 5 Data file names (file) and specify the complete path of the data
file
8. Check the input data and select continue to launch the BRSPACE interface.
9. Confirm the call to BRSPACE
10.Select 7 ? New data file size in MB (incrsize) and specify the new size in MB
11.Check the input data and select continue (this will actually execute the
resizing). Look for any error messages.
12.Select continue and confirm the return to BRTOOLS menu.
13.Exit from the Space management menu using b (back)
14.Now it is possible to exit from BRTOOLS using option 9 Exit program.
NOTE: Check next page for a detailed procedure

Detailed procedure

1. Logon to the systems as ora<sid>


2. Execute brtools

3. Select 2 Space management

4. Select 4 Alter data file


It is obligatory to fill items marked with ~.

5. Select 3 Alter data file action (action) and type resize

6. Select 4 Tablespace name (tablespace) and type the tablespace name

7. Select 5 Data file names (file) and specify the complete path of the data file

8. Check the input data and select c to continue to launch the BRSPACE interface.
Datafiles can be checked within the SAP system with transaction DB02 -> Current
sizes -> Select the tablespace -> Data files / Temp files

9. Confirm the call to BRSPACE

10.Select 7 ? New data file size in MB (incrsize) and specify the new size in MB

11.Check the input data and select continue (this will actually execute the resizing).
Look for any error messages.

12.Select continue and confirm the return to BRTOOLS.


13.Exit from the Space management menu using b (back)
Now it is possible to exit from BRTOOLS using option 9 Exit program.

*******************************************************************************

kernel upgrade questions


1)What is your present patch level?
A: 333
2)From which patch level did you upgrade it?
A: 310
3) Why do you go for kernel patch upgrade?
A: we usually do it when there is a problem with the existing kernel files &
When we go for latest functionality like support packs implementation or add-ons or plug-in
implementation.

When sap recommends in early watch alerts we go for the kernel patch upgrade.
4)What are the files do you downloaded from service market place?
A: 1) sapexe file (db independent) & sapexedb file (db dependent)
5)How many ways do you know the current patch level?
A: At os level -> login with sidadm and use the command disp+work
At sap level -> system -> status.
6)What are the problems do you faced while kernel patch upgrade?
PROBLEM 1:we generally forgot about file permissions
PROBLEM2: we should stop saposcol & listener otherwise it give problems.
7)What are the prerequisites for kernel patch upgrade?
A: we should take the backup of old kernel & check for the existing patch version to download
latest version.
8)If you are updating kernel for latest car files how do you uncar the downloaded car files?
A: we can download only car file and update the car only when this situation arrives.
9)Why do you overwrite the old kernel instead of replace?
A: Because latest kernel consist only updated kernel files only so to use the remaining files we
use to overwrite the kernel.
10)What are the post requisites for kernel patch upgrade and why?
A: run the scripts saproot.sh for the permissions in non windows environment & check for the
kernel patch version whether it is updated or not?

*************************************************************************************

An Introduction to Tablespaces and Datafiles


Tablespaces
Datafiles

Space -- the final frontier...


Gene Roddenberry: Star Trek

This chapter describes tablespaces, the primary logical storage structures of any
Oracle database, and the physical datafiles that correspond to each tablespace. The
chapter includes:
An Introduction to Tablespaces and Datafiles
Tablespaces
Datafiles
If you are using Trusted Oracle, see the Trusted Oracle7 Server
Administrator's Guide for more information about tablespaces and
datafiles in that environment.
An Introduction to Tablespaces and Datafiles
Oracle stores data logically in tablespaces and physically
in datafiles associated with the corresponding tablespace. Figure 4 1 illustrates this relationship.

Figure 4 - 1. Datafiles and Tablespaces

Although databases, tablespaces, datafiles, and segments are closely related, they have
important differences:
databases and tablespaces
An Oracle database is comprised of one or more logical storage units
called tablespaces. The database's data is collectively stored in the database's
tablespaces.
tablespaces and datafiles
Each tablespace in an Oracle database is comprised of one or more operating system
files called datafiles. A tablespace's datafiles physically store the associated database
data on disk.
databases and datafiles
A database's data is collectively stored in the datafiles that constitute each tablespace
of the database. For example, the simplest Oracle database would have one tablespace
and one datafile. A more complicated database might have three tablespaces, each
comprised of two datafiles (for a total of six datafiles).
schema objects, segments, and tablespaces
When a schema object such as a table or index is created, its segment is created within
a designated tablespace in the database. For example, suppose you create a table in a
specific tablespace using the CREATE TABLE command with the TABLESPACE
option. Oracle allocates the space for this table's data segment in one or more of the
datafiles that constitute the specified tablespace. An object's segment allocates space
in only one tablespace of a database. See Chapter 3, "Data Blocks, Extents, and
Segments", for more information about extents and segments and how they relate to
tablespaces.
The following sections further explain tablespaces and datafiles.

Tablespaces
A database is divided into one or more logical storage units
called tablespaces. A database administrator can use tablespaces to
do the following:

control disk space allocation for database data


assign specific space quotas for database users
control availability of data by taking individual tablespaces
online or offline
perform partial database backup or recovery operations
allocate data storage across devices to improve performance
A database administrator can create new tablespaces, add and
remove datafiles from tablespaces, set and alter default segment
storage settings for segments created in a tablespace, make a
tablespace read-only or writeable, make a tablespace temporary or
permanent, and drop tablespaces.
This section includes the following topics:
The SYSTEM Tablespace
Allocating More Space for a Database
Online and Offline Tablespaces
Read-Only Tablespaces
Temporary Tablespaces
The SYSTEM Tablespace

Every Oracle database contains a tablespace named SYSTEM that


Oracle creates automatically when the database is created. The
SYSTEM tablespace always contains the data dictionary tables for
the entire database.
A small database might need only the SYSTEM tablespace; however, it is
recommended that you create at least one additional tablespace to store user data
separate from data dictionary information. This allows you more flexibility in various
database administration operations and can reduce contention among dictionary
objects and schema objects for the same datafiles.

Note: The SYSTEM tablespace must always be kept online. See "Online and Offline
Tablespaces" .
All data stored on behalf of stored PL/SQL program units (procedures, functions,
packages and triggers) resides in the SYSTEM tablespace. If you create many of these
PL/SQL objects, the database administrator needs to plan for the space in the
SYSTEM tablespace that these objects use. For more information about these objects
and the space that they require, see Chapter 14, "Procedures and Packages", and
Chapter 15, "Database Triggers".
Allocating More Space for a Database

To enlarge a database, you have three options. You can add another
datafile to one of its existing tablespaces, thereby increasing the
amount of disk space allocated for the corresponding
tablespace. Figure 4 - 2 illustrates this kind of space increase.

Figure 4 - 2. Enlarging a Database by Adding a Datafile to a Tablespace


Alternatively, a database administrator can create a new tablespace (defined by an
additional datafile) to increase the size of a database. Figure 4 - 3 illustrates this.

Figure 4 - 3. Enlarging a Database by Adding a New Tablespace


The size of a tablespace is the size of the datafile(s) that constitute the tablespace,
and the size of a database is the collective size of the tablespaces that constitute the
database.
The third option is to change a datafile's size or allow datafiles in existing tablespaces
to grow dynamically as more space is needed. You accomplish this by altering
existing files or by adding files with dynamic extension properties. Figure 4 4 illustrates this.

Figure 4 - 4. Enlarging a Database by Dynamically Sizing Datafiles


For more information about increasing the amount of space in your database, see
the Oracle7 Server Administrator's Guide.
Online and Offline Tablespaces

A database administrator can bring any tablespace (except the


SYSTEM tablespace) in an Oracle database online (accessible)
or offline (not accessible) whenever the database is open.
Note: The SYSTEM tablespace must always be online because the data dictionary
must always be available to Oracle.
A tablespace is normally online so that the data contained within it is available to
database users. However, the database administrator might take a tablespace offline
for any of the following reasons:

to make a portion of the database unavailable, while allowing


normal access to the remainder of the database
to perform an offline tablespace backup (although a tablespace
can be backed up while online and in use)
to make an application and its group of tables temporarily
unavailable while updating or maintaining the application
When a Tablespace Goes Offline
When a tablespace goes offline, Oracle does not permit any
subsequent SQL statements to reference objects contained in the
tablespace. Active transactions with completed statements that
refer to data in a tablespace that has been taken offline are not
affected at the transaction level. Oracle saves rollback data
corresponding to statements that affect data in the offline
tablespace in a deferred rollback segment (in the SYSTEM
tablespace). When the tablespace is brought back online, Oracle
applies the rollback data to the tablespace, if needed.
You cannot take a tablespace offline if it contains any rollback segments that are in
use.
When a tablespace goes offline or comes back online, it is recorded in the data
dictionary in the SYSTEM tablespace. If a tablespace was offline when you shut
down a database, the tablespace remains offline when the database is subsequently
mounted and reopened.
You can bring a tablespace online only in the database in which it was created because
the necessary data dictionary information is maintained in the SYSTEM tablespace of
that database. An offline tablespace cannot be read or edited by any utility other than
Oracle. Thus, tablespaces cannot be transferred from database to database (transfer of
Oracle data can be achieved with tools described in Oracle7 Server Utilities).
Oracle automatically changes a tablespace from online to offline when certain errors
are encountered (for example, when the database writer process, DBWR, fails in
several attempts to write to a datafile of the tablespace). Users trying to access tables
in the tablespace with the problem receive an error. If the problem that causes this disk
I/O to fail is media failure, the tablespace must be recovered after you correct the
hardware problem.

Using Tablespaces for Special Procedures


By using multiple tablespaces to separate different types of data,
the database administrator can also take specific tablespaces offline
for certain procedures, while other tablespaces remain online and
the information in them is still available for use. However, special
circumstances can occur when tablespaces are taken offline. For
example, if two tablespaces are used to separate table data from
index data, the following is true:
If the tablespace containing the indexes is offline, queries can
still access table data because queries do not require an index
to access the table data.
If the tablespace containing the tables is offline, the table data
in the database is not accessible because the tables are
required to access the data.
In summary, if Oracle determines that it has enough information in
the online tablespaces to execute a statement, it will do so. If it
needs data in an offline tablespace, then it causes the statement to
fail.
Read-Only Tablespaces

The primary purpose of read-only tablespaces is to eliminate the


need to perform backup and recovery of large, static portions of a
database. Oracle never updates the files of a read-only tablespace,
and therefore the files can reside on read-only media, such as CD
ROMs or WORM drives.
Note: Because you can only bring a tablespace online in the database in which it was
created, read-only tablespaces are not meant to satisfy archiving or data publishing
requirements.
Whenever you create a new tablespace, it is always created as read-write. The READ
ONLY option of the ALTER TABLESPACE command allows you to change the
tablespace to read-only, making all of its associated datafiles read-only as well. You
can then use the READ WRITE option to make a read-only tablespace writeable
again.

Read-only tablespaces cannot be modified. Therefore, they do not need repeated


backup. Also, should you need to recover your database, you do not need to recover
any read-only tablespaces, because they could not have been modified.
You can drop items, such as tables and indexes, from a read-only tablespace, just as
you can drop items from an offline tablespace. However, you cannot create or alter
objects in a read-only tablespace.
Making a Tablespace Read-Only
Use the SQL command ALTER TABLESPACE to change a tablespace
to read-only. For information on the ALTER TABLESPACE command,
see the Oracle7 Server SQL Reference.
Read-Only vs. Online or Offline
Making a tablespace read-only does not change its offline or online
status.
Offline datafiles cannot be accessed. Bringing a datafile in a read-only tablespace
online makes the file readable. The file cannot be written to unless its associated
tablespace is returned to the read-write state. The files of a read-only tablespace can
independently be taken online or offline using the DATAFILE option of the ALTER
DATABASE command.
Restrictions on Read-Only Tablespaces
You cannot add datafiles to a tablespace that is read-only, even if
you take the tablespace offline. When you add a datafile, Oracle
must update the file header, and this write operation is not allowed.
To update a read-only tablespace, you must first make the tablespace writeable. After
updating the tablespace, you can then reset it to be read-only.
Read-Only Tablespaces and Recovery
Read-only tablespaces have several implications upon instance or
media recovery. See Chapter 24, "Database Recovery", for more
information about recovery.
Temporary Tablespaces

Space management for sort operations is performed more efficiently


using temporary tablespaces designated exclusively for sorts. This
scheme effectively eliminates serialization of space management
operations involved in the allocation and deallocation of sort space.

All operations that use sorts, including joins, index builds, ordering
(ORDER BY), the computation of aggregates (GROUP BY), and the
ANALYZE command to collect optimizer statistics, benefit from
temporary tablespaces. The performance gains are significant in
parallel server environments.
A temporary tablespace is a tablespace that can only be used for sort segments. No
permanent objects can reside in a temporary tablespace. Sort segments are used when
a segment is shared by multiple sort operations. One sort segment exists in every
instance that performs a sort operation in a given tablespace.
Temporary tablespaces provide performance improvements when you have multiple
sorts that are too large to fit into memory. The sort segment of a given temporary
tablespace is created at the time of the first sort operation. The sort segment grows by
allocating extents until the segment size is equal to or greater than the total storage
demands of all of the active sorts running on that instance.
You create temporary tablespaces using the following SQL syntax:
CREATE TABLESPACE tablespace TEMPORARY

You can also alter a tablespace from PERMANENT to TEMPORARY or vice versa
using the following syntax:
ALTER TABLESPACE tablespace TEMPORARY

For more information on the CREATE TABLESPACE and ALTER TABLESPACE


Commands, see Chapter 4 of Oracle7 Server SQL Reference.

Datafiles
A tablespace in an Oracle database consists of one or more
physical datafiles. A datafile can be associated with only one
tablespace, and only one database.

When a datafile is created for a tablespace, Oracle creates the file by allocating the
specified amount of disk space plus the overhead required for the file header. When a
datafile is created, the operating system is responsible for clearing old information and
authorizations from a file before allocating it to Oracle. If the file is large, this process
might take a significant amount of time.

Additional Information: For information on the amount of space required for the file
header of datafiles on your operating system, see your Oracle operating system
specific documentation.
Since the first tablespace in any database is always the SYSTEM tablespace, Oracle
automatically allocates the first datafiles of any database for the SYSTEM tablespace
during database creation.
Datafile Contents

After a datafile is initially created, the allocated disk space does not
contain any data; however, Oracle reserves the space to hold only
the data for future segments of the associated tablespace -- it
cannot store any other program's data. As a segment (such as the
data segment for a table) is created and grows in a tablespace,
Oracle uses the free space in the associated datafiles to allocate
extents for the segment.
The data in the segments of objects (data segments, index segments, rollback
segments, and so on) in a tablespace are physically stored in one or more of the
datafiles that constitute the tablespace. Note that a schema object does not correspond
to a specific datafile; rather, a datafile is a repository for the data of any object within
a specific tablespace. Oracle allocates the extents of a single segment in one or more
datafiles of a tablespace; therefore, an object can "span" one or more datafiles. Unless
table "striping" is used, the database administrator and end-users cannot control which
datafile stores an object.
Size of Datafiles

You can alter the size of a datafile after its creation or you can
specify that a datafile should dynamically grow as objects in the
tablespace grow. This functionality allows you to have fewer
datafiles per tablespace and can simplify administration of datafiles.
For more information about resizing datafiles, see the Oracle7 Server Administrator's
Guide.
Offline Datafiles

You can take tablespaces offline (make unavailable) or bring


them online (make available) at any time. Therefore, all datafiles
making up a tablespace are taken offline or brought online as a unit
when you take the tablespace offline or bring it online, respectively.

You can take individual datafiles offline; however, this is normally


done only during certain database recovery procedures

Вам также может понравиться