Oracle查看表空间和表空间中的对象

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';

原文地址:https://www.cnblogs.com/ZSG-DoBestMe/p/5112096.html