数据库服务器重启后,首次insert操作很慢
我的oracle数据库中有一张数据表,按照时间进行了分区,根据表空间的使用率,会定期删除老的分区,为防止删分区时的导致的全局索引问题,该表没有创建主键,现在的问题是,每次重启服务器之后的第一个插入操作,会等待50秒,哪怕只插入一条数据,我用sqldeveloper连上测试,并用10046进行了跟踪,trace如下:
********************************************************************************
SQL ID: 06nvwn223659v
Plan Hash: 0
alter session set events '10046 trace name context off'
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
Parsing user id: 86
********************************************************************************
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 8 0.13 0.26 0 0 0 0
Execute 8 0.63 0.76 17 4 62 1
Fetch 6 0.15 0.41 50 20980 0 15
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 22 0.92 1.43 67 20984 62 16
Misses in library cache during parse: 7
Misses in library cache during execute: 2
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 8 0.00 0.00
SQL*Net message from client 8 24.35 51.83
db file sequential read 67 0.03 0.25
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2516 0.06 0.07 0 0 0 0
Execute 2872 0.50 0.65 4 15 41 8
Fetch 3171 1.10 50.42 2489 14118 0 6462
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8559 1.68 51.15 2493 14133 41 6470
Misses in library cache during parse: 42
Misses in library cache during execute: 42
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
db file sequential read 2493 0.12 49.58
Disk file operations I/O 11 0.00 0.00
8 user SQL statements in session.
2872 internal SQL statements in session.
2880 SQL statements in session.
********************************************************************************
Trace file: agc_ora_3991.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
8 user SQL statements in trace file.
2872 internal SQL statements in trace file.
2880 SQL statements in trace file.
48 unique SQL statements in trace file.
70356 lines in trace file.
95 elapsed seconds in trace file.
我现在想弄明白三件事情:
1.现在这种慢,到底是什么导致的,是因为表没有主键的原因吗?
2.如果主键的原因,那为什么网上有很多帖子说建议分区表不要建主键?
3.为什么只在首次插入的时候出现问题,紧接着第二次插入就非常的快?
希望有高人给予指点,本人对数据库比较小白,多谢,有的分全给了~~~