当前位置:网站首页>Oracle related statistics
Oracle related statistics
2022-07-02 08:46:00 【Qingshan blog】
--1. Check the size of each table space
SELECT TABLESPACE_NAME,
SUM( BYTES )/ 1024 / 1024
|| ' MB'
FROM DBA_SEGMENTS
GROUP BY TABLESPACE_NAME;
--2. The amount of physical space allocated by the query table
SELECT SEGMENT_NAME,
SUM( BYTES )/ 1024 / 1024 Allocate space MB
FROM USER_EXTENTS
GROUP BY SEGMENT_NAME
ORDER BY Allocate space MB DESC;
--3. Query the actual amount of space used
SELECT TABLE_NAME Table name ,
NUM_ROWS Data volume ,
AVG_ROW_LEN Average size of each ,
( NUM_ROWS * AVG_ROW_LEN / 1024 / 1024 ) Occupancy space MB
FROM USER_TABLES
ORDER BY Occupancy space MB DESC;
--4. View the remaining tablespace size
SELECT TABLESPACE_NAME Table space ,
SUM( BLOCKS * 8192 / 1000000 ) Remaining space M
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME;
--5. Check the overall space of all tablespaces in the system
SELECT B.NAME,
SUM( A.BYTES / 1000000 ) Total space
FROM V$DATAFILE A,
V$TABLESPACE B
WHERE A.TS# = B.TS#
GROUP BY B.NAME;
--6. Check table space utilization
SELECT A.A1 Tablespace name ,
C.C2 type ,
C.C3 District Management ,
B.B2 / 1024 / 1024 Table space size M,
( B.B2 - A.A2 )/ 1024 / 1024 Already used M,
SUBSTR(( B.B2 - A.A2 )/ B.B2 * 100,1,5)|| '%' utilization
FROM
(select tablespace_name a1, sum(nvl(bytes,0)) a2 from dba_free_space group by tablespace_name) a,
(select tablespace_name b1,sum(bytes) b2 from dba_data_files group by tablespace_name) b,
(select tablespace_name c1,contents c2,extent_management c3 from dba_tablespaces) c
WHERE A.A1 = B.B1
AND C.C1 = B.B1;
--7. Data file size and usage
SELECT B.FILE_NAME Physical file name ,
B.TABLESPACE_NAME Table space ,
B.BYTES / 1024 / 1024 size M,
( B.BYTES - SUM( NVL(A.BYTES,0)))/ 1024 / 1024 Already used M,
SUBSTR(( B.BYTES - SUM( NVL(A.BYTES,0)))/( B.BYTES )* 100,1,5)|| '%' utilization
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group BY B.TABLESPACE_NAME,B.FILE_NAME,B.BYTES
ORDER BY B.TABLESPACE_NAME;
--8. Inquire about oracle Table space usage
select b.file_id file ID,
b.tablespace_name Table space ,
b.file_name Physical file name ,
b.bytes Total bytes ,
(b.bytes-sum(nvl(a.bytes,0))) Already used ,
sum(nvl(a.bytes,0)) The remaining ,
sum(nvl(a.bytes,0))/(b.bytes)*100 The remaining percentage
from dba_free_space a,dba_data_files b
where a.file_id=b.file_id
group by b.tablespace_name,b.file_name,b.file_id,b.bytes
order by b.tablespace_name
--9. see SYS_LOB* Which table does the file belong to
SELECT B.TABLE_NAME,
B.COLUMN_NAME,
A.SEGMENT_NAME,
a.SEGMENT_TYPE,
ROUND(SUM(A.BYTES / 1024 / 1024 / 1024), 2) G
FROM DBA_SEGMENTS A
LEFT JOIN DBA_LOBS B ON A.OWNER = B.OWNER AND A.SEGMENT_NAME = B.SEGMENT_NAME
WHERE B.SEGMENT_NAME = 'SYS_LOB0021914268C00014$$'
GROUP BY B.TABLE_NAME, B.COLUMN_NAME, A.SEGMENT_NAME,a.SEGMENT_TYPE;
边栏推荐
- Realize bidirectional linked list (with puppet node)
- OpenFeign 简单使用
- Detailed explanation of NIN network
- Sqli labs level 8 (Boolean blind note)
- ICMP协议
- [untitled]
- Application of kotlin - higher order function
- Pclpy projection filter -- projection of point cloud to cylinder
- 什么是SQL注入
- Synchronize files using unison
猜你喜欢

Driving test Baodian and its spokesperson Huang Bo appeared together to call for safe and civilized travel

Nacos download, start and configure MySQL database

Minecraft插件服开服

Web技术发展史

File upload and download performance test based on the locust framework

Minecraft模组服开服

Programmer training, crazy job hunting, overtime ridiculed by colleagues deserve it
![[blackmail virus data recovery] suffix Rook3 blackmail virus](/img/46/debc848d17767d021f3f41924cccfe.jpg)
[blackmail virus data recovery] suffix Rook3 blackmail virus

链表经典面试题(反转链表,中间节点,倒数第k个节点,合并分割链表,删除重复节点)

TCP/IP—传输层
随机推荐
Googlenet network explanation and model building
Function ‘ngram‘ is not defined
Getting started with k8s: building MySQL with Helm
Tensorflow2 keras 分类模型
C language custom type enumeration, Union (clever use of enumeration, calculation of union size)
sqli-labs第1关
sqli-labs第12关
类和对象(类和类的实例化,this,static关键字,封装)
Minecraft插件服开服
Flex layout
HCIA—应用层
c语言将字符串中的空格替换成%20
OpenShift构建镜像
sqli-labs第2关
gocv边界填充
gocv opencv exit status 3221225785
Driving test Baodian and its spokesperson Huang Bo appeared together to call for safe and civilized travel
方法递归(斐波那契数列,青蛙跳台阶,汉诺塔问题)
C# 百度地图,高德地图,Google地图(GPS) 经纬度转换
Linux二进制安装Oracle Database 19c