当前位置:首页>开发>正文

oracle中新建的用户怎么查询它所有的表空间 oracle怎么查看用户属于哪个表空间

2023-05-25 00:07:21 互联网 未知 开发

 oracle中新建的用户怎么查询它所有的表空间 oracle怎么查看用户属于哪个表空间

oracle中新建的用户怎么查询它所有的表空间

最直观的方法就是直接在pl/sql里查看 命令行如下
查看所有用户:select * from all_users
查看表空间:select tablespace_name from dba_tablespaces
查看用户具有怎样的角色:select * from dba_role_privs where grantee=用户名;
查看某个角色包括哪些系统权限:select * from dba_sys_privs where grantee=DBA
查看oracle中所有的角色:select * from dba_roles

oracle怎么查看用户属于哪个表空间

1、数据字典中用户表:dba_users;通过数据字典查看有多少个用户:select username from dba_users。

2、数据字典中表空间表: dba_tablespaces;查看有几个表空间:select tablespace_name from dba_tablespaces。

3、oracle 查看用户所在的表空间:select username,default_tablespace from dba_users order by username;如图所示;


4、完成效果图。

oracle怎么查看用户所属于的表空间

select username,default_tablespace from dba_users  where username=用户名 ---用户名需要大写
如查询scott用户的所属表空间:

oracle数据中怎么查看表空间的名称及大小?

可用如下语句:
select b.file_name 物理文件名,b.tablespace_name 表空间,b.bytes / 1024 / 1024 大小M,(b.bytes - sum(nvl(a.bytes, 0))) / 1024 / 1024 已使用M,
substr((b.bytes - sum(nvl(a.bytes, 0))) / (b.bytes) * 100, 1, 5) 利用率   
from dba_free_space a,dba_data_files b   
where a.file_id = b.file_id
group by b.tablespace_name,b.file_name, b.bytes   
order by b.tablespace_name查询结果:


解读:

该语句通过查询dba_free_space,dba_data_files,dba_tablespaces这三个数据字典表,得到了表空间名称,表空间类型,区管理类型,以”兆”为单位的表空间大小,已使用的表空间大小及表空间利用率。dba_free_space表描述了表空间的空闲大小,dba_data_files表描述了数据库中的数据文件,dba_tablespaces表描述了数据库中的表空间。
上面语句中from子句后有三个select语句,每个select语句相当于一个视图,视图的名称分别为a、b、c,通过它们之间的关联关系,我们得到了表空间的相关信息。

Oracle 查询用户名属于哪个表空间

需要有dba的权限
1、查看用户使用的缺省表空间名称 你一定知道你登陆的用户名是吧, 以sysdba登陆。?捌湟咽褂么笮 select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB", round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used" from (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name order by ((a.bytes-b.bytes)/a.bytes) desc

Oracle如何查询登录用户使用的表空间的名称、该表空间的总大小及其已使用的大小

1、查看用户使用的缺省表空间名称
你一定知道你登陆的用户名是吧,
以sysdba登陆。
sqlplus / as sysdba
select username,default_tablespace from dba_users
2、查看表空间总大小,及其已使用大小
select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB",
round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used"
from
(select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a,
(select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b
where a.tablespace_name=b.tablespace_name
order by ((a.bytes-b.bytes)/a.bytes) desc

oracle如何查询我自己创建的用户名和表空间 以及 怎么删除它们

select * from dba_users
select * from dba_tablespaces
删除时你得以管理员身份登陆:system/sys
conn system/密码@数据库名
conn system/密码@数据库名 as sysdba
drop user 用户名 cascade
drop tablespace 表空间名

oracle 查看有哪些表空间

select * from dba_tables where tablespace_name=
表空间名,注意表空间名大小写敏感。
select table_name,tablespace_name from user_tables

怎么查看 oracle中某个表空间里的表名

直接用超级管理员权限(zhidaosysdba)查看每个表空间中表名。
sql:Select Table_Name, Tablespace_Name From Dba_Tables Where Tablespace_Name = 表空间名字
解释:回通过管理员权限登陆后,查看“Dba_Tables ”表中的字段信息即可完成查询表名操作。备注:表空间名字必须答大写。

最新文章

随便看看