How to calculate the size of the undo tablespace In the undo Series

Source: Internet
Author: User


The undo series learn how to calculate the size of undo tablespaces undo space insufficiency can cause ORA-30036 or ORA-01555. We create a small undo tablespace and execute a large transaction, then we can simulate the ORA-30036. [SQL] sys @ ORCL> create undo tablespace thinktbs datafile '/u01/app/oracle/oradata/ORCL/datafile/think_undo.dbf' 2 size 2 m autoextend off; www.2cto.com Tablespace created. sys @ ORCL> alter system set undo_tablespace = thinktbs; System altered. sys @ ORCL> show parameter undo name type value =----------- export undo_management string AUTO undo_retention integer 800 undo_tablespace string THINKTBS another session: hr @ ORCL> select count (*) from t; www.2cto.com COUNT (*) ---------- 462140 hr @ ORCL> begin 2 for I in 1 .. 1000 3 loop 4 delete from t where rownum <1001; 5 commit; 6 end loop; 7 end; 8/begin * ERROR at line 1: ORA-30036: unable to extend segment by 8 in undo tablespace 'thinktbs 'ORA-06512: at line 4
During the execution of this transaction, we can query how many undo data blocks it uses: sys @ ORCL> select addr, used_ublk from v $ transaction; www.2cto.com ADDR USED_UBLK -------- ---------- 37A19440 19 37A19E88 1 how should we determine the size of the undo tablespace? The size of the undo tablespace has three influencing factors: 1) undo_retention: determine the value. See: http://www.bkjia.com/database/201207/144758.html 2) undo data blocks required per second: We can query the value from v $ undostat to calculate the maximum value or average value, but we recommend that you set the maximum value to 3) default block size formula undo size = db_block_size * undo_retention * max (undoblks/(end_time-begin_time) * 24*3600 )) [SQL] sys @ ORCL> select max (undoblks/(end_time-begin_time) * 24*3600) from v $ undostat; MAX (UNDOBLKS/(END_TIME-BEGIN_TIME) * 24*3600) --------------------------------------------- 5.77333333 sys @ ORCL> show parameter db_block_size www.2cto.com NAME Type value when ----------- mongodb_block_size integer 8192 sys @ ORCL> show parameter undo_retention name type value when ----------- using undo_retention integer 800 through the above query, we can calculate the specific VALUE of the undo tablespace size.. We can increase the size of the undo tablespace accordingly. [SQL] sys @ ORCL> alter tablespace undotbs1 add datafile '/u01/app/oracle/oradata/ORCL/datafile/thinkundo. dbf 'size 30 m autoextend on; Tablespace altered. author: linwaterbin

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.