oracle11g 表空间常用命令

  • 格式:txt
  • 大小:2.20 KB
  • 文档页数:1



正则表达式

select regexp_substr('aaa,bb,ccccc,ddd,vvv','[^,]+',1,3)
from dual



查看表空间 对应 数据文件




查看用户 对应 表空间
SELECT * from dba_users



select table_name from user_tables; //当前用户的表

select table_name from all_tables; //所有用户的表

select table_name from dba_tables; //包括系统表

select table_name from dba_tables where owner='用户名'


创建表空间


create tablespace "TBL99" datafile '/a8root/app/oracle/oradata/tablespace/TBL99.tbl' size 20480M logging online permanent blocksize 8k extent management local autoallocate segment space management auto;


扩充表空间
ALTER TABLESPACE "TBL99" ADD DATAFILE '/a8root/app/oracle/oradata/dmbi/tablespace/TBL99_2.tbl' size 20480M



--ALTER TABLESPACE "TBS_NAME" ADD DATAFILE 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\ex_data' SIZE 10240M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED


查看表空间 属性

select tablespace_name,AUTOEXTENSIBLE,INCREMENT_BY from dba_data_files;



查看表空间

select tablespace_name, segment_name, round(sum(bytes/(1024*1024))) used
from dba_extents
where tablespace_name='DW_TBL01'
group by tablespace_name,segment_name
order by round(sum(bytes/(1024*1024))) desc;







SELECT "Tablespace Name",
Free_space, (total_space-Free_space) Used_space, total_space
FROM
(select tablespace_name, sum(bytes/1024/1024) Free_Space
from sys.dba_free_space
group by tablespace_name
) Free,
(select , sum(bytes/1024/1024) TOTAL_SPACE
from sys.v_$datafile a, sys.v_$tablespace B
where a.ts# = b.ts#
group by
) Total
WHERE Free.Tablespace_name =





select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as "总块数",
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
round((dfs.freespace / dbf.totalspace),4) * 100 "空闲比例"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)


下载文档原格式

  / 1
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。