oracle 字典表查询
2024-08-24 09:41:03
1.oracle 字典表查询
/*显示当前用户*/
show user
在sql plus中可用,在pl sql中不可用 /*查看所有用户名*/
select username,user_id,created from all_users; /*查看当前用户的用户详情*/
select username,user_id,account_status,lock_date,expiry_date,default_tablespace,temporary_tablespace,created,initial_rsrc_consumer_group,external_name from user_users; /*查看数据库的版本*/
select product,version,status from product_component_version; /*查看当前用户的用户权限,系统权限和表级权限*/
select username,granted_role,admin_option,default_role,os_granted from user_role_privs;
select username,privilege,admin_option from user_sys_privs;
select grantee,owner,table_name,grantor,priviege,granttable,hierarchy from user_tab_privs; 查看当前用户的缺省表空间
SQL>select username,default_tablespace from user_users; 查看当前用户的角色
SQL>select * from user_role_privs; 查看当前用户的系统权限和表级权限
SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs; 查看用户下所有的表
SQL>select * from user_tables; 显示用户信息(所属表空间)
select default_tablespace,temporary_tablespace
from dba_users where username='GAME'; 1、用户 查看当前用户的缺省表空间
SQL>select username,default_tablespace from user_users; 查看当前用户的角色
SQL>select * from user_role_privs; 查看当前用户的系统权限和表级权限
SQL>select * from user_sys_privs;
SQL>select * from user_tab_privs; 显示当前会话所具有的权限
SQL>select * from session_privs; 显示指定用户所具有的系统权限
SQL>select * from dba_sys_privs where grantee='GAME'; 显示特权用户
select * from v$pwfile_users; 显示用户信息(所属表空间)
select default_tablespace,temporary_tablespace
from dba_users where username='GAME'; 显示用户的PROFILE
select profile from dba_users where username='GAME';
2、表 查看用户下所有的表
SQL>select * from user_tables; 查看名称包含log字符的表
SQL>select object_name,object_id from user_objects
where instr(object_name,'LOG')>0; 查看某表的创建时间
SQL>select object_name,created from user_objects where object_name=upper('&table_name'); 查看某表的大小
SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segments
where segment_name=upper('&table_name'); 查看放在Oracle的内存区里的表
SQL>select table_name,cache from user_tables where instr(cache,'Y')>0; 3、索引 查看索引个数和类别
SQL>select index_name,index_type,table_name from user_indexes order by table_name; 查看索引被索引的字段
SQL>select * from user_ind_columns where index_name=upper('&index_name'); 查看索引的大小
SQL>select sum(bytes)/(1024*1024) as "size(M)" from user_segments
where segment_name=upper('&index_name'); 4、序列号 查看序列号,last_number是当前值
SQL>select * from user_sequences; 5、视图 查看视图的名称
SQL>select view_name from user_views; 查看创建视图的select语句
SQL>set view_name,text_length from user_views;
SQL>set long 2000; 说明:可以根据视图的text_length值设定set long 的大小
SQL>select text from user_views where view_name=upper('&view_name'); 6、同义词 查看同义词的名称
SQL>select * from user_synonyms; 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'); 查看表与主键的关系:
select b.table_name, column_name from
(select table_name, constraint_name from user_constraints where constraint_type = 'P') a,
user_cons_columns b
where a.constraint_name = b.constraint_name
and a.table_name = b.table_name
order by b.position;
最新文章
- angularJS——ng-bind指令与插值的区别
- Linux 中断处理浅析
- Android使用Fragment来实现ViewPager的功能(解决切换Fragment状态不保存)以及各个Fragment之间的通信
- 51Nod 1378 夹克老爷的愤怒
- hdu1754 线段树
- C# keybd_event模拟对照表以及用法.
- underscore的封装和扩展
- MPAndroidChart
- Android Studio Gradle 缓存目录设置
- 写给C语言新手的话
- 懒人小工具:自动生成Model,Insert,Select,Delete以及导出Excel的方法
- windows安装gcc编译器
- .net如何使用系统中没有安装的字体?
- Creating your own auto-configuration
- iOS 控制台po不出值
- 2018年底,IOS面试题的复习之OC的反射机制
- ArcGIS中KML转为shp文件
- int、bool和str
- Weblogic12c 单节点安装
- eclipse如何安裝JPA 和Data Source Explorer
热门文章
- 读取文件之<;绝对路径>;与<;相对路径>;
- 更改Scala的代码自己主动补全快捷键code completion
- 48、ViewFlow ---- 滑动广告页
- 深入C#学习系列一:序列化(Serialize)、反序列化(Deserialize)(转)
- openvas-tutorial-for-beginners
- TGraphicControl(自绘就2步,直接自绘自己,不需要调用VCL框架提供的函数重绘所有子控件,也不需要自己来提供PaintWindow函数让管理框架来调用)与TControl关键属性方法速记(Repaint要求父控件执行详细代码来重绘自己,还是直接要求Invalidate无效后Update刷新父控件,就看透明不透明这个属性,因为计算显示的区域有所不同)
- 编译java-cef
- JavaScript中的Date,RegExp,Function对象
- Android系统移植与调试之------->如何修改Android手机NFC模块,使黑屏时候能够使用NFC
- 我的Android进阶之旅------>Android项目运行报java.lang.NoClassDefFoundError错误的解决办法