oracle11g 表空间常用命令

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

扩充表空间
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 regexp_substr('aaa,bb,ccccc,ddd,vvv','[^,]+',1,3)
from dual
查看表空间 对应 数据文件
查看用户 对应 表空间
SELECT * from dba_users
select table_name from user_tables; //当前用户的表
) 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 =
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;
select dbf.tablespace_name,
dbf.totalspace "总量(M)",
dbf.totalblocks as "总块数",
dfs.freespace "剩余总量(M)",
dfs.freeblocks "剩余块数",
round((dfs.freespace / dbf.totalspace),4) * 100 "空闲比例"
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",
(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)
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
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 tablespace_name,AUTOEXTENSIBLE,INCREMENT_BY from dba_data_files;

查看表空间
select tablespace_name, segment_name, round(sum(bytes/(1024*1024))) used
select table_name from all_tables; //所有用户的表
select table_name from dba_tables; //包括系统表
select table_name from dba_tables where owner='用户名'
创建表空间

下载文档原格式

  / 1