- Apr 09 Tue 2013 09:35
無法使用TSM,出現錯誤:Cannot open xterm.fi
- Apr 01 Mon 2013 13:18
undo有問題或毀損,無法Drop
在一次要縮小undo的空間時,用Oracle Enterprise Manager來offline Undo File,結果出現錯誤,因為有segments仍在使用中。
但是忘了做了什麼動作,以致它最後還是將undo file離線,並且在後續操作中出現了undo file需要做recovery的訊息。
ORA-01157: cannot identify/lock data file 13 - see DBWR trace file
ORA-01110: data file 13: '/testdb/oradata/undo01.dbf'
先找出有哪些segment還在使用。
SQL> select tablespace_name,segment_name,status from dba_rollback_segs where status='NEEDS RECOVERY';
TABLESPACE_NAME SEGMENT_NAME STATUS
------------------------------ ------------------------------ ----------------
APPS_UNDOTS1 _SYSSMU1$ NEEDS RECOVERY
APPS_UNDOTS1 _SYSSMU2$ NEEDS RECOVERY
APPS_UNDOTS1 _SYSSMU3$ NEEDS RECOVERY
APPS_UNDOTS1 _SYSSMU4$ NEEDS RECOVERY
將資料庫關閉,備份init.ora,編輯init.ora,修改兩個參數值如下:
undo_management='MANUAL'
rollback_segments='SYSTEM'
在init.ora加上一個隱藏的參數,值為SQL找到的SEGMENT_NAME,收回segment如下:
*._offline_rollback_segments='_SYSSMU1$','_SYSSMU2$','_SYSSMU3$','_SYSSMU4$'
用pfile來開啟資料庫:
SQL> startup pfile=/testdb/db/9.2.0/dbs/init.ora ;
資料庫成功開啟之後,就可以新增新的Undo Tablespace:
SQL> create undo tablespace APPS_UNDOTS2 datafile '/testdb/oradata/UNDOTBS01.DBF' size 10000m;
刪除舊的Undo Tablespace;
DROP TABLESPACE APPS_UNDOTS1 INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS ;
關閉資料庫,將備份的init.ora還原,並且修改init.ora
將undo_tablespace=APPS_UNDOTS1改為APPS_UNDOTS2
重新開啟資料庫,ok
但是忘了做了什麼動作,以致它最後還是將undo file離線,並且在後續操作中出現了undo file需要做recovery的訊息。
ORA-01157: cannot identify/lock data file 13 - see DBWR trace file
ORA-01110: data file 13: '/testdb/oradata/undo01.dbf'
先找出有哪些segment還在使用。
SQL> select tablespace_name,segment_name,status from dba_rollback_segs where status='NEEDS RECOVERY';
TABLESPACE_NAME SEGMENT_NAME STATUS
------------------------------ ------------------------------ ----------------
APPS_UNDOTS1 _SYSSMU1$ NEEDS RECOVERY
APPS_UNDOTS1 _SYSSMU2$ NEEDS RECOVERY
APPS_UNDOTS1 _SYSSMU3$ NEEDS RECOVERY
APPS_UNDOTS1 _SYSSMU4$ NEEDS RECOVERY
將資料庫關閉,備份init.ora,編輯init.ora,修改兩個參數值如下:
undo_management='MANUAL'
rollback_segments='SYSTEM'
在init.ora加上一個隱藏的參數,值為SQL找到的SEGMENT_NAME,收回segment如下:
*._offline_rollback_segments='_SYSSMU1$','_SYSSMU2$','_SYSSMU3$','_SYSSMU4$'
用pfile來開啟資料庫:
SQL> startup pfile=/testdb/db/9.2.0/dbs/init.ora ;
資料庫成功開啟之後,就可以新增新的Undo Tablespace:
SQL> create undo tablespace APPS_UNDOTS2 datafile '/testdb/oradata/UNDOTBS01.DBF' size 10000m;
刪除舊的Undo Tablespace;
DROP TABLESPACE APPS_UNDOTS1 INCLUDING CONTENTS AND DATAFILES CASCADE CONSTRAINTS ;
關閉資料庫,將備份的init.ora還原,並且修改init.ora
將undo_tablespace=APPS_UNDOTS1改為APPS_UNDOTS2
重新開啟資料庫,ok
- Mar 28 Thu 2013 15:08
設定/etc/passwd去使用bash shell,卻導致wuftp無法登入
- Mar 28 Thu 2013 13:20
縮小undo tablespace
- Mar 27 Wed 2013 14:07
HP-UX的at排程
因為3/31日停電且關機,以致3/31日的排程工作無法被執行,但是又不想去更改crontab的設定,
此時可以用at來排程單一任務
增加排程:先指定要執行的日期與時間,按下Enter後會進入編輯模式,編輯完成後按下Ctrl+D就會儲存並且離開。
- Mar 18 Mon 2013 11:28
ERP無法支援罕見字
- Mar 14 Thu 2013 15:52
找指定的表格被哪些Session鎖住
找指定的表格被哪些Session鎖住,type='TM'時,ID1等於OBJECT ID
select obj.object_name,vs.sid,vs.serial#,vp.spid,vs.action,vs.sql_address,vl.ctime,vl.block
from dba_objects obj,v$lock vl,v$session vs,v$process vp
where obj.object_id=vl.id1
- Feb 26 Tue 2013 08:59
縮小temp的空間
先建立一個新的temp file到tablespace
alter tablespace temp add tempfile '/erptest/clonedata/temp03.dbf' size 1000m;
將指定的temp file離線
alter database tempfile '/erptest/clonedata/temp02.dbf' offline;
刪除temp file
alter database tempfile '/erptest/clonedata/temp02.dbf' drop including datafiles;
或
alter database tempfile '/erptest/clonedata/temp02.dbf';
如果出現下列錯誤,表示仍有人在使用指定的temp file
ERROR at line 1:
ORA-25152: TEMPFILE cannot be dropped at this time
找出temp file的id
select file_id from dba_temp_files where file_name ='/erptest/clonedata/temp02.dbf';
FILE_ID
----------
2
但是這個file_id=2並不是temp file真正的id,必須要再加上參數db_files的值才是真正的file id。
SQL> show parameter db_files
NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
db_files integer 200
所以temp02.dbf真正的id是200+2=202
找出誰在使用
select c.spid,
b.tablespace,
b.segfile#,
b.segblk#,
round(((b.blocks * d.VALUE) / 1024 / 1024), 2) size_mb,
a.SID,
a.serial#,
a.username,
a.osuser,
a.program,
a.status
from v$session a, v$sort_usage b, v$process c, v$parameter d
where b.segfile# = &seg_temp_file_id
and d.name = 'db_block_size'
and a.saddr = b.session_addr
and a.paddr = c.addr
order by b.tablespace, b.segfile#, b.segblk#, b.blocks;
會提示輸入seg_temp_file_id的值,輸入202就可以找出session,再將這些session刪除就可以drop temp file了。
alter tablespace temp add tempfile '/erptest/clonedata/temp03.dbf' size 1000m;
將指定的temp file離線
alter database tempfile '/erptest/clonedata/temp02.dbf' offline;
刪除temp file
alter database tempfile '/erptest/clonedata/temp02.dbf' drop including datafiles;
或
alter database tempfile '/erptest/clonedata/temp02.dbf';
如果出現下列錯誤,表示仍有人在使用指定的temp file
ERROR at line 1:
ORA-25152: TEMPFILE cannot be dropped at this time
找出temp file的id
select file_id from dba_temp_files where file_name ='/erptest/clonedata/temp02.dbf';
FILE_ID
----------
2
但是這個file_id=2並不是temp file真正的id,必須要再加上參數db_files的值才是真正的file id。
SQL> show parameter db_files
NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
db_files integer 200
所以temp02.dbf真正的id是200+2=202
找出誰在使用
select c.spid,
b.tablespace,
b.segfile#,
b.segblk#,
round(((b.blocks * d.VALUE) / 1024 / 1024), 2) size_mb,
a.SID,
a.serial#,
a.username,
a.osuser,
a.program,
a.status
from v$session a, v$sort_usage b, v$process c, v$parameter d
where b.segfile# = &seg_temp_file_id
and d.name = 'db_block_size'
and a.saddr = b.session_addr
and a.paddr = c.addr
order by b.tablespace, b.segfile#, b.segblk#, b.blocks;
會提示輸入seg_temp_file_id的值,輸入202就可以找出session,再將這些session刪除就可以drop temp file了。
- Feb 08 Fri 2013 14:19
HP Data Protector--Device is already locked by someone else (and no sessions running)
因為磁帶機故障送修,回來後接上機器,但是在HP Data Protector卻沒有辦法使用原來的Drivers,
只好將它刪除,重建Drivers,但是在掃描磁帶時卻出現下列錯誤的訊息,以致無法操作:
Device is already locked by someone else (and no sessions running)
- Jan 11 Fri 2013 16:21
自動檢查HP-UP的空間是否不足
為了避免像上次archive log把空間佔滿,導致DB無法正常運行,所以寫了一支Script來檢查。
重點如下:
1、因為要判斷的字串是proddata/archive,所以加上跳脫字元「\」。
aa=`bdf | awk '/proddata\/archive/ {print $2/$1}'`