查询空闲
select tablespace_name, sum(bytes) / 1024 / 1024 from dba_free_space group by tablespace_name;
查询总大小
select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;
查询表空间路径:
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;
增加新的表空间文件:郑州公司
alter tablespace extzz add datafile '/opt/app/oracle/oradata/data/extzz4.dbf' size 1024M
查看用户和表空间的关系
select username,default_tablespace from dba_users;
undo
SELECT a.tablespace_name as tablespace_name,
to_char(b.total/1024/1024,999999.99) as Total,
to_char((b.total-a.free)/1024/1024,999999.99) as Used,
to_char(a.free/1024/1024,999999.99) as Free,
to_char(round((total-free)/total,4)*100,999.99) as Used_Rate
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
AND a.tablespace_name='UNDOTBS1'
ORDER BY a.tablespace_name;
alter tablespace UNDOTBS1 add datafile '/opt/app/oracle/oradata/dba/undotbs02.dbf' size 1024M
/opt/app/oracle/oradata/dba/undotbs01.dbf
select tablespace_name, sum(bytes) / 1024 / 1024 from dba_free_space group by tablespace_name;
查询总大小
select tablespace_name,sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;
查询表空间路径:
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;
增加新的表空间文件:郑州公司
alter tablespace extzz add datafile '/opt/app/oracle/oradata/data/extzz4.dbf' size 1024M
查看用户和表空间的关系
select username,default_tablespace from dba_users;
undo
SELECT a.tablespace_name as tablespace_name,
to_char(b.total/1024/1024,999999.99) as Total,
to_char((b.total-a.free)/1024/1024,999999.99) as Used,
to_char(a.free/1024/1024,999999.99) as Free,
to_char(round((total-free)/total,4)*100,999.99) as Used_Rate
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
AND a.tablespace_name='UNDOTBS1'
ORDER BY a.tablespace_name;
alter tablespace UNDOTBS1 add datafile '/opt/app/oracle/oradata/dba/undotbs02.dbf' size 1024M
/opt/app/oracle/oradata/dba/undotbs01.dbf