go to http://oracle.in.th

Wednesday, April 28, 2010

ถ้า datafile ของ Temporary Tablespaces มีการใช้งานเกือบเต็ม 99% จะมีผลอะไรบ้าง ?

สวัสดีครับ เพื่อน ๆ ใน Oracle.in.th ทุกท่าน

วันนี้ผมได้เปิด Twitter แล้วอ่าน ๆ ดู แล้วผมพบคำถามว่า
"ถ้า datafile ของ Temporary Tablespaces มีการใช้งานเกือบเต็ม 99% จะมีผลอะไรบ้างครับ ?"

ผมเลยเอาคำตอบมาให้ เพื่อน ๆ ได้อ่านกันนะครับ

ถ้าถามว่า ถ้า datafile ของ Temporary Tablespaces มีการใช้งานเกือบเต็ม 99% จะมีผลอะไรบ้าง ?

โดยปกติแล้ว tempfile จะต้องมีการ extend ต่อได้ จนถึง maxsize (หรือ limit)
SQL> select file_name, tablespace_name, increment_by,maxbytes from dba_temp_files;

ถ้าไม่สามารถ extend ได้แล้ว จะพบ
ORA-01652: unable to extend temp segment -> บน transaction ที่กำลังใช้ TEMP Segment

ถ้าหมายถึง tempfile ที่ไม่สามารถ extend ได้แล้ว ขอยกตัวอย่าง
SQL> create temporary tablespace test_temp tempfile size 128k autoextend off extent management local uniform size 64k;

SQL> alter user surachart temporary tablespace test_temp;

SQL> show user;
USER is "SURACHART"

SQL> CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE ROWS;

Table created.

SQL> insert into my_temp_table select object_id,object_id from all_objects;
insert into my_temp_table select object_id,object_id from all_objects
*
ERROR at line 1:
ORA-01652: unable to extend temp segment by 8 in tablespace TEST_TEMP

แต่กรณี 99% แล้วยัง extend ต่อได้ ไม่ควรมีปัญหาครับ

กรณี ORA-01652
ควรที่จะต้องเพิ่ม tempfile หรือแก้ไข transactionนั้นๆ (sql) ให้ใช้ temp segment น้อยลง


...หวังว่าเพื่อน ๆ คงหายสงสัยกันแล้วนะครับ
ถ้าเพื่อน ๆ มีคำถาม ก็สามารถส่งมาถามใน Twitter กันได้นะครับ @oracleinth
ปล. ขอบคุณ คุณ @aongang ด้วยครับ ^^

Credit by @surachart
ข้อเขียนนี้ช่วยฉัน:  

1 comment:

Anonymous said...

โดนเลยครับ

Post a Comment