统计Oracle数据库某个用户下面的对象个数
阅读原文时间:2023年07月09日阅读:2

统计某个用户下面的对象个数

  包括表,视图,同义词,函数,存储过程,包,触发器,索引,约束,序列。

1. sql语句

SELECT

(SELECT COUNT(*) FROM USER_TABLES) AS TABLES,

(SELECT COUNT(*) FROM USER_VIEWS)AS VIEWS,

(SELECT COUNT(*) FROM USER_SYNONYMS)AS SYNONYMS,

(SELECT COUNT(*) FROM USER_OBJECTS WHERE OBJECT_TYPE='FUNCTION') AS FUNCTIONS,

(SELECT COUNT(*) FROM USER_OBJECTS WHERE OBJECT_TYPE='PROCEDURE') AS PROCEDURES,

(SELECT COUNT(*) FROM USER_OBJECTS WHERE OBJECT_TYPE='PACKAGE') AS PACKAGES,

(SELECT COUNT(*) FROM USER_OBJECTS WHERE OBJECT_TYPE='TRIGGER') AS TRIGGERS,

(SELECT COUNT(*) FROM USER_INDEXES) AS INDEXES,

(SELECT COUNT(*) FROM USER_CONSTRAINTS) AS CONSTRAINTS,

(SELECT COUNT(*) FROM USER_SEQUENCES) AS SEQUENCES

FROM DUAL

2. 执行结果