Oracle 用户数据字典 以及 查询表字段

news/2024/7/7 4:51:23
http://www.blogjava.net/xiaohewoai/archive/2010/02/01/311532.html
查看当前用户的缺省表空间
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');
--------------------------------------------------oracle 查询 表字段 以及字段 数据类型 -----------------------------------------

第一种

select cname from col where tname='EMP';

第二种

select column_name from user_tab_columns where table_name='EMP';

 

 

介绍  如果查询数据的  字段数据类型

select data_type from user_tab_columns where table_name='EMP';

 两个一起查
select data_type,column_name from user_tab_columns where table_name='EMP';


--------------------------------------------查询 字段注释---------------------------------------------

select * from user_col_comments ;//所有的注释
select * from user_col_comments where table_name='你的表(emp)' ;//指定表的注释

http://www.niftyadmin.cn/n/1733044.html

相关文章

git上传修改过的代码和创建标签

2021/09/18-2021/12/27 在《将本地已有项目添加到gitee仓库中》 https://zhuanlan.zhihu.com/p/411306340 https://blog.csdn.net/chentuo2000/article/details/120345622 一文中我们已经发布(push)了几个项目到gitee仓库。 在《修改git commit的注释》 https://zhuanlan.…

extremetable+hibernate实现分页 关于结合hibernate后台数据分页和eXtremeTable分页功能的使用 ...

http://blog.csdn.net/tigerflower/archive/2006/08/22/1105036.aspxeXtremeComponents是一系列提供高级显 示的开源JSP定制标签。当前的包含 的组件为eXtremeTable,用于以表的形式显示数据。eXtremeTable提 供了一个很好的分页特性,但是如何结合hiberna…

text-align: justify;不能均匀分布问题

本文地址&#xff1a;http://www.cnblogs.com/veinyin/p/7617610.html 对于text-align来说&#xff0c;一般我们都是使用居中这个属性值&#xff0c;突然今天需要达到这样一个效果&#xff1a; 对&#xff0c;就是“上海活动”这四个字在所在的区域均匀分布 1 <li class&qu…

在树莓派计算模块CM4 eMMC上安装Ubuntu Desktop 21.04

陈拓 2021/09/29-2021/11/27 在不需要桌面的情况下可以安装Server版&#xff0c;节省空间&#xff0c;速度快。 在树莓派计算模块CM4 eMMC上安装Ubuntu Server 21.04_晨之清风-CSDN博客陈拓 2021/10/05-2021/10/051. 概述在《在树莓派计算模块CM4 eMMC上安装Ubuntu Desktop 21…

eXtremeComponents文档

http://www.blogjava.net/lucky/archive/2010/01/19/33380.html 前言 1. 配置 1.1. 先决条件 1.2. 安装 1.3. 导出过滤器(可选) 1.4. 安装测试2. 概述 2.1. 引言3. TableTag 3.1. 引言 3.2. 显示图片 3.3. 过滤、排序和动作&#xff08;Action&#xff09; 3.4. 设定每页显示行…

css动画-小球撞壁反弹

小球碰到一面壁之后一般都会反弹&#xff0c;反射角入射角&#xff1b; 其实用css3来实现这个效果也非常简单。 首先&#xff0c;分解一下小球的运动&#xff1a;水平运动和垂直运动。 当小球往右下方向运动时&#xff0c;如果碰到了下面的壁&#xff0c;那么由于碰撞&#x…

在树莓派计算模块CM4 eMMC上安装Ubuntu Server 21.04

陈拓 2021/10/05-2021/10/05 1. 概述 在《在树莓派计算模块CM4 eMMC上安装Ubuntu Desktop 21.04》 https://zhuanlan.zhihu.com/p/415866590 https://blog.csdn.net/chentuo2000/article/details/120572834 一文中&#xff0c;我们在CM4上安装了Ubuntu Desktop 21.04&#…

树莓派+Ubuntu安装VCpkg

陈拓 2021/10/11-2021/10/23 1. 概述 vcpkg是Microsoft的跨平台开源软件包管理器&#xff0c;极大地简化了 Windows、Linux 和 macOS 上第三方库的配置与安装。 vcpkg可以单独使用&#xff0c;也可以在vscode中使用。 2. 我的软、硬件系统环境 硬件 见《在树莓派计算模块CM…