Oracle UNDO資料表空間日常維護查看操作__Oracle

來源:互聯網
上載者:User
 

undo資料表空間中常用的操作:

(1)查看undo資料表空間undotbs1的屬性:
SQL> select b.tablespace_name,AUTOEXTENSIBLE,RETENTION  from dba_tablespaces a,dba_data_files b
         where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='UNDOTBS1';

TABLESPACE_NAME  AUT  RETENTION
----------------------     ---   ----------------
UNDOTBS1               NO  NOGUARANTEE

(2)查看各個回退段的使用資訊:
select a.name,b.extents,b.rssize,b.writes,b.xacts,b.wraps
from v$rollname a,v$rollstat b where a.usn=b.usn;

(3)確定哪些使用者正在使用undo段:
SQL> select a.username,b.name,c.used_ublk from v$session a,v$rollname b,v$transaction c
         where a.saddr=c.ses_addr and b.usn=c.xidusn; 

USERNAME  NAME                USED_UBLK
----------      -----------------------          ----------
NDMC       _SYSSMU1_1255220753$       1
NDMC       _SYSSMU5_1255220754$       1

(4)每秒產生的UNDO量,可以通過如下SQL得出:
SQL> SELECT (SUM(undoblks))/ SUM((end_time - begin_time) * 86400) FROM v$undostat;

(SUM(UNDOBLKS))/SUM((END_TIME-BEGIN_TIME)*86400)
--------------------------------------------------------------
          7.97590055
或者可以看下AWR報告中的Undo Statistics部分。

(5)當前undo資料表空間使用狀態:
SQL> SELECT DISTINCT STATUS,SUM(BYTES),COUNT(*) FROM DBA_UNDO_EXTENTS GROUP BY STATUS;

STATUS  SUM(BYTES)   COUNT(*)
---------             ----------------   ----------
UNEXPIRED        3225157632   5667
EXPIRED            1063518208   1588
ACTIVE             1048576        1 

(6)查看活動事務v$transaction
SQL> SELECT A.SID, A.USERNAME, B.XIDUSN, B.USED_UREC, B.USED_UBLK 
         FROM V$SESSION A, V$TRANSACTION B WHERE A.SADDR=B.SES_ADDR;

       SID  USERNAME   XIDUSN    USED_UREC USED_UBLK
---------- ------------ ---------- ---------- ----------
       407   NDMC       15         3        1

SQL> SELECT XID AS "txn_id", XIDUSN AS "undo_seg", USED_UBLK "used_undo_blocks",
                     XIDSLOT AS "slot", XIDSQN AS "seq", STATUS AS "txn_status"
         FROM V$TRANSACTION;

txn_id         undo_seg   used_undo_blocks    slot      seq     txn_status
---------------- ---------- ---------------- ---------- --------- -------------
14001600733A0C00    20           1             22      801395      ACTIVE

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.