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

Ôõô²¶»ñ×Ô¼º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¹ý³Ì

 
°æȨÉùÃ÷£ºÔ­´´×÷Æ·£¬ÈçÐèתÔØ£¬ÇëÓë×÷ÕßÁªÏµ¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£
DB2ÁÙʱ±íÔÚSQL¹ý³ÌºÍSQLÓï¾äÖеIJâÊÔ×ܽá
 
²âÊÔÄ¿±ê£º
 
·Ö±ðÔÚSQL¹ý³ÌºÍSQLÓï¾äÖд´½¨ÁÙʱ±í£¬²¢²åÈëÊý¾Ý£¬¿´Ö´Ðнá¹ûÓÐʲôÒìͬ¡£
 
²âÊÔ»·¾³£º
 
DB2 UDB V9.1
 
Ö´Ðи½¼þÀïÃæµÄSQLÓï¾ä£¬µÃµ½Ò»¸ö±í¡ ......

SQL Server2005ËĸöÅÅÐòº¯Êý¼ò½é

ÅÅÃûº¯ÊýÊÇSQL Server2005мӵŦÄÜ¡£ÔÚSQL Server2005ÖÐÓÐÈçÏÂËĸöÅÅÃûº¯Êý£º
1. row_number ×Ô¶¯Éú³ÉÐкÅ,ÐòºÅÓÉorder by ×ֶξö¶¨
2. rank over Filed, ÓÉrank overµÄ×ֶξö¶¨£¬Ãû´Î²»Á¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£¬ÔòºóÐøÃû´ÎÖ±½Ó´Ó4¿ªÊ¼
3. dense_rank£¬ºÍrankÏàËÆ£¬Ö»ÊÇÃû´ÎÁ¬Ðø£¬ÈçÓÐ3¸ö²¢ÁеÚÒ»Ãû£ ......

SQL Server ÎÞÕʺŻòÍü¼ÇÃÜÂëµÇ½ÎÊÌâ

Question 1£º
Êý¾Ý¿âµÄÑé֤ģʽΪWindowsÑéÖ¤£¬É¾³ýÁËMS SQL ServerÕʺÅBUILTIN\Administrators,µÇ½²»ÉÏSQL Server¹ÜÀíÆ÷£¿
Answer£º
      1.ÖØÐÂÔËÐÐMS SQL SERVERµÄ°²×°³ÌÐò£¬ÔÚ“°²×°Ñ¡ÏçÃæÀïÑ¡Ôñ“¸ß¼¶Ñ¡Ï¬ÏÂÒ»²½ºóÑ¡Ôñ“×¢²á±íÖؽ¨”£¬½ÓÏÂÀ´¸ú° ......

SQL SERVERÈÕÆÚʱ¼äº¯Êý

 À´Ô´http://hi.baidu.com/smilevt/blog/item/04bddeef0fe3f42e2cf5348b.htmlÕâÀﻹÓкܶàsql serverµÄÌû×Ó
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
select dateadd(day,2,'2004-10-15') --·µ»Ø£º2004-10-17 00:00:00. ......

shellÖÐʹÓÃSQLʵÏÖ²éѯ

 ÏÈ°ÑÎı¾½øÐиñʽ´¦Àí£¬È»ºóÒÔ¿Õ¸ñΪ·Ö¸ô·û£¬È¡µÚ¶þ¸ö¿Õ¸ñºóµÄ×Ö´®£¬ÅÅÐò£¬È¥ÖØ£¬ÔÙ½µÐòÅÅÁУ¬È¡Ç°5¸ö
arr=($(cat 0100055F_Detail.txt|sed -e '/:/d'|awk -F ' ' '{print$2}'|sort|uniq -c|sort -nr|head -5|awk '{print $2}'))
len=${#arr[@]}  »ñÈ¡Êý×鳤¶È
for((i=0;i<$len;i++))
do
echo ${arr[$i] ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ