檢視表空間

2021-08-26 03:29:26 字數 1151 閱讀 2224

--檢視某錶的大小--

select sum(bytes) / (1024 * 1024) as "size(m)"

from user_segments

where segment_name = upper('tbl_mo_part_00');

--檢視索引個數和類別 --

select index_name, index_type, table_name, t.sample_size

from user_indexes t

order by table_name;

--檢視索引的大小 --

select sum(bytes) / (1024 * 1024) as "size(m)"

from user_segments

where segment_name = upper('tbl_mo_part_01');

--檢視表空間的使用情況 和 物理空間大小--

select t.tablespace_name,d.file_name,sum(t.bytes)/(1024*1024) as "free_space(m)",round(d.bytes/(1024*1024),0) "total_space(m)"

from dba_free_space t, dba_data_files d

where t.tablespace_name = d.tablespace_name

group by t.tablespace_name,d.file_name,d.bytes;

--下面的語句用來查詢哪些物件被鎖--

select object_name,machine,s.sid,s.serial# from v$locked_object l,dba_objects o, v$session s

where l.object_id = o.object_id and l.session_id = s.sid;

--殺死乙個被鎖的程序,要用到上面的結果

alter system kill session 'sid';

--檢視鎖表程序

select * from v$session t1, v$locked_object t2 where t1.sid = t2.session_id;

sqlserver檢視表空間

sqlserver 用於檢視當前資料庫所有表占用空間大小的儲存過程 create procedure dbo.proc getsize asbegin create table temp t id intprimary keyidentity 1,1 t name sysname,表名 t rows...

檢視表占用空間資訊

if not exists select from dbo.sysobjects where id object id n dbo tablespaceinfo and objectproperty id,n isusertable 1 create table tablespaceinfo 建立臨...

oracle 檢視表空間大小

1.檢視所有表空間大小 sql select tablespace name,sum bytes 1024 1024 from dba data files 2 group by tablespace name 2.已經使用的表空間大小 sql select tablespace name,sum ...