SQL select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
向USERS表空间增加一个数据文件:
SQL alter tablespace users add datafile '/opt/oracle/oradata/eygle/users02.dbf' size 10M;
Tablespace altered.
SQL select file#,name from v$datafile;
FILE# NAME
---------- --------------------------------------------------
1 /opt/oracle/oradata/eygle/system01.dbf
2 /opt/oracle/oradata/eygle/undotbs01.dbf
3 /opt/oracle/oradata/eygle/sysaux01.dbf
4 /opt/oracle/oradata/eygle/users01.dbf
5 /opt/oracle/oradata/eygle/users02.dbf
5 rows selected.
确认表空间文件信息:
SQL select file_name,file_id from dba_data_files where tablespace_name='USERS';
FILE_NAME FILE_ID
-------------------------------------------------- ----------
/opt/oracle/oradata/eygle/users02.dbf 5
/opt/oracle/oradata/eygle/users01.dbf 4
SQL select segment_name,file_id,blocks from dba_extents where file_id=5;
no rows selected
删除表空间中的空数据文件:
SQL alter tablespace users drop datafile '/opt/oracle/oradata/eygle/users02.dbf';
Tablespace altered.
检查数据字典,这个空文件的信息已经被彻底清除了:
SQL select file_name,file_id from dba_data_files where tablespace_name='USERS';
FILE_NAME FILE_ID
-------------------------------------------------- ----------
/opt/oracle/oradata/eygle/users01.dbf 4