Home  >  Article  >  Database  >  How to query user's table space in oracle

How to query user's table space in oracle

WBOY
WBOYOriginal
2022-01-06 15:20:0423333browse

In Oracle, you can use "default_tablespace" to query the user's table space. The syntax is "select default_tablespace from dba_users where username='username'", where the user name must be in uppercase letters.

How to query user's table space in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How oracle queries the user’s table space

1) Query the current user table space

 select default_tablespace from dba_users where username='TMS21';

How to query users table space in oracle

2) Query all table spaces

   -- 1 )方式1:dba_tablespaces --
   select * from dba_tablespaces;
    --2 )方式2:v$tablespace --
   select * from v$tablespace;

3) Query all tables under a user

  /* 查看用户下面的所有的表 */ 
  -- 1 )方式1:user_tables --
   select * from user_tables;
   --2 )方式2: dba_tables --
   select * from dba_tables where owner='TMS21';

4) Query users under a table space

  /*查看表空间下有多少用户,tablespace_name表空间 的名字一定要大写 */
   select distinct s.owner from dba_segments s where s.tablespace_name ='TMS21';

Recommended tutorial: " Oracle Tutorial

The above is the detailed content of How to query user's table space in oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn