查看表空间利用率及相关及脚本
2010-05-04 13:30
127 查看
-- 查看表空间利用率
select
b.file_id file_id,
b.tablespace_name,
b.bytes,
b.maxbytes,
(b.bytes-sum(nvl(a.bytes,0))) used,
sum(nvl(a.bytes,0)) unused,
sum(nvl(a.bytes,0))/(b.bytes)*100 percentage
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_id,b.bytes,b.maxbytes
order by b.file_id;
or
select tablespace_name,sum(bytes)/1024/1024/1024 GB
from dba_data_files group by tablespace_name
union all
select tablespace_name,sum(bytes)/1024/1024/1024 GB
from dba_temp_files group by tablespace_name order by GB;
-- 查看数据文件表空间的对应关系
select t.name,t1.name
from v$tablespace t,
v$datafile t1
where t.ts# = t1.ts#
;
-- 创建表空间
1.表空间
create tablespace tablespacename datafile 'datafilepath/datafilename ' size 10g;
--删除
drop tablespace tablespacename including contents and datafiles;--删除表空间及操作系统的数据文件
2.临时表空间
create temporary tablespace TEMP2 TEMPFILE ''/home2/oracle/oradata/sysmon/temp02.dbf'' SIZE 10
g;
-- 删除
drop tablespace temp including contents and datafiles;--删除临时表空间及操作系统的数据文件
3.undo表空间
create undo tablespace undotbs_01
datafile '/u01/oracle/rbdb1/undo0201.dbf' size 2g;
-- 我们创建表空间时要以tbs_业务类型进行命名.
select
b.file_id file_id,
b.tablespace_name,
b.bytes,
b.maxbytes,
(b.bytes-sum(nvl(a.bytes,0))) used,
sum(nvl(a.bytes,0)) unused,
sum(nvl(a.bytes,0))/(b.bytes)*100 percentage
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_id,b.bytes,b.maxbytes
order by b.file_id;
or
select tablespace_name,sum(bytes)/1024/1024/1024 GB
from dba_data_files group by tablespace_name
union all
select tablespace_name,sum(bytes)/1024/1024/1024 GB
from dba_temp_files group by tablespace_name order by GB;
-- 查看数据文件表空间的对应关系
select t.name,t1.name
from v$tablespace t,
v$datafile t1
where t.ts# = t1.ts#
;
-- 创建表空间
1.表空间
create tablespace tablespacename datafile 'datafilepath/datafilename ' size 10g;
--删除
drop tablespace tablespacename including contents and datafiles;--删除表空间及操作系统的数据文件
2.临时表空间
create temporary tablespace TEMP2 TEMPFILE ''/home2/oracle/oradata/sysmon/temp02.dbf'' SIZE 10
g;
-- 删除
drop tablespace temp including contents and datafiles;--删除临时表空间及操作系统的数据文件
3.undo表空间
create undo tablespace undotbs_01
datafile '/u01/oracle/rbdb1/undo0201.dbf' size 2g;
-- 我们创建表空间时要以tbs_业务类型进行命名.
相关文章推荐
- 查看表空间利用率脚本-扩表空间大小
- oracle中查看表空间利用率的脚本
- Oracle查看表空间利用率脚本
- 查看表空间利用率
- MySQL 查看数据库相关信息的SQL脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- 查看Oracle基础配置信息和性能相关信息的脚本
- Oracle常用脚本-查看表空间使用情况
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看表空间使用率 SQL 脚本
- Scripts:查看表空间的语句脚本
- Oracle 查看表空间使用率 SQL 脚本
- 查看表空间及数据库相关信息
- Oracle查看表空间使用率SQL脚本
- 查看表空间利用率
- 查看数据库表所属空间及空间利用率
- 【转】Oracle 查看表空间使用率 SQL 脚本
- Oracle 查看 Shared Pool 信息的相关脚本
- Oracle 查看表空间使用率 SQL 脚本
- hta查看磁盘空间的脚本