--Oracle查看表空间大小(单位不是GB)
SELECT
a.tablespace_name, --表空间名
total, --表空间大小
free, --表空间剩余大小
(total-free), --表空间使用大小
Round((total-free)/total,4)*100 --使用率
FROM (SELECT tablespace_name,Sum(bytes) free
FROM DBA_FREE_SPACE
GROUP BY tablespace_name) a,
(SELECT tablespace_name,Sum(bytes) total
FROM DBA_DATA_FILES
GROUP BY tablespace_name)b
WHERE
a.tablespace_name=b.tablespace_name;
--Oracle查看表空间当前用户
select username,default_tablespace
from user_users;
--Oracle查看表所属表空间
SELECT TABLE_NAME,TABLESPACE_NAME
FROM USER_TABLES
WHERE TABLE_NAME='test_table';
--Oracle查看表空间大小-单位GB
SELECT
a.tablespace_name,
total,
free,
(total-free),
total/(1024*1024*1024),
free/(1024*1024*1024),
(total-free)/(1024*1024*1024),
round((total-free)/total,4)*100
FROM (SELECT tablespace_name,SUM(bytes) free
FROM dba_free_space
GROUP BY tablespace_name)a,
(SELECT tablespace_name,SUM(bytes) total
FROM dba_data_files
GROUP BY tablespace_name)b
WHERE a.tablespace_name=b.tablespace_name;
--查看数据库表空间名称
select file_name, tablespace_name ,bytes from dba_data_files;
点击这里 | 点击这里 | 点击这里 | 点击这里 |
---|---|---|---|
FILE_NAME | TABLESPACE_NAME | BYTES | |
1 | /oracledata/orcl/users01.dbf | USERS | 82575360 |
2 | /oracledata/orcl/sysaux01.dbf | SYSAUX | 429916160 |
3 | /oracledata/orcl/undot2.dbf | UNDOTV2 | 1761607680 |
4 | /oracledata/orcl/system01.dbf | SYSTEM | 597688320 |
5 | /oracledata/orcl/emsc01.dbf | EMSC | 629145600 |
6 | /oracledata/orcl/seal01.dbf | SEAL | 524288000 |
9 | /oracledata/orcl/E:ORACLEORADATAORCLhnsap.dbf | HNSAPSPACE1 | 1153433600 |
--查看数据库所有的表名称和每张表所对应的数据条数
select t.table_name ,t.num_rows from user_tables t;
点击这里 | 点击这里 | 点击这里 |
---|---|---|
TABLE_NAME | NUM_ROWS | |
1 | CLIENT_SOFT_UPDATE_RECORD | 278 |
2 | MDENCE_STAMP | 0 |
3 | TD_P_ROLE | 0 |
4 | TD_X_STAFF | 5 |
5 | PORC_EXECUTE_RECORD | 2185 |
6 | CLIENT_GROUP_BINDING | 79 |
7 | CLIENT_SOFT_UPDATE | 19 |
8 | AUDIT_DAY_AMOUNT | 22 |
9 | AUDIT_DAY_BWS_DETAIL | 97 |
10 | AUDIT_HELLY_DAY | 0 |
11 | AUDIT_HELLY_DETAIL | 0 |
12 | AUDIT_RULE | 3496 |
13 | AUDIT_RULE_ORG | 874 |
14 | ID_CARD_INFO | 417 |
15 | BILL_USER_CHECK_INFO | 4268 |
17 | BUSINESS_DICT | 0 |
18 | BUSINESS_INFO | 946 |