Oracle 檢視使用者相關資訊

2021-06-27 22:29:43 字數 2052 閱讀 2485

--0 表空間

--檢視當前使用者下的角色、系統許可權、表級許可權、所有表

select * from user_role_privs

select * from user_sys_privs;

select * from user_tab_privs;

select * from user_tables;

--1 使用者

--檢視當前使用者的預設表空間

select username, default_tablespace from user_users

--顯示當前會話的所有許可權、角色

select * from session_privs;

select * from session_roles;

--顯示指定使用者所具有的系統許可權

select * from dba_sys_privs where grantee = 'wcadmin'

--2 表

--檢視名稱包含cost字元的表

select object_name, object_id from user_objects where instr(object_name, 'cost') > 0

--檢視表的資訊

select * from user_objects where instr(object_name, 'cost') > 0

--檢視表大小

select sum(byte) / (1024 * 1024) as "size(m)" from user_segments where segment_name = upper('&cost')

--檢視放在oracle記憶體區的表

select table_name, cache from user_tables where instr(cache, 'y') > 0;

--3 索引

--檢視索引個數和類別

select index_name, index_type, table_name from user_indexes order by table_name;

--檢視索引被索引的字段

select * from user_ind_columns where index_name = upper('account_login_name_uk');

--檢視索引的大小

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

--4 序列號

--檢視序列號,last_number是當前值

select * from user_sequences;

--5 檢視

--檢視檢視的名稱

select view_name from user_views;

--檢視建立檢視的select語句

select text from user_views where view_name = upper('&view_name');

--6 檢視表的約束條件

select constraint_name,

constraint_type,

search_condition,

r_constraint_name

from user_constraints

where table_name = upper('cost');

select c.constraint_name, c.constraint_type, cc.column_name

from user_constraints c, user_cons_columns cc

where c.owner = upper('&table_owner')

and c.table_name = upper('&table_name')

and c.owner = cc.owner

and c.constraint_name = cc.constraint_name

order by cc.position;

oracle檢視當前使用者資訊

一 檢視當前使用者資訊 1 檢視當前使用者擁有的角色許可權資訊 select from role sys privs 2 檢視當前使用者的詳細資訊 select from user users 3 檢視當前使用者的角色資訊 select from user role privs 總結 oracle中...

oracle檢視當前使用者資訊

一 檢視當前使用者資訊 1 檢視當前使用者擁有的角色許可權資訊 select from role sys privs 2 檢視當前使用者的詳細資訊 select from user users 3 檢視當前使用者的角色資訊 select from user role privs 總結 oracle中...

oracle 查詢使用者相關資訊

表 select from all tables where owner upper system 索引 select from all indexes where owner upper system 檢視 select from all views where owner upper syste...