Oracle7 Server SQL Reference

Contents Index Home Previous Next

Filespec

Purpose

To either specify a file as a data file or specify a group of one or more files as a redo log file group.

Prerequisites

A filespec can appear in either CREATE DATABASE, ALTER DATABASE, CREATE TABLESPACE, or ALTER TABLESPACE commands. You must have the privileges necessary to issue one of these commands. For information on these privileges, see the CREATE DATABASE command [*], the ALTER DATABASE command [*], the CREATE TABLESPACE command [*], and the ALTER TABLESPACE command [*].

Syntax

Keywords and Parameters

'filename'

is the name of either a data file or a redo log file member. A redo log file group can have one or more members, or copies. Each 'filename' must be fully specified according to the conventions for your operating system.

SIZE

specifies the size of the file. If you omit this parameter, the file must already exist. Note that the tablespace size must be one block greater than the sum of the sizes of the objects contained in it.

K specifies the size in kilobytes.

M specifies the size in megabytes.

If you omit K and M, the size is specified in bytes.

REUSE

allows Oracle7 to reuse an existing file. If the file already exists, Oracle7 verifies that its size matches the value of the SIZE parameter. If the file does not exist, Oracle7 creates it. If you omit this option, the file must not already exist and Oracle7 creates the file.

The REUSE option is only significant when used with the SIZE option. If you omit the SIZE option, Oracle7 expects the file to exist already. Note that whenever Oracle7 uses an existing file, the file's previous contents are lost.

Example I

The following statement creates a database named PAYABLE that has two redo log file groups, each with two members, and one data file:

CREATE DATABASE payable 
	LOGFILE GROUP 1 ('diska:log1.log', 'diskb:log1.log') SIZE 50K, 
	        GROUP 2 ('diska:log2.log', 'diskb:log2.log') SIZE 50K 
	DATAFILE 'diskc:dbone.dat' SIZE 30M 

The first filespec in the LOGFILE clause specifies a redo log file group with the GROUP value 1. This group has members named 'DISKA:LOG1.LOG' and 'DISKB:LOG1.LOG' each with size 50 kilobytes.

The second filespec in the LOGFILE clause specifies a redo log file group with the GROUP value 2. This group has members named 'DISKA:LOG2.LOG' and 'DISKB:LOG2.LOG', also with sizes of 50 kilobytes.

The filespec in the DATAFILE clause specifies a data file named 'DISKC:DBONE.DAT' of size 30 megabytes.

Since all of these filespecs specify a value for the SIZE parameter and omit the REUSE option, these files must not already exist. Oracle7 must create them.

Example II

The following statement adds another redo log file group with two members to the PAYABLE database:

ALTER DATABASE payable 
	ADD LOGFILE GROUP 3 ('diska:log3.log', 'diskb:log3.log') 
			SIZE 50K REUSE 

The filespec in the ADD LOGFILE clause specifies a new redo log file group with the GROUP value 3. This new group has members named 'DISKA:LOG3.LOG' and 'DISKB:LOG3.LOG' with sizes of 50 kilobytes each. Since the filespec specifies the REUSE option, each member can already exist. If a member exists, it must have a size of 50 kilobytes. If it does not exist, Oracle7 creates it with that size.

Example III

The following statement creates a tablespace named STOCKS that has three data files:

CREATE TABLESPACE stocks 
	DATAFILE 'diskc:stock1.dat', 
	         'diskc:stock2.dat',
 	         'diskc:stock3.dat' 

The filespecs for the data files specifies files named 'DISKC:STOCK1.DAT', 'DISKC:STOCK2.DAT', 'DISKC:STOCK3.DAT'. Since each filespec omits the SIZE parameter, each file must already exist.

Example IV

The following statement alters the STOCKS tablespace and adds a new data file:

ALTER TABLESPACE stocks 
	ADD DATAFILE 'diskc:stock4.dat' REUSE 

The filespec specifies a data file named 'DISKC:STOCK4.DAT'. Since the filespec omits the SIZE parameter, the file must already exist and the REUSE option is not significant.

Related Topics

CREATE DATABASE command [*] ALTER DATABASE command [*] CREATE TABLESPACE command [*] ALTER TABLESPACE command [*]


Contents Index Home Previous Next