Is there someone who knows (or has doc)
how exactly Oracle decides which
datafile to extend if the tablespace
have more than one datafile.
Tablespace TS1 has 3 datafiles :
data1.dbf - 10M free
data2.dbf - 20M free
data3.dbf - 15M free
Autoextend is enabled for the datafiles.
EMP table wants to allocate next extent of 50M.
Which datafile oracle will choose to
extend and why ?
you could try oracle documentation, Oracle 8i concepts chapter 4
4 Data Blocks, Extents, and Segments
Introduction to Data Blocks, Extents, and Segments
Data Block Format
An Introduction to PCTFREE, PCTUSED, and Row Chaining
When Extents Are Allocated
Determining the Number and Size of Extents
How Extents Are Allocated
When Extents Are Deallocated
Oracle will first check on the 1st data (relative file number to the tablespace) file whether it has already its maxsize reached, if it is not, then it will extend its size based on the autoextend next value.
If step 1 fails, then it will try on the 2nd file.
If the step 2 fails, it will try on the 3rd file.
If steps 1,2,3 fail, it will report an error.
Someone from experts-exchange.com wrote me
different answer than you :
The server builds an array of files for the tablespace whose autoextend parameter is set. The files
are stored in descending order of the calculation ( maxsize - currentsize ). Then it scans down this
array until the NEXT value is smaller than the difference determined. This file will be the one that
Oracle server chooses to extend.