oracle 对象查询
来源:互联网 发布:制作桌面日历软件 编辑:程序博客网 时间:2024/06/05 23:44
---dba_ 所有 user_ 当前
select * from dba_tables where owner = 'AMSDBO';
select * from user_tables;
select * from dba_source where owner = 'AMSDBO' and type not in( 'PROCEDURE','FUNCTION');
select * from user_source;
select * from dba_types where owner = 'AMSDBO';
select * from user_types;
select * from dba_views where owner = 'AMSDBO';
select * from user_views;
0、表空间
select username,default_tablespace from user_users;
查看当前用户的角色
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 user_role_privs;
查看当前用户的系统权限和表级权限
select * from user_sys_privs;
select * from user_tab_privs;
显示当前会话所具有的权限
select * from session_privs;
显示指定用户所具有的系统权限
select * from dba_sys_privs where grantee='GAME';
2、表
查看用户下所有的表
select * from user_tables;
SELECT * FROM ALL_TABLES;
查看名称包含log字符的表
select object_name,object_id from user_objects where instr(object_name,'LOG')>0;
查看某表的创建时间
select object_name,created from user_objects where object_name=upper('&table_name');
查看某表的大小
select sum(bytes)/(1024*1024) as "size(M)" from user_segments
where segment_name=upper('&table_name');
查看放在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('&index_name');
查看索引的大小
select sum(bytes)/(1024*1024) as "size(M)" from user_segments
where segment_name=upper('&index_name');
4、序列号
查看序列号,last_number是当前值
select * from user_sequences;
5、视图
查看视图的名称
select view_name from user_views;
查看创建视图的select语句
set view_name,text_length from user_views;
set long 2000; 说明:可以根据视图的text_length值设定set long 的大小
select text from user_views where view_name=upper('&view_name');
6、同义词
查看同义词的名称
select * from user_synonyms;
SELECT * FROM ALL_SYSNONYMS;
7、约束条件
查看某表的约束条件
SQL>select constraint_name, constraint_type,search_condition, r_constraint_name
from user_constraints where table_name = upper('&table_name');
SQL>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;
8、存储函数和过程
查看函数和过程的状态
SQL>select object_name,status from user_objects where object_type='FUNCTION';
SQL>select object_name,status from user_objects where object_type='PROCEDURE';
查看函数和过程的源代码
SQL>select text from all_source where owner=user and name=upper('&plsql_name');
--◆Oracle查询用户表空间:
select * from session_privs ;
select a.file_id as "FileNo",a.tablespace_name as "Tablespace_name",a.bytes as "Bytes",a.bytes - sum(nvl(b.bytes, 0)) as "Used",sum(nvl(b.bytes, 0)) as "Free",sum(nvl(b.bytes, 0)) / a.bytes * 100 as "%free"from dba_data_files a, dba_free_space bwhere a.file_id = b.file_id(+)group by a.tablespace_name, a.file_id, a.bytesorder by a.tablespace_name;
1、查找表的所有索引(包括索引名,类型,构成列):
select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.index_name and t.table_name = i.table_name and t.table_name = 要查询的表
2、查找表的主键(包括名称,构成列):
select cu.* from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'P' and au.table_name = 要查询的表
3、查找表的唯一性约束(包括名称,构成列):
select column_name from user_cons_columns cu, user_constraints au where cu.constraint_name = au.constraint_name and au.constraint_type = 'U' and au.table_name = 要查询的表
4、查找表的外键(包括名称,引用表的表名和对应的键名,下面是分成多步查询):
select * from user_constraints c where c.constraint_type = 'R' and c.table_name = 要查询的表
查询外键约束的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键名称
查询引用表的键的列名:
select * from user_cons_columns cl where cl.constraint_name = 外键引用表的键名
5、查询表的所有列及其属性
select t.*,c.COMMENTS from user_tab_columns t,user_col_comments c where t.table_name = c.table_name and t.column_name = c.column_name and t.table_name = 要查询的表
6、Oracle中每个用户表的表名和行数
select table_name,num_rows from user_tables;
- oracle 对象查询
- Oracle查询对象创建语句
- oracle常用对象查询sql
- oracle 集群中全局对象的查询
- oracle数据库管理--对象、角色相关查询
- 查询oracle被锁对象并解锁
- 查询oracle被锁对象并解锁
- 查询oracle被锁对象并解锁
- PL/SQL查询oracle数据库对象
- oracle 数据库的常用查询对象
- oracle 被锁对象查询和失效包查询
- Oracle中查询各种对象的方法小结
- [Oracle] 查询修改序列对象的当前值
- oracle 数据库对象增长记录查询对比语句
- Oracle 表空间利用率及对象大小查询
- oracle查询对象(表、索引)空间信息
- Oracle 如何查询一个对象的完整定义语句
- 查询ORACLE被锁的对象以及解锁
- msm7227平台linux I2C驱动分析(2.6.29)
- Oracle基本语句
- python入门篇-1
- python入门篇-2
- php:兄弟连之面向对象版图形计算器2
- oracle 对象查询
- Codeforces Round #249 (Div. 2) ABC
- 严重: Exception sending context initialized event to listener instance of class org.springframework.we
- 伸展树
- 将ZXING打包生成jar文件
- 关于socket的一些个人理解
- freemarker中的round、floor和ceiling数字的舍入处理
- 插入排序……
- oracle解锁表