ORA-01652, issues related to insufficient temp tablespace

Source: Internet
Author: User

During the 11th holiday, it may not be easy. If the database reports an error and a critical business cannot be properly executed on a certain day, it must be processed immediately.

Cause Analysis

1, log on to the database, view the host log, the error content is ORA-01652, temp tablespace is insufficient

ORA-01652: unable to extend temp segment by 128 in tablespace TEMP01

2. Ask the business department to re-execute the relevant script and find the specific statement that occupies the temp tablespace is as follows. Currently, the temp tablespace is 96 GB, which will be used up by the SQL statement in about one hour. The SQL statement exits unexpectedly.

The SQL statement is as follows:

  1. Insert into www. WWW_BILL_DTL_TEMP_0101 (ACCT_ID, SERV_ID, identifier, BRAND,
  2. PHONE_ID, USER_TYPE) SELECT ACCT_ID, SERV_ID, sum (distinct) values, BRAND
  3. , PHONE_ID, USER_TYPE FROM (SELECT ACCT_ID, SERV_ID, SUM (distinct) F
  4. EE, BRAND, PHONE_ID, USER_TYPE FROM (select a. acct_id, e. serv_id, s
  5. Um (B. unpay_type) values, a. brand, a. phone_id, a. user_type from www. ACC_ B
  6. ILL_010120121010 A, www. WWW_BILL_DTL_010120121010 B, www. OWE_MO
  7. NITOR_QUEUE_ACTION E where a. bill_id = B. bill_id and A. ACCT_ID = E.
  8. ACCT_ID and a. brand in (: "SYS_ B _00",: "SYS_ B _01",: "SYS_ B _02",: "SY
  9. S_ B _03 ",:" SYS_ B _04 ",:" SYS_ B _05 ") and B. fee_item_id>:" SYS_ B _06"
  10. Group by a. acct_id, e. serv_id, a. brand, a. phone_id, a. user_type) g
  11. Roup by ACCT_ID, SERV_ID, BRAND, PHONE_ID, USER_TYPE UNION ALL SE
  12. LECT ACCT_ID, SERV_ID,-: "SYS_ B _07" * SUM (distinct) values, BRAND, PHONE_ID,
  13. USER_TYPE FROM (select a. acct_id, e. serv_id, sum (B. unpay_fee) FE
  14. E, a. brand, a. phone_id, a. user_type from www. WWW_BILL_010120121005
  15. , Www. WWW_BILL_DTL_010120121005 B, www. WWW_MONITOR_QUEUE_ACTION
  16. E where a. bill_id = B. bill_id and A. ACCT_ID = E. ACCT_ID and a. bran
  17. D in (: "SYS_ B _08",: "SYS_ B _09",: "SYS_ B _10",: "SYS_ B _11",: "SYS_ B _12
  18. ",:" SYS_ B _13 ") and B. fee_item_id>:" SYS_ B _14 "group by a. acct_id
  19. , E. serv_id, a. brand, a. phone_id, a. user_type) group by ACCT_ID, S
  20. ERV_ID, BRAND, PHONE_ID, USER_TYPE) group by ACCT_ID, SERV_ID, BRAN
  21. D, PHONE_ID, USER_TYPE

The execution plan is as follows:

  1. Plan hash value: 3236377944
  2. Bytes --------------------------------------------------------------------------------------------------------------------
  3. | Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
  4. Bytes --------------------------------------------------------------------------------------------------------------------
  5. | 0 | insert statement | 19281 (100) |
  6. | 1 | hash group by | 2 | 184 | 19281 (2) | 00:03:52 |
  7. | 2 | VIEW | 2 | 184 | 19280 (2) | 00:03:52 |
  8. | 3 | UNION-ALL |
  9. | 4 | sort group by | 1 | 92 | 19271 (2) | 00:03:52 |
  10. | 5 | VIEW | 1 | 92 | 19271 (2) | 00:03:52 |
  11. | 6 | sort group by | 1 | 144 | 19271 (2) | 00:03:52 |
  12. | * 7 | hash join | 1 | 144 | 19270 (2) | 00:03:52 |
  13. | 8 | merge join cartesian | 1 | 65 | 8717 (2) | 00:01:45 |
  14. | 9 | table access full | WWW_MONITOR_QUEUE_ACTION | 1 | 26 | 2 (0) | 00:00:01 |
  15. | 10 | buffer sort | 257K | 9810K | 8715 (2) | 00:01:45 |
  16. | * 11 | table access full | WWW_BILL_DTL_010120121010 | 257K | 9810K | 8715 (2) | 00:01:45 |
  17. | * 12 | table access full | WWW_BILL_010120121010 | 16755 | 1292K | 10552 (1) | 00:02:07 |
  18. | 13 | sort group by | 1 | 53 | 9 (12) | 00:00:01 |
  19. | 14 | VIEW | 1 | 53 | 9 (12) | 00:00:01 |
  20. | 15 | sort group by | 1 | 79 | 9 (12) | 00:00:01 |
  21. | 16 | table access by index rowid | WWW_BILL_DTL_010120121005 | 1 | 18 | 3 (0) | 00:00:01 |
  22. | 17 | nested loops | 1 | 79 | 8 (0) | 00:00:01 |
  23. | 18 | nested loops | 1 | 61 | 5 (0) | 00:00:01 |
  24. | 19 | table access full | WWW_MONITOR_QUEUE_ACTION | 1 | 26 | 2 (0) | 00:00:01 |
  25. | * 20 | table access by index rowid | WWW_BILL_010120121005 | 1 | 35 | 3 (0) | 00:00:01 |
  26. | * 21 | index range scan | ITDX_ACCT_ID_10120121005 | 1 | 2 (0) | 00:00:01 |
  27. | * 22 | index range scan | TPK_BILL_DTL_ID_10120121005 | 1 | 2 (0) | 00:00:01 |
  28. Bytes --------------------------------------------------------------------------------------------------------------------
  • 1
  • 2
  • Next Page

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.