事在人为
全部博文(10)
分类: Oracle
2013-03-05 14:37:48
=============查看表空间是否自动增加============
set wrap off
col tablespace_name format a35
col AUTOEXTENSIBLE format a10
col file_name format a40
select a.tablespace_name,b.file_name,b.AUTOEXTENSIBLE
from dba_tablespaces a ,dba_data_files b where a.tablespace_name=b.tablespace_name order by 1;
=======查看表空间总大小,剩余大小,使用大小----满了看不到
set pagesize 999
set linesize 400
set wrap off
col tablespace_name format a35
select a.tablespace_name,total,free,total-free used,round((free/total)*100)||'%' "FREE%" from
( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files
group by tablespace_name) a,
( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space
group by tablespace_name) b
where a.tablespace_name=b.tablespace_name;
--查看由于满了而没有显示的tablespace_name ----temp不算
select tablespace_name from dba_tablespaces where tablespace_name not in
(select tablespace_name from
(
select a.tablespace_name,total,free,total-free used,round((free/total)*100)||'%' "FREE%" from
( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files
group by tablespace_name) a,
( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space
group by tablespace_name) b
where a.tablespace_name=b.tablespace_name
)
);
============查看表空间物理文件的名称及大小===========
select tablespace_name, file_id, file_name,
round(bytes/(1024*1024),0) total_space
from dba_data_files order by tablespace_name;
===============新建表空间=======================
create tablespace zjy_test_tbs datafile '/app/dota/zjy_test_tbs.dbf' SIZE 1024M AUTOEXTEND ON NEXT 200M MAXSIZE unlimited extent management local uniform size 5m;
=============增加数据文件 ============
ALTER DATABASE DATAFILE '/oradata/ts_large_idx01.dbf' RESIZE 4000M;