oracle怎樣查詢用戶的表空間

oracle中,可以利用“default_tablespace”查詢用戶的表空間,語法為“select default_tablespace from dba_users where username=’用戶名’”,其中用戶名需使用大寫。

oracle怎樣查詢用戶的表空間

本教程操作環境:Windows10系統、Oracle 11g版、Dell G3電腦。

oracle怎樣查詢用戶的表空間

1)查詢當前用戶表空間

?select?default_tablespace?from?dba_users?where?username='TMS21';

oracle怎樣查詢用戶的表空間

2)查詢所有表空間

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

3)查詢用戶下所有表

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

4)查詢表空間下的用戶

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

推薦教程:《Oracle教程

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊12 分享