ORACLE如何查看用户,表空间,数据文件对应关系?

查询表空间对应的数据文件
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;

用户和表空间对应关系
select username,default_tablespace from dba_users;

表和表空间的对应关系
select table_name,tablespace_name from user_tables;

scott@ORCL>select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;

TABLESPACE_NAME                   FILE_ID BYTES/1024/1024 FILE_NAME
------------------------------ ---------- --------------- ----------------------------------------
SYSTEM                                  1             690 /opt/oracle/oradata/orcl/system01.dbf
SYSAUX                                  2             540 /opt/oracle/oradata/orcl/sysaux01.dbf
UNDOTBS1                                3             100 /opt/oracle/oradata/orcl/undotbs01.dbf
USERS                                   4           36.25 /opt/oracle/oradata/orcl/users01.dbf
EXAMPLE                                 5             100 /opt/oracle/oradata/orcl/example01.dbf


scott@ORCL>select username,default_tablespace from dba_users;

USERNAME                       DEFAULT_TABLESPACE
------------------------------ ------------------------------
TEST2                          USERS
SCOTT                          USERS
TEST3                          USERS
TEST1                          USERS
ORACLE_OCM                     USERS
XS$NULL                        USERS
BI                             USERS
PM                             USERS
MDDATA                         USERS
IX                             USERS
SH                             USERS
DIP                            USERS
OE                             USERS
APEX_PUBLIC_USER               USERS
HR                             USERS
SPATIAL_CSW_ADMIN_USR          USERS
SPATIAL_WFS_ADMIN_USR          USERS
DBSNMP                         SYSAUX
SYSMAN                         SYSAUX
FLOWS_FILES                    SYSAUX
MDSYS                          SYSAUX
ORDSYS                         SYSAUX
EXFSYS                         SYSAUX
WMSYS                          SYSAUX
APPQOSSYS                      SYSAUX
APEX_030200                    SYSAUX
OWBSYS_AUDIT                   SYSAUX
ORDDATA                        SYSAUX
CTXSYS                         SYSAUX
ANONYMOUS                      SYSAUX
XDB                            SYSAUX
ORDPLUGINS                     SYSAUX
OWBSYS                         SYSAUX
SI_INFORMTN_SCHEMA             SYSAUX
OLAPSYS                        SYSAUX
MGMT_VIEW                      SYSTEM
SYS                            SYSTEM
SYSTEM                         SYSTEM
OUTLN                          SYSTEM

39 rows selected.


scott@ORCL>select table_name,tablespace_name from user_tables;

TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------
DEPT                           USERS
EMP                            USERS
BONUS                          USERS
SALGRADE                       USERS
GLOBAL                         USERS
TTT                            USERS
T                              USERS
T1                             USERS
T2                             USERS
STUDENT                        USERS
FACULTY                        USERS
SHIPMENT                       USERS
TT                             USERS

13 rows selected.

scott@ORCL>

你可能感兴趣的:(oracle,#,oracle_note)