討論:關於The REBIND utility and the FLUSH PACKAGE CACHE

rheet1978發表於2007-06-25
在看The REBIND utility and the FLUSH PACKAGE CACHE command時,原文如下:
For static SQL statements, packages are created and bound to the database at compile time. If statistics are updated to reflect the physical database characteristics,existing packages should also be updated. The REBIND utility allows you to recreate a package so that the current database statistics can be used. The command is very simple:
REBIND PACKAGE package_name

However, if you are going to change the application source, the existing associated package needs to be explicitly dropped and recreated. The REBIND utility is not used for this purpose. We bring this to your attention here because DBAs often misunderstand the usage of REBIND.
As for dynamic SQL statements, they are precompiled at runtime and stored in the package cache. If statistics are updated, you may flush the cache so that dynamic SQL statements are compiled again to pick up the updated statistics. The command looks like this:
FLUSH PACKAGE CACHE DYNAMIC

有一個疑惑,對基於資料庫的application,比如procedure,如果用到了靜態sql,每次統計資訊變化了,都要重新繫結application的話,不是很麻煩嗎?其他資料庫也是這麼處理的嗎?

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9524210/viewspace-376282/,如需轉載,請註明出處,否則將追究法律責任。

相關文章