Ãâ°²×°Oracle¿Í»§¶ËʹÓÃPL/SQLÁ¬½ÓOracle
´ó¼Ò¶¼ÖªµÀ£¬ÓÃPL/SQLÁ¬½ÓOracle£¬ÊÇÐèÒª°²×°Oracle¿Í»§¶ËÈí¼þµÄ¡£ÓÐûҪÏë¹ý²»°²×°Oracle¿Í»§¶ËÖ±½ÓÁ¬½ÓOracleÄØ£¿
ÆäʵÎÒÒ»Ö±ÏëÕâÑù×ö£¬ÒòΪÕâ¸ö¿Í»§¶ËʵÔÚÌ«ÈÃÈËÌÖÑáÁË£¡£¡£¡²»µ«»á°²×°Ò»¸öJDK£¬¶øÇÒ»¹»á°Ñ×Ô¼º·ÅÔÚ»·¾³±äÁ¿µÄ×îÇ°Ã棬»áÔì³É²»Ð¡µÄÂé·³¡£
ÆäʵÎÒ֮ǰÎʹýºÜ¶àÈ˵ģ¬µ«ÊÇËûÃǶ¼ËµÒ»¶¨ÐèÒª°²×°Oracle¿Í»§¶ËµÄ.......Ö±µ½×òÌìÎÞÒâÖз¢ÏÖÁËÒÔÏÂÕâ¸ö·½·¨£º
Ö»ÐèÒªÔÚOracleÏÂÔØÒ»¸ö½ÐInstant Client PackageµÄÈí¼þ¾Í¿ÉÒÔÁË£¬Õâ¸öÈí¼þ²»ÐèÒª°²×°£¬Ö»Òª½âѹ¾Í¿ÉÒÔÓÃÁË£¬ºÜ·½±ã£¬¾ÍËãÖØ×°ÁËϵͳ»¹ÊÇ¿ÉÒÔÓõġ£
ÏÂÔصØÖ·£ºhttp://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
ÏÂÔØÕâ¸ö£¬Instant Client Package - Basic°ü¡£È»ºó½âѹµ½ÈÎÒâĿ¼£¬ÔÚÕâ¸öĿ¼Ï½¨Á¢NETWORKÎļþ¼Ð£¬½Ó×ÅÔÙÕâ¸öÎļþ¼ÐÏÂÔÙ½¨Á¢ADMINÎļþ¼Ð£¬È»ºó½¨Á¢tnsnames.oraÎļþ£¬ÄÚÈÝÈçÏ£º
oracledata =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = yourhostIp )(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = yourSID )
)
)
ÕâÀï¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿öÅäÖ᣽Ó×Å´ò¿ªPL/SQL£¬ÔÚperferenceÀïÃæÉèÖÃOCI LibraryºÍOracle_home£¬ÎÒµÄÉèÖÃÊÇOCI Library=c:\oracleclient\oci.dll,Oracle_home=c:\oracleclient¡£
¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿öÅäÖã¬Æäʵ¾ÍÊǸղÅÏÂÔØÏÂÀ´µÄÄǸö°üµÄ·¾¶¡£»¹ÓÐ×îºóÒ»¸öÎÊÌ⣬ÐèÒªÉèÖÃÒ»¸ö×Ö·û¼¯£¬ÕâÑù²éѯ³öÀ´µÄÊý¾Ý²Å²»»áÊÇÂÒÂ룬дһ¸öÅú´¦Àípldev. bat·Åµ½pl°²×°Ä¿Â¼Ï£¬ÄÚÈÝÈçÏ£º
set nls_lang=SIMPLIFIED CHINESE_CHI
Ïà¹ØÎĵµ£º
1,SELECT *,CASE OrderStatus WHEN 1 THEN 'δ´¦Àí' when 2 THEN 'Ëø¶¨' when
3 THEN 'ÒѳöƱ' ELSE '¹ýÆÚ' END
from dbo.T_OrderItem
2,
SELECT *,CAST(ROUND(CAST (HostWin AS FLOAT)/(HostWin+HostDraw+HostBear),2)*100 AS varchar)+'%' AS HostWinRate,
& ......
²»´íµÄ×ÊÁÏ,ת¹ýÀ´,·½±ãÈÕºó²é¿´Ê¹ÓÃ!!!
--¼à¿ØË÷ÒýÊÇ·ñʹÓÃ
alter index &index_name monitoring usage;
alter index &index_name nomonitoring usage;
select * from v$object_usage where index_name =
&index_name;
--ÇóÊý¾ÝÎļþµÄI/O·Ö²¼
select
df.name,phyrds,phywrts,phyblkrd,phyblkwrt,sin ......
È¡±íÀïnµ½mÌõ¼Í¼µÄ¼¸ÖÖ·½·¨:
1. Ö»ÐèÒª²éѯǰMÌõÊý¾Ý(0 to M),
1.1 ʹÓà top(M) ·½·¨:
select top(3) * from [tablename]
1.2 ʹÓà set rowcount ·½·¨:
http://msdn.microsoft.com/zh-cn/library/ms188774(SQL.90).aspx
set rowcount M
select * from [tablename]
set rowcount 0
ȨÏÞ ÒªÇó¾ßÓÐ public ......
SQLµÄÓÅ»¯Ó¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æСÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
SQLÓï¾ä£º
ÊǶÔÊý¾Ý¿â(Êý¾Ý)½øÐвÙ×÷µÄΩһ;¾¶£»
ÏûºÄÁË70%~90%µÄÊý¾Ý¿â×ÊÔ´£»¶ÀÁ¢ÓÚ³ÌÐòÉè¼ÆÂß¼£¬Ïà¶ÔÓÚ¶Ô³ÌÐòÔ´´úÂëµÄÓÅ»¯£¬¶ÔSQLÓï¾äµÄÓÅ» ......