Resizing Datafiles in Oracle 7.2 and Above

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Resizing Datafiles in Oracle 7.

2 and Above
by Jeff Hunter, Sr. Database Administrator
Manually Resizing Datafiles
As of Oracle 7.2, existing datafiles can be resized via the alter database and a
lter tablespace command. To manually extend a datafile, use the alter database c
omment, as show in the following example:
alter database
datafile 'D:\ORANT\DEV\DATAFILES\USER1.ORA' resize 350M;
After the alter database command is executed, the datafile (in the above example
), would be resized to 350M in size. If the datafile had been more than 350M in
size, it will be decreased in size to 350M.
To resize a datafile using the alter tablespace command, you must specify the na
me of the tablespace to which the datafile belongs. Here is an example using the
alter tablespace command:
alter tablespace USER_DATA
datafile 'D:\ORANT\DEV\DATAFILES\USER1.ORA' resize 350M;
Automatically Extending Datafiles
As of Oracle 7.2, you can specify parameters when creating datafiles that will a
utomatically extend datafiles whenever their current allocated length is exceede
d. Here are the three sizing parameters used when creating datafiles: autoextend
A flag that can be set to ON or OFF to indicate if the datafile should be allow
ed to automatically extend. If this parameter is set to OFF, the other sizing pa
rameters (below) will be set to zero.
next size The size, in bytes, of the area of disk space to allocate to the dataf
ile when more space is required. You may qualify the size value with 'K' and 'M'
for kilobytes and megabytes respectively.
maxsize size The maximum size, in bytes, to which the datafile should be allowed
to extend. You may qualify the size value with 'K' and 'M' for kilobytes and me
gabytes respectively.

Here is a small example:


CREATE TABLESPACE user_data2
DATAFILE 'D:\ORANT\DEV\DATAFILES\USER2_1.ORA' SIZE 500M
AUTOEXTEND ON
NEXT 100M
MAXSIZE 900M;

You might also like