Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ORACLEµ÷ÓÅÖ® ¶à»º´æ³ØÃüÖÐÂÊ£¨Õª×ÔÎÄƽÊ飩

ÆÀ¹ÀÊý¾Ý¸ßËÙ»º´æЧÂʵÄÖ¸±êÊÇÃüÖÐÂÊ¡£¸ÃÃüÖÐÂÊͨ¹ý²éѯV$SYSSTAT ºÍ$BUFFER_POOL_STATISTICSÊÓͼ¿ÉÒԵõ½¡£Õâ¸öÊÓͼ¿ÉÒÔ
²éѯÿ¸ö»º´æ³Ø¸÷×ÔµÄÃüÖÐÂÊ¡£»º´æ³ØµÄÃüÖÐÂʵļÆËã²ÉÓÃÏÂÃæµÄ¹«Ê½:
   1-(physical_reads/(db_block_gets+consistent_gets))
   ÏÂÃæµÄSQLÓï¾ä³£ÓÃÀ´²éѯµ±Ç°¸÷¸ö»º´æ³ØµÄÃüÖÐÂÊÇé¿ö:
    SQL>select name,physical_reads,db_block_gets,consistent_gets,
        1-(physical_reads/(db_block_gets+consistent_gets))  "ÃüÖÐÂÊ"
        from v$buffer_pool_statistics;
SQL> select name,physical_reads,db_block_gets,consistent_gets,
  2          1-(physical_reads/(db_block_gets+consistent_gets))  "ÃüÖÐÂÊ"
  3          from v$buffer_pool_statistics;
NAME                 PHYSICAL_READS DB_BLOCK_GETS CONSISTENT_GETS     ??????
-------------------- -------------- ------------- --------------- ----------
DEFAULT                        3806          1541           44202 .916796013
ͨ¹ý¶ÔV$BHÊÓͼµÄ²éѯ¿ÉÒÔ»ñµÃµ±Ç°´æ·ÅÔÚSGAÖеÄËùÓÐÊý¾Ý¿éµÄ¿éID£¬ÏÂÃæÁгöÁËÁ½ÖÖ·½·¨£¬ÓÃÀ´ÕÒ³öÊý¾Ý¿â¶ÔÏó£¨±í¡¢Ë÷ÒýµÈ
¶Î¶ÔÏó£©Õ¼ÓÃÊý¾Ý»º´æµÄ״̬£¬»òÕßij¸ö¶ÎʹÓûº´æµÄÇé¿ö¡£ÏÂÁеIJéѯÓï¾äÁгöÁ˵±Ç°Êý¾Ý¸ßËÙ»º´æÖдæ·ÅµÄËùÓÐÊý¾Ý¿éµÄ¶ÎÃû£¬
ÒÔ¼°¸Ã¶ÎÔÚÊý¾Ý»º´æÖÐÊý¾Ý¿éµÄ¼ÆÊý:
  SQL>select o.object_name OBJECT_NAME,count(*) number_of_blocks
        from dba_objects o,v$BH bh
        where o.data_object_id=bh.objd
        and o.owner  not in('SYS','SYSMAN')
  


Ïà¹ØÎĵµ£º

¹ØÓÚOracle to_char()º¯ÊýÖеÄIW,WW ÖܱðÏÔʾ

1£©wwµÄË㷨ΪÿÄê1ÔÂ1ÈÕΪµÚÒ»ÖÜ¿ªÊ¼£¬date+6ΪÿһÖܽáβ
¡¡¡¡ÀýÈç20050101ΪµÚÒ»ÖܵĵÚÒ»Ì죬¶øµÚÒ»ÖܵÄ×îºóÒ»ÌìΪ20050101+6=20050107
¡¡¡¡¹«Ê½ ÿÖܵÚÒ»Ìì £ºdate + ÖÜ * 7 - 7
¡¡¡¡Ã¿ÖÜ×îºóÒ»Ì죺date + ÖÜ * 7 - 1
2£©iwµÄË㷨ΪÐÇÆÚÒ»ÖÁÐÇÆÚÈÕËãÒ»ÖÜ£¬ÇÒÿÄêµÄµÚÒ»¸öÐÇÆÚһΪµÚÒ»ÖÜ£¬
¡¡¡¡ ÀýÈç20050101Î ......

Create Oracle Data Source

ÔÚStand aloneµÄ»·¾³Öд´½¨Oracle data source¹©²âÊÔʹÓãº
   OracleDataSource dataSource = new OracleDataSource();
   dataSource.setDriverType("oracle.jdbc.driver.OracleDriver");
   dataSource.setURL("jdbc:oracle:thin:@localhost:1521:ORCL");
   ......

oracleÀ䱸·Ý »Ö¸´

·½·¨Ò»£º×î¼òµ¥µÄ·½·¨£¨Ð轨¿â£©
±¸·Ý£º
  Ö±½Ó¿½±´oracleĿ¼ÏµÄadmin¡¢oradataÁ½¸öÎļþ¼Ð£¬ora92Ŀ¼ÏÂdatabase£¬µ½ÆäËû´æ´¢ÊµÏÖ±¸·Ý¡£
»Ö¸´£º
1.´´½¨Ò»¸öºÍÔ­À´Ò»ÑùµÄÊý¾Ý¿â¡£(°²×°Â·¾¶ºÍÊý¾Ý¿âÃû±ØÐëºÍÔ­À´Ò»ÖÂ)
2.ÓùÜÀíÔ±Á¬ÈëÊý¾Ý¿âºóÍ£Ö¹Êý¾Ý¿â¡£
3.°Ñ°²×°Ä¿Â¼ÏµÄadminºÍoradata¸´ÖƹýÈ¥¸²¸Ç£¨Èç¹û´æÔÚ ......

oracleÊý¾Ý¿â´æ´¢

select * from test where rownum <=10 ÏÂÃæÊǹØÓÚrownumµÄ½éÉÜ ================================ RownumºÍrow_number() over()µÄʹÓà ROWNUMÊÇOracle´Ó8¿ªÊ¼ÌṩµÄÒ»¸öαÁУ¬ÊÇ°ÑSQL³öÀ´µÄ½á¹û½øÐбàºÅ£¬Ê¼ÖÕ´Ó1¿ªÊ¼£¬³£¼ûµÄÓÃ;¾ÍÊÇÓÃÀ´·ÖÒ³Êä³ö. ±ÈÈç SELECT * from torderdetail a WHERE ROWNUM <= 10 ÕâÌõÓï¾ä¾ ......

Ëæ»úÑ¡ÔñÐеÄSQLÓï¾ä? ORACLE SQLSERVER ECT.

MySQL:
SELECT column from table
ORDER BY RAND()
LIMIT 1
PostgreSQL:
SELECT column from table
ORDER BY RANDOM()
LIMIT 1
Microsoft SQL Server:
SELECT TOP 1 column from table
ORDER BY NEWID()
IBM DB2
SELECT column, RAND() as IDX
from table
ORDER BY IDX FETCH FIRST 1 ROWS ONLY
Thanks Ti ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ