oracle中关于表空间,用户,表相关的查询语句
2017-08-17 14:32
579 查看
/* 查询表空间的名字和大小 */
select tablespace_name "表空间的名字", sum(bytes)/1024/1024 "表空间大小" from dba_data_files group by tablespace_name ;
/*查看表空间下有哪些用户 */
select distinct a.owner from dba_segments a where a.tablespace_name='TS_MHS5';
/*查看当前登录的用户名*/
select user from dual;
select * from user_users;
/*查看当前用户名拥有的角色和权限*/
select * from user_role_privs;
select * from session_privs;
/*查看用户下有多少表*/
select * from user_tables where table_name like '%patient%';
select count(*) from user_tables; /*user_tables是当前用户的所有表,用这个可以缩小查找的范围*/
select * from dba_tables where owner='MHS5'; /*dba_tables是管理员可以看到的数据库中所有的表*/
select count(*) from all_tables where owner='MHS5'; /*all_tables显示用户有权限看到的所有的表,包括系统表*/
select distinct table_name from user_tables;
/*查看用户某一张表的结构 */
desc mhs5.patient_info; /*要在命令模式下使用 */
select * from all_tab_columns;
select * from user_col_comments; --查询当前用户的表的列名和注释
/*查看用户的某一张的大小 ,在pl/sql 中不好用,不知道为什么*/
select sum(bytes)/1024/1024 "表大小(M)" from user_segments where segment_name='mhs5.patient_info_mid';
select tablespace_name "表空间的名字", sum(bytes)/1024/1024 "表空间大小" from dba_data_files group by tablespace_name ;
/*查看表空间下有哪些用户 */
select distinct a.owner from dba_segments a where a.tablespace_name='TS_MHS5';
/*查看当前登录的用户名*/
select user from dual;
select * from user_users;
/*查看当前用户名拥有的角色和权限*/
select * from user_role_privs;
select * from session_privs;
/*查看用户下有多少表*/
select * from user_tables where table_name like '%patient%';
select count(*) from user_tables; /*user_tables是当前用户的所有表,用这个可以缩小查找的范围*/
select * from dba_tables where owner='MHS5'; /*dba_tables是管理员可以看到的数据库中所有的表*/
select count(*) from all_tables where owner='MHS5'; /*all_tables显示用户有权限看到的所有的表,包括系统表*/
select distinct table_name from user_tables;
/*查看用户某一张表的结构 */
desc mhs5.patient_info; /*要在命令模式下使用 */
select * from all_tab_columns;
select * from user_col_comments; --查询当前用户的表的列名和注释
/*查看用户的某一张的大小 ,在pl/sql 中不好用,不知道为什么*/
select sum(bytes)/1024/1024 "表大小(M)" from user_segments where segment_name='mhs5.patient_info_mid';
相关文章推荐
- 获取oracle中某一用户某一表空间下的表、列注释说明的SQL查询语句
- oracle基本查询语句(一)用户相关语句
- oracle关于查询空间使用情况的几个sql语句
- 查询ORACLE用户表空间使用情况的SQL语句
- oracle 创建表空间 创建用户指定表空间 查询表空建大小 扩展表空间等sql语句
- oracle 创建表空间、用户、授权的详细操作sql语句(windows)
- Oracle - 用户相关常用操作语句
- oracle查询用户所在的表空间
- oracle:查询用户权限常用语句
- Oracle sql语句创建表空间、数据库、用户及授权
- 【ORACLE】常用物化视图相关元数据查询语句
- Oracle新建用户、角色,授权,建表空间的sql语句
- Oracle之scott用户表、相关SQL语句
- Oracle 新建用户、表空间、权限配置实用语句
- Oracle创建表空间,用户,授权,导入.sql/.dem文件语句
- ORACLE--查询当前连接的用户信息及操作的SQL语句
- Oracle创建表空间、用户、分配权限语句
- Oracle用户信息查询操作语句
- (转)全面讲解Oracle查询用户表空间
- oracle查询用户所有表的语句