管理表空间和数据文件——显示表空间和数据文件信息


1.显示表空间详细信息

通过查询数据字典视图dba_tablespace ,可以显示数据库所有表的详细信息。

例子:显示所有表空间名称,状态,内容及是否为大文件表空间:

col tablespace_name format a20
select tablespace_name,status,contents,bigfile from dba_tablespaces;

2.显示表空间的编号和名称

通过查询动态性能视图v$tablespace ,可以显示表空间的编号和名称等信息。

select * from v$tablespace;

3.显示表空间所包含的数据文件

select file_name,bytes,maxbytes,autoextensible
from dba_data_files where tablespace_name='DATA01';

4.显示数据文件动态信息
通过查询动态性能视图v$datafile ,可以取得数据文件的动态变化信息。

例子:

col name format a25
select name,checkpoint_time,checkpoint_change# from v$datafile;

 5.显示临时表空间组的信息

通过查询数据字典视图dba_tablespace_groups ,可以显示临时表空间及其其包含的临时表空间信息。

例子:

select tablespace_name from dba_tablespace_groups
where group_name='GROUP1';

6.显示临时表空间所包含的的临时文件
通过查询数据字典视图dba_temp_files,可以显示临时文件的详细信息。

例子:

select file_name,bytes,maxbytes,autoextensible
from dba_temp_files where tablespace_name='TEMP01';

7.显示临时文件动态信息

通过查询动态性能视图v$tempfile ,可以显示控制文件所记载的临时文件信息。

例子:

select name,status,enabled from v$tempfile;

原文地址:https://www.cnblogs.com/zhaojiedi1992/p/oracle11g_sql_0053.html