truncate操作導(dǎo)致DATA_OBJECT_ID改變 |
發(fā)布時(shí)間: 2012/9/13 17:24:11 |
Oracle中一般情況下表的OBJECT_ID與DATA_OBJECT_ID是一致的。 但在truncate后表達(dá)DATA_OBJECT_ID會(huì)發(fā)生改變。利用這一特性可以判斷表是否發(fā)生過(guò)truncate操作。 注:(DATABASE LINK,FUNCTION,PROCEDURE,SEQUENCE,VIEW)沒(méi)有DATA_OBJECT_ID。 Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Connected as report SQL> SELECT t.table_name, t.last_analyzed, t.num_rows TABLE_NAME LAST_ANALYZED NUM_ROWS --T2的 OBJECT_ID 與DATA_OBJECT_ID相同 SQL> SELECT object_name, object_type, object_id, data_object_id OBJECT_NAM OBJECT_TYPE OBJECT_ID DATA_OBJECT_ID SQL> truncate table T2; SQL> analyze table t2 compute statistics; -- 對(duì)表T2進(jìn)行truncate后OBJECT_ID未發(fā)生改變,而DATA_OBJECT_ID由 75567 變?yōu)?76592 SQL> SELECT object_name, object_type, object_id, data_object_id SQL>
本文出自:億恩科技【mszdt.com】 服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |