Ôõô²¶»ñ×Ô¼ºsessionÖ´ÐеÄsql£¬½øÐÐÉîÈë¸ú×Ù
alter session set timed_statistics = true; --¿ÉÑ¡
alter session set max_dump_file_size = unlimited; --¿ÉÑ¡£¬·ÀÖ¹dumpĿ¼·Å²»ÏÂ
-- To enable the trace event 10046
alter session set events '10046 trace name context forever, level 8';
--ÉèÖÃTRACEFILE_IDENTIFIER²ÎÊýÖµ£¬ÈÃtraceÎļþ°üÀ¨MyTrace×Ö·û£¬ÕâÑùÕÒÆðÀ´·½±ã£¨Õâ¸ö·½·¨²»´í£¡£©£¬´Ó8.1.7¿ªÊ¼¾ÍÒѾÓÐÁË
alter session set tracefile_identifier = 'MyTrace'; -- ¿ÉÑ¡
-- Run your SQL script or program to trace wait event information--
...ÄãµÄsql...
--To turn off the tracing
alter session set events '10046 trace name context off';
OK, ÕÒµ½¸Ãת´¢Îļþlocaldb_ora_4456_mytrace.trc
ÔÙʹÓÃtkprof£º
C:\> tkprof D:\oracle\product\10.2.0\admin\localdb\udump\localdb_ora_4456_mytrace.trc D:\output.txt
ʹ½á¹û¸ü¼Ó¿É¶Á¡£Èçͼ£º
¶ÁOracle Wait Interface: A Practical Guide to Performance Diagnostics & Tuning ÓиÐ~
Ïà¹ØÎĵµ£º
°æȨÉùÃ÷£ºÔ´´×÷Æ·£¬ÈçÐèתÔØ£¬ÇëÓë×÷ÕßÁªÏµ¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£
DB2ÁÙʱ±íÔÚSQL¹ý³ÌºÍSQLÓï¾äÖеIJâÊÔ×ܽá
²âÊÔÄ¿±ê£º
·Ö±ðÔÚSQL¹ý³ÌºÍSQLÓï¾äÖд´½¨ÁÙʱ±í£¬²¢²åÈëÊý¾Ý£¬¿´Ö´Ðнá¹ûÓÐʲôÒìͬ¡£
²âÊÔ»·¾³£º
DB2 UDB V9.1
Ö´Ðи½¼þÀïÃæµÄSQLÓï¾ä£¬µÃµ½Ò»¸ö±í¡ ......
1¡¢Î½´Ê ν´ÊÔÊÐíÄú¹¹ÔìÌõ¼þ£¬ÒÔ±ãÖ»´¦ÀíÂú×ãÕâЩÌõ¼þµÄÄÇЩÐС£
2¡¢Ê¹Óà IN ν´Ê
ʹÓà IN ν´Ê½«Ò»¸öÖµÓëÆäËû¼¸¸öÖµ½øÐбȽϡ£ÀýÈ磺
SELECT NAME from STAFF WHERE DEPT IN (20, 15)
´ËʾÀýÏ൱ÓÚ£º
SELECT NAME from STAFF WHERE DEPT = 20 OR DEPT = 15
µ±×Ó²éѯ·µ»ØÒ»×éֵʱ£¬¿ÉʹÓà IN ºÍ NOT IN ÔËËã·û¡£ÀýÈç£ ......
1.¶Á³ö±íÖеÄ×Ö¶ÎÃû
ResultSet rs = test.selectSql("SELECT * from datainfo");
java.sql.ResultSetMetaData md=rs.getMetaData(); //¶Á³öÊý¾Ý¿âµÄ×Ö¶ÎÃû
int nColumn=md.getColumnCount(); //×Ö¶Î×ÜÊý
for(int i=0;i<nColumn;i++)
& ......