ORACLE 9i ͳ¼Æ±í
Õ⼸Ìì×öÏîÄ¿Óöµ½ÁËǧÍò¼¶±íµÄ´¦Àí£¬Ïà¹ØÓÅ»¯µÄÐĵÃÌؼǼÏÂÀ´£¬ÒÔÇ°ÈÕºó²é¿´¡£
ÊÕ¼¯Í³¼Æ±íÐÅÏ¢ÓÐ2ÖÖ·½·¨£º
1: ANALYZE TABLE employees COMPUTE STATISTICS;
2: exec dbms_stats.gather_table_stats(ownname => 'owner_name',tabname => 'table_name' ,estimate_percent => null ,method_opt => 'for all indexed columns' ,cascade => true);
µÚ¶þÖÖ·½·¨¸üºÃ¶øÇÒ¸ü¼ÓÊʺϷÖÇø±í£¬¹ÊÈç¹ûÔÚÓÃÁ˵Ú1ÖÖ·½·¨Í³¼Æ±íÐÅÏ¢ºó·´ÕýSQL²éѯ±äÂýÁË£¬¿ÉÒÔɾ³ýÏà¹Øͳ¼ÆÐÅÏ¢ºó¸ÄÓõڶþÖÖ·½Ê½£¬ÔÒòÈçÏ£º
×Ô´ÓOracle8.1.5ÒýÈëdbms_stats°ü£¬ExpertsÃDZãÍƼöʹÓÃdbms_statsÈ¡´úanalyze¡£ ÀíÓÉÈçÏÂ
dbms_stats¿ÉÒÔ²¢ÐзÖÎö
dbms_statsÓÐ×Ô¶¯·ÖÎöµÄ¹¦ÄÜ(alter table monitor )
analyze ·ÖÎöͳ¼ÆÐÅÏ¢µÄ²»×¼È·some times
1,2ºÃÀí½â£¬ÇÒµÚ2µãʵ¼ÊÉÏÔÚVLDBÖÐÊÇ×îÎüÒýÈ˵ģ»3ÒÔÇ°±È½ÏÄ£ºý£¬¿´ÁËmetalink236935.1 ½âÊÍ£¬analyzeÔÚ·ÖÎöPartition±íµÄʱºò£¬ÓÐʱºò»á¼ÆËã³ö²»×¼È·µÄGlobal statistics .
ÔÒòÊÇ£¬dbms_stats»áʵÔÚµÄÈ¥·ÖÎö±íÈ«¾Öͳ¼ÆÐÅÏ¢£¨µ±Ö¸¶¨²ÎÊý£©£»¶øanalyzeÊǽ«±í·ÖÇø£¨¾Ö²¿£©µÄstatistics »ã×ܼÆËã³É±íÈ«¾Östatistics ,¿ÉÄܵ¼ÖÂÎó²î¡£
Èç¹ûÏë·ÖÎöÕû¸öÓû§»òÊý¾Ý¿â£¬»¹¿ÉÒÔ²ÉÓù¤¾ß°ü£¬¿ÉÒÔ²¢ÐзÖÎö
Dbms_utility(8iÒÔÇ°µÄ¹¤¾ß°ü)
Dbms_stats(8iÒÔºóÌṩµÄ¹¤¾ß°ü)
Èç
dbms_stats.gather_schema_stats(User,estimate_percent=>100,cascade=> TRUE);
dbms_stats.gather_table_stats(User,TableName,degree => 4,cascade => true);
ÕâÊǶÔÃüÁîÓ빤¾ß°üµÄһЩ×ܽá
1¡¢¶ÔÓÚ·ÖÇø±í£¬½¨ÒéʹÓÃDBMS_STATS£¬¶ø²»ÊÇʹÓÃAnalyzeÓï¾ä¡£
a) ¿ÉÒÔ²¢ÐнøÐУ¬¶Ô¶à¸öÓû§£¬¶à¸öTable
b) ¿ÉÒԵõ½Õû¸ö·ÖÇø±íµÄÊý¾ÝºÍµ¥¸ö·ÖÇøµÄÊý¾Ý¡£
c) ¿ÉÒÔÔÚ²»Í¬¼¶±ðÉÏCompute Statistics£ºµ¥¸ö·ÖÇø£¬×Ó·ÖÇø£¬È«±í£¬ËùÓзÖÇø
d) ¿ÉÒÔµ¹³öͳ¼ÆÐÅÏ¢
e) ¿ÉÒÔÓû§×Ô¶¯ÊÕ¼¯Í³¼ÆÐÅÏ¢
2¡¢DBMS_STATSµÄȱµã
a) ²»ÄÜValidate Structure
b) ²»ÄÜÊÕ¼¯CHAINED ROWS, ²»ÄÜÊÕ¼¯CLUSTER TABLEµÄÐÅÏ¢£¬ÕâÁ½¸öÈÔ¾ÉÐèҪʹÓÃAnalyzeÓï¾ä¡£
c) DBMS_STATS ĬÈϲ»¶ÔË÷Òý½øÐÐAnalyze£¬ÒòΪĬÈÏCascadeÊÇFalse£¬ÐèÒªÊÖ¹¤Ö¸¶¨ÎªTrue
3¡¢¶ÔÓÚoracle 9ÀïÃæµÄExternal Table£¬Analyze²»ÄÜʹÓã¬Ö»ÄÜʹÓÃDBMS_STATSÀ´ÊÕ¼¯ÐÅÏ¢¡£
-----------------------------------------------------------------
10GµÄÎĵµÊÇÕ
Ïà¹ØÎĵµ£º
begin
sys.dbms_job.submit(job => :job,
what => 'p_apip_price_send;',
&nbs ......
TO_DATE¸ñʽ(ÒÔʱ¼ä:2007-11-02 13:45:25ΪÀý)
Year:
yy two digits Á½Î»Äê ......
ËäÈ»ÎÒÃÇÖªµÀÉ̵À¹îÒ²,ÕâƪÎÄÕ»¹ÊÇÄܹ»ÈÃÎÒÃÇ´ÓijЩ½Ç¶ÈÉϹ۲졣±ÈÈçÅ·ÃËÓµ»¤¿ª·Å¼¼Êõ,Å·ÃËÒªÆÀ¼ÛOracleÓµÓÐMySQLºÍJavaËùÔì³ÉµÄÓ°Ïì,everything is politicalÒÑÈ»ÊÇÒ»Ìõ´ó·¹æÔòÁË£¬ÎÒÃÇ»¹ÊÇÄܹ»Ðá³öÕâ¸ö»Ï×ÓÏÂÃæÂôµÃ»¹ÊÇÀûÒæ¹Ï·ÖµÄÀϾÀ¸ð£¬×ܲ»ÄÜɶºÃʶ¼ÈÃÄãÃÀ¹úÀÐÕ¼ÁË¡£µ«ÊÇÎÒÏëÒ²Ö»ÊǸöʱ¼äÎÊÌ⣬ҲÐí±³ºóÍÆÊÖÒ ......
1¡¢´´½¨±ít1 £ºcreate table t1 (id number,name nvarchar(8))£»
2¡¢´´½¨ÐòÁÐ £ºCREATE SEQUENCE t1_id INCREMENT BY 1 START WITH 1 MAXVALUE
1.0E28 MINVALUE 1 NOCYCLE CACHE 20 NOORDER
3. ´´½¨´¥·¢Æ÷ £º
CREATE TRIGGER tig_insert_t1
BEFORE INSERT ON "YINZQ"."T1"
begin
if (:new.id is null) then
......
×î½üÔÚʹÓùý³ÌÖеķ¢ÏÖÁ¬½ÓÊý¾Ý¿âʱºÃʱ»µ£¬¾³£±¨TNSÒì³££¬ÔÚ¿ØÖÆÃæ°åÖÐÔÚ·þÎñÖн«tnsÕý³£Æô¶¯ºó£¬µ±Á¬½ÓÊý¾Ý¿âʱ·¢ÏÖtnsÓÖÍ£Ö¹ÁË¡£¿à¿àÔÚÍøÉÏËÑÑ°ÁËÐí¶à£¬·¢ÏÖÍøÉÏÆÌÌì¸ÇµØµÄÈýÖÖ·½·¨£¬ÎÒÒ»Ò»ÊÔÁ˶¼Ã»ÓÐ×÷Óá£
ºóÀ´ÎÞÒâÖп´µ½Ò»Î»ÍøÓÑ˵Ëû³öÏÖ¹ýÏàͬµÄÎÊÌ⣬ÊÇÓÉÓÚ×°Á˸övpnÈí¼þ£¬ÕâʱµÄÎÒÉñ¾ÌرðÃô ......