ͨ¹ýv$sqlarea,v$sql²éѯ×îÕ¼ÓÃ×ÊÔ´µÄ²éѯ
ͨ¹ýv$sqlarea,v$sql²éѯ×îÕ¼ÓÃ×ÊÔ´µÄ²éѯ ÊÕ²Ø
ÒýÓÃ:http://blog.chinaunix.net/u/3866/showart_396335.html
-----------------------
v$sqlarea,v$sql
-----------------------
´ÓV$SQLAREAÖвéѯ×îÕ¼ÓÃ×ÊÔ´µÄ²éѯ
select b.username username,a.disk_reads reads,
a.executions exec,a.disk_reads/decode(a.executions,0,1,a.executions) rds_exec_ratio,
a.sql_text Statement
from v$sqlarea a,dba_users b
where a.parsing_user_id=b.user_id
and a.disk_reads > 100000
order by a.disk_reads desc;
ÓÃbuffer_getsÁÐÀ´Ìæ»»disk_readsÁпÉÒԵõ½Õ¼ÓÃ×î¶àÄÚ´æµÄsqlÓï¾äµÄÏà¹ØÐÅÏ¢¡£
V$SQLÊÇÄÚ´æ¹²ÏíSQLÇøÓòÖÐÒѾ½âÎöµÄSQLÓï¾ä¡£
ÁгöʹÓÃƵÂÊ×î¸ßµÄ5¸ö²éѯ£º
select sql_text,executions
from (select sql_text,executions,
rank() over
(order by executions desc) exec_rank
from v$sql)
where exec_rank <=5;
ÏûºÄ´ÅÅ̶ÁÈ¡×î¶àµÄsql top5£º
select disk_reads,sql_text
from (select sql_text,disk_reads,
dense_rank() over
(order by disk_reads desc) disk_reads_rank
from v$sql)
where disk_reads_rank <=5;
ÕÒ³öÐèÒª´óÁ¿»º³å¶ÁÈ¡£¨Âß¼¶Á£©²Ù×÷µÄ²éѯ£º
select buffer_gets,sql_text
from (select sql_text,buffer_gets,
dense_rank() over
(order by buffer_gets desc) buffer_gets_rank
from v$sql)
where buffer_gets_rank<=5;
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/kingmaxno1/archive/2009/01/13/3766368.aspx
Ïà¹ØÎĵµ£º
±¾ÎĽéÉÜÁËSQL Server 2008ÀïһЩеÄÌصãÒÔ¼°·¢ÏÖµÄһЩ¾«ÃîÖ®´¦……
¡¡¡¡°²×°
¡¡¡¡SQL
Server
2008µÄÉèÖúͰ²×°Ò²ÓÐËù¸Ä½ø¡£ÅäÖÃÊý¾ÝºÍÒýÇæλÒѾ·Ö¿ªÁË£¬ËùÒÔËüʹ´´½¨»ù±¾µÄδÅäÖÃϵͳµÄ´ÅÅÌͼÏñ±äµÃ¿ÉÄÜÁË£¬Ëüʹ·Ö²¼µ½¶à¸ö·þÎñÆ÷±äµÃ¸üÈÝÒ×ÁË¡£
´Ó΢ÈíµÄÕ¾µãÒ²¿ÉÒÔÕÒµ½°²×°¿ÉÓõÄ×îиüС£ÁíÒ»¸öÌص ......
±¾ÎĽÚÑ¡×ÔMSDNµÄÎÄÕ¡¶ÎåÖÖÌá¸ß SQL ÐÔÄܵķ½·¨¡·£¬Ìá³öÈçºÎÌá¸ß»ùÓÚSQL ServerÓ¦ÓóÌÐòµÄÔËÐÐЧÂÊ£¬·Ç³£ÖµµÃÍƼö¡£¶ÔһЩTrafficºÜ¸ßµÄÓ¦ÓÃϵͳ¶øÑÔ£¬ÈçºÎÌá¸ßºÍ¸Ä½øSQLÖ¸ÁÊǷdz£ÖØÒªµÄ£¬Ò²ÊÇÒ»¸öºÜºÃµÄÍ»ÆƵ㡣
*ÎÄÕÂÖ÷Òª°üÀ¨ÈçÏÂһЩÄÚÈÝ£¨Èç¸ÐÐËȤ£¬ÇëÖ±½Ó·ÃÎÊÏÂÃæµÄURLÔĶÁÍêÕûµÄÖÐÓ¢ÎÄÎĵµ£©£º
1, ´Ó INSE ......
1.sp_helpsort
SELECT SERVERPROPERTY ('Collation')
²é¿´ÄãµÄÅÅÐò¹æÔò.
²»¹ýÄãµÄÕâ¸öÓ¦¸ÃºÍ×Ö·û¼¯ÓйØ.
2.¸ü¸Ä·þÎñÆ÷ÅÅÐò¹æÔò
¸ü¸Ä SQL Server 2005 ʵÀýµÄĬÈÏÅÅÐò¹æÔòµÄ²Ù×÷¿ÉÄÜ»á±È½Ï¸´ÔÓ£¬°üÀ¨ÒÔϲ½Ö裺
È·±£¾ßÓÐÖØд´½¨Óû§Êý¾Ý¿â¼°ÕâЩÊý¾Ý¿âÖеÄËùÓжÔÏóËùÐèµÄÈ«²¿ÐÅÏ¢»ò½Å±¾¡£
ʹÓù¤¾ß£¨ÀýÈç´óÈÝÁ ......
Sql ServerÖеÄÈÕÆÚÓëʱ¼äº¯Êý
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
select dateadd(day,2,'2004-10-15') --·µ»Ø£º2004-10-17 00:00:00.000
......