How to query the tablespace name of the current user? Because oracle builds an index, you need to know the tablespace of the current user, and look up the data
--Query syntax-- select default_tablespace from dba_users where username = ' login user '
For example, my login user is TMS21, then the query syntax is
/* View the tablespace the user belongs to */ select default_tablespace from dba_users where username = ' TMS21 ' ;
The usage of related queries is also recorded by the way
1) Query the current user tablespace
/* View the tablespace the user belongs to */ select default_tablespace from dba_users where username = ' TMS21 ' ;
2) Query all tablespaces
/* View all tablespaces */ -- 1) Mode 1: dba_tablespaces -- select * from dba_tablespaces; -- 2) Mode 2: v$tablespace -- select * from v$tablespace;
3) Query all tables under the user
/* View all the tables under the user */ -- 1) Mode 1: user_tables -- select * from user_tables; -- 2) Mode 2: dba_tables -- select * from dba_tables where owner = ' TMS21 ' ;
4) Query the users under the tablespace
/* Check how many users there are in the tablespace, the name of tablespace_name must be capitalized */ select distinct s.owner from dba_segments s where s.tablespace_name = ' TMS21 ' ;
Source: https://blog.csdn.net/qq_26941173/article/details/77155421