select * from user_tables;--查詢所有用戶表
select username,default_tablespace from user_users;--查詢當前表空間
select tablespace_name from dba_tablespaces;--查詢所有表空間
select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;--查詢所有表空間大小
--統計所有表空間
select b.file_name 物理文件名,b.tablespace_name 表空間,b.bytes / 1024 / 1024 大小M,(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 已使用M,
substr((b.bytes - sum(nvl(a.bytes, 0))) / (b.bytes) * 100, 1, 5) 利用率
from dba_free_space a,dba_data_files b
where a.file_id = b.file_id
group by b.tablespace_name,b.file_name, b.bytes
order by b.tablespace_name;
--查看指定表空間中的對象
-- OBJECT_NAME 存儲過程名 OBJECT_TYPE 對象類型
SELECT a.owner ?所屬用戶,
a.segment_name 分區,
b.OBJECT_NAME 存儲過程名
From dba_segments a,
DBA_OBJECTS b
WHERE a.tablespace_name = 'TBS_CRM_DCUBE'
and trim(a.owner) = trim(b.OWNER)
and b.OBJECT_TYPE = 'PROCEDURE';
--查看 資源內容該ALL_SOURCE中只有以下5種類型
--1 FUNCTION
--2 JAVA SOURCE
--3 PACKAGE
--4 PACKAGE BODY
--5 PROCEDURE
SELECT a.text FROM ALL_SOURCE a where TYPE='PROCEDURE'and name='P_UIP_ADDBANKIP';