確認(rèn)UNDO表空間名稱
成都創(chuàng)新互聯(lián)主要從事網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)札達(dá),十載網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):18982081108
select name from v$tablespace;
檢查數(shù)據(jù)庫(kù)UNDO表空間占用空間情況以及數(shù)據(jù)文件存放位置;
select file_name,bytes/1024/1024 from dba_data_files where tablespace_name like 'UNDOTBS1';
UNDO表空間不夠用,有兩種處理方法,1,擴(kuò)大表空間大??;2,創(chuàng)建新的UNDO表空間,刪除原來(lái)的
一、擴(kuò)大UNDO表空間
alter database UNDOTBS1 datafile '/opt/oracle/oradata/inms/undotbs02.dbf' resize 4000M;
二、創(chuàng)建新的UNDO表空間,刪除原來(lái)的
1、創(chuàng)建新的UNDO表空間,并設(shè)置自動(dòng)擴(kuò)展參數(shù);
create undo tablespace undotbs2 datafile '/oradata/oradata/ddptest/UNDOTBS1.dbf' size 2 1000m reuse autoextend on next 800m maxsize unlimited;
2、動(dòng)態(tài)更改spfile配置文件;
alter system set undo_tablespace=undotbs2 scope=both;
3、刪除原有的UNDO表空間;
drop tablespace undotbs1 including contents;
4、確認(rèn)刪除是否成功;
select name from v$tablespace;
5、確定$ORACLE_HOME/dbs/spfileoinms.ora內(nèi)容是否發(fā)生變更:
$more spfileoinms.ora
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS2'
如果沒(méi)有發(fā)生變更請(qǐng)執(zhí)行如下語(yǔ)句:
SQL> create pfile from spfile;
File created.
6、刪除原UNDO表空間的數(shù)據(jù)文件,其文件名為步驟中執(zhí)行的結(jié)果。
#rm $ORACLE_BASE/oradata/$ORACLE_SID/undotbs01.dbf
如何處理Oracle的UNDO表空間所對(duì)應(yīng)的數(shù)據(jù)文件過(guò)大
[日期:2011-04-18] | 來(lái)源:Linux社區(qū) 作者:Linux |
google_protectAndRun("render_ads.js::google_render_ad", google_handleError, google_render_ad); 1查看undo的表空間大小和最大值
select t.file_name,t.tablespace_name,
t.bytes/1024/1024/1024 "GB", t.maxbytes/1024/1024/1024 "Max GB"
from dba_data_files t where t.tablespace_name='UNDOTBS1'
|
數(shù)據(jù)文件為:/oracle/oradata/undo/undotbs01.dbf
2創(chuàng)建一個(gè)新的undo表空間,用來(lái)替換原來(lái)的undo表空間
create undo tablespace UNDOTBS2
datafile '/oracle/oradata/log/undotbs02.dbf'
size 10M autoextend on maxsize unlimited;
3把新的undo表空間設(shè)置成數(shù)據(jù)庫(kù)的undo表空間
alter system set undo_tablespace=UNDOTBS2 scope=both;
4再次驗(yàn)證數(shù)據(jù)庫(kù)的undo表空間
show parameter undo_tablespace
5等待原UNDO表空間UNDOTBS1 is OFFLINE;
SELECT r.status "Status",
r.segment_name "Name",
r.tablespace_name "Tablespace",
s.extents "Extents",
TO_CHAR((s.bytes/1024/1024),'99999990.000') "Size"
FROM sys.dba_rollback_segs r, sys.dba_segments s
WHERE r.segment_name = s.segment_name
AND s.segment_type IN ('ROLLBACK', 'TYPE2 UNDO')
and r.tablespace_name='UNDOTBS1' and status='ONLINE'
如果上面有狀態(tài)online的對(duì)象,可以查詢具體對(duì)象的sid,serial#
5.1查看當(dāng)前是什么在使用這個(gè)回滾段
SELECT r.NAME,s.sid,s.serial# Serial,
s.username ,s.machine ,
t.start_time,t.status ,
t.used_ublk ,
substr(s.program, 1, 15) "operate"
FROM v$session s, v$transaction t, v$rollname r,v$rollstat g
WHERE t.addr = s.taddr
AND t.xidusn = r.usn
AND r.usn = g.usn
ORDER BY t.used_ublk desc;
--比如:對(duì)象為:sid 474,serial 6794
5.2根據(jù)sid查出具體的sql
select sql_text from v$session a,v$sqltext_with_newlines b
where DECODE(a.sql_hash_value, 0, prev_hash_value, sql_hash_value)=b.hash_value
and a.sid=&sid order by piece
如果該sql不重要,可以直接kill該會(huì)話。
5.3 kill session
alter system kill session '474,6794';
5.4 刪除原undo表空間及其系統(tǒng)的數(shù)據(jù)問(wèn)題
drop tablespace UNDOTBS1 including contents and datafiles;
(在AIX系統(tǒng)中,雖然已經(jīng)刪除了系統(tǒng)所對(duì)應(yīng)的undo表空間的數(shù)據(jù)文件,但用df -g查看,該系統(tǒng)空間不能釋放。
主要是由于Oracle的一個(gè)進(jìn)程在訪問(wèn)該文件。可以kill Oracle訪問(wèn)進(jìn)程,或者重啟數(shù)據(jù)庫(kù)后,即可釋放系統(tǒng)的空間。)
6新建立UNDOTBS1表空間
create undo tablespace UNDOTBS1
datafile '/oracle/oradata/undo/undotbs01.dbf'
size 10M autoextend on maxsize 12G;
7切換回UNTOTBS1
alter system set undo_tablespace=UNDOTBS1 scope=both;
8等待UNDO表空間UNDOTBS2 is OFFLINE;
SELECT r.status "Status",
r.segment_name "Name",
r.tablespace_name "Tablespace",
s.extents "Extents",
TO_CHAR((s.bytes/1024/1024),'99999990.000') "Size"
FROM sys.dba_rollback_segs r, sys.dba_segments s
WHERE r.segment_name = s.segment_name
AND s.segment_type IN ('ROLLBACK', 'TYPE2 UNDO')
and r.tablespace_name='UNDOTBS2'
ORDER BY 5 DESC;
9刪除
drop tablespace UNDOTBS2 including contents and datafiles;
FROM:http://blog.chinaunix.net/uid-57485-id-3171219.html