dba_data_files
|
Column |
Datatype |
NULL |
Description |
|
FILE_NAME |
VARCHAR2(513) |
|
Name of the database file ---数据文件名称 |
|
FILE_ID |
NUMBER |
NOT NULL |
File identifier number of the database file ----数据文件标识ID |
|
TABLESPACE_NAME |
VARCHAR2(30) |
NOT NULL |
Name of the tablespace to which the file belongs ----数据文件归属的表空间 |
|
BYTES |
NUMBER |
|
Size of the file in bytes ----数据文件的空间大小 |
|
BLOCKS |
NUMBER |
NOT NULL |
Size of the file in Oracle blocks ----数据文件的块数 BYTES = BLOCKS * 8 *1024 |
|
STATUS |
VARCHAR2(9) |
|
File status: AVAILABLE or INVALID (INVALID means that the file number is not in use, for example, a file in a tablespace that was dropped) ----文件状态 |
|
RELATIVE_FNO |
NUMBER |
|
Relative file number |
--
|
· FILE_ID被称为 绝对文件号,RELATIVE_FNO被称为相当文件号 · 二者在大部分的时候,都是相等的 · FILE_ID在整个数据库中是唯一的;RELATIVE_FNO在整个TABLESPACE中是唯一的,在数据库中不唯一 · 一个TABLESPACE中的最大文件数量为1023,所以,一旦超过该极限,则RELATIVE_FNO将重新计算 | |||
|
AUTOEXTENSIBLE |
VARCHAR2(3) |
|
Autoextensible indicator ---自动扩展的标记 可以设定数据文件随着表空间内的方案对象增长而动态的增长 |
|
MAXBYTES |
NUMBER |
|
Maximum file size in bytes ----最大的数据文件的大小 |
|
MAXBLOCKS |
NUMBER |
|
Maximum file size in blocks ---最大的块数 |
|
INCREMENT_BY |
NUMBER |
|
Autoextension increment ----数据文件自动扩展数据块的个数 |
|
USER_BYTES |
NUMBER |
|
Corresponding number of bytes ---user_blocks and user_bytes are the space users can use, usually equal to datafile size minus 数据文件的可用空间,等于数据文件的大小减去数据块头的大小 |
|
USER_BLOCKS |
NUMBER |
|
Number of blocks which can be used by the data
|
dba_free_space
|
Column |
Datatype |
NULL |
Description |
|
TABLESPACE_NAME |
VARCHAR2(30) |
|
Name of the tablespace containing the extent |
|
FILE_ID |
NUMBER |
|
File identifier number of the file containing the extent |
|
BLOCK_ID |
NUMBER |
|
Starting block number of the extent
|
|
BYTES |
NUMBER |
|
Size of the extent (in bytes) |
|
BLOCKS |
NUMBER |
|
Size of the extent (in Oracle blocks) |
|
RELATIVE_FNO |
NUMBER |
|
Relative file number of the file containing the extent |
--1查看表空间已经使用的百分比
select a.tablespace_name,a.bytes/1024/1024 "sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB",round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used"
from
(select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a,
(select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b
where a.tablespace_name=b.tablespace_name
order by ((a.bytes-b.bytes)/a.bytes) desc
“sum MB”表示表空间所有的数据文件总共在操作系统占用磁盘空间的大小
比如:test表空间有2个数据文件,datafile1为300MB,datafile2为400MB,那么test表空间的“Sum MB”就是700MB
“userd MB”表示表空间已经使用了多少
“free MB”表示表空间剩余多少
“percent_user”表示已经使用的百分比
2 获取创建表空间的语句:
select dbms_metadata.get_ddl('TABLESPACE','SYSTEM’) from dual;
3确认磁盘空间足够,增加一个数据文件
alter tablespace MLOG_NORM_SPACE
add datafile '/oracle/oms/oradata/mlog/****001.dbf'
size 10M autoextend on maxsize 20G
4如果删除表空间数据文件,如下:
alter tablespace MLOG_NORM_SPACE
drop datafile '/oracle/oms/oradata/mlog*****001.dbf'
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22111412/viewspace-611196/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22111412/viewspace-611196/
本文介绍了Oracle数据库中的数据文件管理,包括数据文件的主要属性及其在表空间中的作用。提供了查询表空间使用情况的方法,并展示了如何通过SQL命令增加或删除数据文件。

1万+

被折叠的 条评论
为什么被折叠?



