oracle表空间操作

--表空间文件

select * from dba_data_files;

 

--表空间占用情况

SELECT a.tablespace_name ,
a.bytes / 1024 / 1024 "表空间大小(M)",
( a.bytes - b.bytes ) / 1024 / 1024 "已使用空间(M)",
b.bytes / 1024 / 1024 "空闲空间(M)",
Round(( ( a.bytes - b.bytes ) / a.bytes ) * 100, 2) "使用比率"
FROM (SELECT tablespace_name,
SUM(bytes) bytes
FROM dba_data_files
GROUP BY tablespace_name) a,
(SELECT tablespace_name,
SUM(bytes) bytes,
Max(bytes) largest
FROM dba_free_space
GROUP BY tablespace_name) b
WHERE a.tablespace_name = b.tablespace_name
ORDER BY ( ( a.bytes - b.bytes ) / a.bytes ) DESC;

 


--修改原空间

ALTER DATABASE DATAFILE '/oradata/orcl/users01.dbf'

RESIZE 30000M;

 

--增加新空间

alter tablespace USERS add datafile '/oradata/orcl/users02.dbf' size 30000M;

你可能感兴趣的:(oracle)