Oracle DataFiles
Version 9.2
General InformationData Dictionary Objects Related To Data Filesfile $ DBA_DATA_FILESDBA_FREE_SPACENOTES:
x
x
x Create Data Files Alter Data FilesResize An Existing Tablespace DatafileALTER DATABASE DATAFILE '
to 'y' command does is to reset the pointers to the datafiles stored in the Control File which SMON reads at startup) conn / AS SYSDBASHUTDOWNcopy the datafile to its new location with operating system commands.STARTUP NOMOUNTALTER DATABASE MOUNT; ALTER DATABASE RENAME FILE ' c: /oracle/oradata/system01.dbf 'TO' d: /oracle/oradata/system01.dbf '; ALTER DATABASE OPEN; Alter Temp FilesResizealter database tempfile
. Ve create 4 tables in this tablespace Let's see which data file they were placed in ... SELECT segment_name, file_id FROM dba_extentsWHERE tablespace_name = 'BOWIE_DATA'; Note that * all * tables have their first extent created in the * first * data file defined to the tablespace.Now lets grow these tables and see what happens next.ALTER TABLE one ALLOCATE EXTENT; ALTER TABLE two ALLOCATE EXTENT; ALTER TABLE three ALLOCATE EXTENT; ALTER TABLE four ALLOCATE EXTENT; SELECT segment_name, file_idFROM dba_extentsWHERE tablespace_name = 'BOWIE_DATA' ORDER BY segment_name; ... and the second extent of each table has been created in the second data file of the tablespace.If a particular table were to keep growing ... ALTER TABLE four ALLOCATE EXTENT; ALTER TABLE four ALLOCATE EXTENT; SELECT segment_name, file_idFROM dba_extentsWHERE tablespace_name = 'BOWIE_DATA'ORDER BY segment_name; you can see how the extents get allocated to the data files in a round robin fashion But the first extent is allocate to the. first data file (providing it has sufficent space) ... CREATE TABLE five (x NUMBER) TABLESPACE bowie_data; SELECT segment_name, file_idFROM dba_extentsWHERE tablespace_name = 'BOWIE_DATA'ORDER BY segment_name;. Let's add a new data file What happens now ... ALTER TABLESPACE bowie_data ADD DATAFILE 'c: /bowie/bowie_data04.dbf' SIZE 10M; ALTER TABLE four ALLOCATE EXTENT; SELECT segment_name, file_idFROM dba_extentsWHERE tablespace_name = 'BOWIE_DATA'ORDER BY segment_name; A new extent is added to table four And uses the. New DataFile.alter Table Four Allocate Extent; SELECT SEGMENT_NAME, FILE_IDFROM DBA_EXTENTSWHERE TABLESPACE_NAME = 'Bowie_Data'
ORDER BY segment_name; ALTER TABLE four ALLOCATE EXTENT; SELECT segment_name, file_idFROM dba_extentsWHERE tablespace_name = 'BOWIE_DATA'ORDER BY segment_name; ... and now the new file is used The files are still used in a round robin fashion with the new file slipping. In.note How File 16 Is The Least. If I WERE TO Allocate Several New Tables That Were Only 1 Or 2 Extents in Size, See How File 16 Would Be The One To Be MOST Filled ".elated Topics