*********************************查詢表空間大小(單位g)******************************************
select t.tablespace_name, round(sum(bytes / (1024 * 1024 * 1024)), 0) ts_size
from dba_tablespaces t, dba_data_files d
where t.tablespace_name = d.tablespace_name
group by t.tablespace_name,t.max_size;
*********************************查詢各表空間使用情況******************************************
select a.tablespace_name "表空間名",
total "表空間大小",
free "表空間剩餘大小",
(total - free) "表空間使用大小",
total / (1024 * 1024 * 1024) "表空間大小(g)",
free / (1024 * 1024 * 1024) "表空間剩餘大小(g)",
(total - free) / (1024 * 1024 * 1024) "表空間使用大小(g)",
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 ;
*********************************增加表空間******************************************
*********************************1、查詢表空間dbf路徑********************************
select * from v$datafile;
*********************************2、增加表空間大小***********************************
************************兩種方法,一種是為表空間增加資料檔案:***********************
**********************另一種方法是增加表空間原有資料檔案尺寸:***********************
sqlplus system/123456
create temporary tablespace temp1 tempfile 'd:\oracle\oradata\orcl\temp02.dbf' size 512m reuse autoextend on next 1m
maxsize unlimited;
alter database default temporary tablespace temp1;
drop tablespace temp including contents and datafiles;
alter database default temporary tablespace temp;
drop tablespace temp1 including contents and datafiles;
exit
清空Oracle臨時表空間
tags oracle 今天發現一oracle的sql語句執行超過了2分鐘,因為本人從事的專案資料量都不大,還沒遇到過2分鐘以上不出結果的時候。因此十分疑惑。執行了一段時間之後,發覺oracle無法連線出現異常。此時登入oracle安裝伺服器,sqlplus無法連線。檢視硬碟空間,發現硬碟已滿。經過...
清空oracle臨時表空間
清空臨時表空間 0.shutdown immediate 1.startup 啟動資料庫 2.create temporary tablespace temp2 tempfile home2 oracle oradata sysmon temp02.dbf size 512m reuse autoe...
Oracle表空間擴充套件
1.檢視所有表空間使用情況 select b.file id 檔案id號,b.tablespace name 表空間名,b.bytes 1024 1024 m 位元組數,b.bytes sum nvl a.bytes,0 1024 1024 m 已使用,sum nvl a.bytes,0 1024 ...