oracle查询所有用户表的表名、主键名称、索引、外键等
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;
7、Oracle查询用户表空间:select * from user_all_tables
8、Oracle查询所有函数和储存过程:select * from user_source
9、Oracle查询所有用户:
select * from all_users;
select * from dba_users
10、Oracle查看当前用户连接:select * from v$Session
11、Oracle查看当前用户权限:select * from session_privs
12、Oracle查看用户表空间使用情况:
select a.file_id "FileNo",a.tablespace_name
"Tablespace_name",
a.bytes "Bytes",a.bytes-sum(nvl(b.bytes,0)) "Used",
sum(nvl(b.bytes,0)) "Free",
sum(nvl(b.bytes,0))/a.bytes*100 "%free"
from dba_data_files a, dba_free_space b
where a.file_id=b.file_id(+)
group by a.tablespace_name ,
a.file_id,a.bytes order by a.tablespace_name;
oracle查询所有用户表的表名、主键名称、索引、外键等的更多相关文章
- oracle查询当前用户名下所有表
select * from all_tables where owner='TEST': TEST为用户名,用户名必须是大写. 查看当前登录的用户的表: select table_name from ...
- oracle查询当前用户下所有的表,包括所有的字段
oracle查询当前用户下所有的表,包括所有的字段 背景: 前两天接到一个需求,做一个展示所有表名,表备注,表数据,表字段数,点击查看按钮查看字段名和注释,支持导出. 在Oracle中,可用使用视 ...
- Oracle查询当前用户和当前用户下的所有表
转载自:http://blog.itpub.net/29485627/viewspace-1246317/ Oracle查询当前用户和当前用户下的所有表 (1)查询当前用户 SQL> show ...
- oracle 怎么查看用户对应的表空间
oracle 怎么查看用户对应的表空间? 查询用户: 查看数据库里面所有用户,前提是你是有 dba 权限的帐号,如 sys,system: select * from dba_users; 查看你能管 ...
- MySQL基础9-主键约束、外键约束、等值连接查询、一对一和多对多关系
1.主键约束和外键约束 外键约束 * 外键必须是另一表的主键的值(外键要引用主键!) * 外键可以重复 * 外键可以为空 * 一张表中可以有多个外键! 概念模型在数据库中成为表 数据库表中的多对一关系 ...
- oracle一个创建用户、创建表空间、授权、建表的完整过程
1.首先我们可以用scott用户以sysdba的身份登录oracle. conn scott/tiger as sysdba 2.然后我就可以来创建用户了. create user zzg ident ...
- oracle删除当前用户下所有表
1.如果有删除用户的权限,则可以: drop user user_name cascade; 加了cascade就可以把用户连带的数据全部删掉. 删除后再创建该用户.--创建管理员用户create u ...
- Oracle查看当前用户所在的表空间
1.用户 查看当前用户的缺省表空间 select username,default_tablespace from user_users; 1 查看当前用户的角色 select * from user ...
- ORM( ORM查询13种方法3. 单表的双下划线的使用 4. 外键的方法 5. 多对多的方法 ,聚合,分组,F查询,Q查询,事务 )
必知必会13条 <1> all(): 查询所有结果 <2> get(**kwargs): 返回与所给筛选条件相匹配的对象,返回结果有且只有一个,如果符合筛选条件的对象超过一个或 ...
随机推荐
- bootstrap的其他
情境文本颜色 <p class="text-muted">...</p> <p class="text-primary">. ...
- excel文件的groovy脚本在SoapUI中进行数据驱动测试
SoapUI Pro具有从外部文件读取数据的功能,例如:excel,csv等.但SoapUI不提供从excel文件读取数据的功能.因此,为了从SoapUI中的excel文件中读取数据,我们需要在gro ...
- nginx 之 proxy_pass
nginx中有两个模块都有proxy_pass指令 ngx_http_proxy_module的proxy_pass 语法: proxy_pass URL; 场景: location, if in l ...
- CodeForces - 1110C-Meaningless Operation(打表找规律)
Can the greatest common divisor and bitwise operations have anything in common? It is time to answer ...
- javascript的Astar版 寻路算法
去年做一个模仿保卫萝卜的塔防游戏的时候,自己写的,游戏框架用的是coco2d-html5 实现原理可以参考 http://www.cnblogs.com/technology/archive/2011 ...
- Data Guard 管理原理
##三大优势>Data Guard属于Oracle 自己的产品,其技术成熟完善.稳定可靠>可以随时验证业务数据的有效性>免费产品 Data Guard由主库(PRIMARY DATA ...
- (转)linux expr命令参数及用法详解
linux expr命令参数及用法详解 原文:http://blog.csdn.net/tianmohust/article/details/7628694 expr用法 expr命令一般用于整数值, ...
- OpenGL进阶之Instancing
Instancing Instancing绘制我想很多童鞋都不陌生,这个技术主要用来快速渲染大量相同的几何体,可以大大提高绘制效率.每个instance在shader中都有一个独一无二的索引,可以用来 ...
- Red–black tree ---reference wiki
source address:http://en.wikipedia.org/wiki/Red%E2%80%93black_tree A red–black tree is a type of sel ...
- core核心模块
5. core核心模块 核心模块会通过compiler模块提供的调用compiler的功能, 将用户的输入转为VM直接的输入 编译模块用来编译, 而核心模块用来执行 在core.h文件中 // 不需要 ...