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

»ñÈ¡SQL ServerµÄµ±Ç°Á¬½ÓÊý

»ñÈ¡SQL ServerµÄµ±Ç°Á¬½ÓÊý
[ת]http://www.cnblogs.com/confach/archive/2006/05/31/414156.html
Ê×ÏÈÉùÃ÷:Õâ¸öÎÊÌâÎÒûÓнâ¾ö
µ±ÍøÓÑÎʵ½ÎÒÕâ¸öÎÊÌâʱ,ÎÒÒ²»¹ÒÔΪºÜ¼òµ¥,ÒÔΪSQL ServerÓ¦¸ÃÌṩÁ˶ÔÓ¦µÄϵͳ±äÁ¿Ê²Ã´µÄ.µ«Êǵ½Ä¿Ç°ÎªÖ¹,ÎÒ»¹Ã»Óеõ½Ò»¸ö±È½ÏºÃµÄ½â¾ö·½°¸.¿ÉÄܼܺòµ¥,,Ö»²»¹ýÎÒ²»ÖªµÀ°ÕÁË.Ï£ÍûÈç´Ë..
ÏÂÃæÎÒ˵˵Ïà¹ØµÄ֪ʶ°É.Ï£Íû´ó¼Ò¿ÉÒÔ¸ø³öÒ»¸ö±È½ÏºÃµÄ·½·¨.
ÕâÀïÓм¸¸öÓëÖ®Ïà¹ØµÄ¸ÅÄî.
SQL ServerÌṩÁËһЩº¯Êý·µ»ØÁ¬½ÓÖµ(ÕâÀï¿É²»Êǵ±Ç°Á¬½ÓÊýÓ´!),¸öÈ˾õµÃ,ºÜÈÝÒײúÉúÎó½â.
ϵͳ±äÁ¿
@@CONNECTIONS ·µ»Ø×ÔÉÏ´ÎÆô¶¯ Microsoft® SQL Server™ ÒÔÀ´Á¬½Ó»òÊÔͼÁ¬½ÓµÄ´ÎÊý¡£
@@MAX_CONNECTIONS ·µ»Ø Microsoft® SQL Server™ ÉÏÔÊÐíµÄͬʱÓû§Á¬½ÓµÄ×î´óÊý¡£·µ»ØµÄÊý²»±ØΪµ±Ç°ÅäÖõÄÊýÖµ¡£
 
ϵͳ´æ´¢¹ý³Ì
SP_WHO
Ìṩ¹ØÓÚµ±Ç° Microsoft® SQL Server™ Óû§ºÍ½ø³ÌµÄÐÅÏ¢¡£¿ÉÒÔɸѡ·µ»ØµÄÐÅÏ¢£¬ÒÔ±ãÖ»·µ»ØÄÇЩ²»ÊÇ¿ÕÏеĽø³Ì¡£
ÁгöËùÓлµÄÓû§:SP_WHO ‘active’
Áгöij¸öÌض¨Óû§µÄÐÅÏ¢:SP_WHO ‘sa’
 
ϵͳ±í
Sysprocesses
 sysprocesses ±íÖб£´æ¹ØÓÚÔËÐÐÔÚ Microsoft® SQL Server™ ÉϵĽø³ÌµÄÐÅÏ¢¡£ÕâЩ½ø³Ì¿ÉÒÔÊÇ¿Í»§¶Ë½ø³Ì»òϵͳ½ø³Ì¡£sysprocesses Ö»´æ´¢ÔÚ master Êý¾Ý¿âÖС£
Sysperfinfo
°üÀ¨Ò»¸ö Microsoft® SQL Server™ ±íʾ·¨µÄÄÚ²¿ÐÔÄܼÆÊýÆ÷£¬¿Éͨ¹ý Windows NT ÐÔÄܼàÊÓÆ÷ÏÔʾ.
 
ÓÐÈËÌáÒé˵ΪÁË»ñÈ¡SQL ServerµÄµ±Ç°Á¬½ÓÊý:ʹÓÃÈçÏÂSQL:
SELECT COUNT(*) AS CONNECTIONS from master..sysprocesses
¸öÈËÈÏΪ²»¶Ô,¿´¿´.sysprocessesµÄlogin_timeÁоͿɿ´³ö.
ÁíÍâÒ»¸ö·½ÃæÊǽø³Ì²»ÄܺÍÁ¬½ÓÏàÌá²¢ÂÛ,ËûÃÇÊÇÒ»¶ÔÒ»µÄ¹ØϵÂð,Ò²¾ÍÊÇ˵һ¸ö½ø³Ì¾ÍÊÇÒ»¸öÁ¬½Ó?Ò»¸öÁ¬½ÓÓ¦¸ÃÓжà¸ö½ø³ÌµÄ,ËùÒÔÁ¬½ÓºÍ½ø³ÌÖ®¼äµÄ¹ØϵӦ¸ÃÊÇ1:nµÄ.
ÒòΪsysprocessesÁгöµÄ½ø³Ì°üº¬ÁËϵͳ½ø³ÌºÍÓû§½ø³Ì,ΪÁ˵õ½Óû§Á¬½Ó,¿ÉÒÔʹÓÃÈçÏÂSQL:
SELECT cntr_value AS User_Connections from master..sysperfinfo as p
WHERE p.object_name = 'SQLServer:General Statistics' And p.counter_name = 'User Connections'
¸öÈË»¹ÊÇÈÏΪ²»¶Ô,ÒòΪËüÊÇÒ»¸ö¼ÆÊýÆ÷,¿ÉÄÜ»áÀÛ¼ÓµÄ.
»¹ÓÐÒ»ÖÖ·½°¸ÊÇÀûÓÃÈçÏÂSQL:
select connectnum=count(distinct net_address)-1 from master..sysprocesses
ÀíÓÉÊÇnet_addressÊÇ·ÃÎÊÕß»úÆ÷


Ïà¹ØÎĵµ£º

¼¼Çɺ;÷ÇÏ£º·À·¶SQL×¢Èë¹¥»÷

¡¾Ô­ÎĵØÖ·¡¿Tip/Trick: Guard Against SQL Injection Attacks
¡¾Ô­ÎÄ·¢±íÈÕÆÚ¡¿ Saturday, September 30, 2006 9:11 AM
SQL×¢Èë¹¥»÷ÊǷdz£ÁîÈËÌÖÑáµÄ°²È«Â©¶´£¬ÊÇËùÓеÄweb¿ª·¢ÈËÔ±£¬²»¹ÜÊÇʲôƽ̨£¬¼¼Êõ£¬»¹ÊÇÊý¾Ý²ã£¬ÐèҪȷÐÅËûÃÇÀí½âºÍ·ÀÖ¹µÄ¶«Î÷¡£²»ÐÒµÄÊÇ£¬¿ª·¢ÈËÔ±ÍùÍù²»¼¯Öл¨µãʱ¼äÔÚÕâÉÏÃ棬ÒÔÖÁËûÃǵÄÓ¦Ó㬠......

SQL Server 2008ÖеÄ9ÖÖÊý¾ÝÍÚ¾òËã·¨


ÕªÒª£ºSQL Server 2008ÖÐÌṩÁË9ÖÖ³£ÓõÄÊý¾ÝÍÚ¾òËã·¨£¬ÕâЩËã·¨ÓÃÔÚ²»Í¬Êý¾ÝÍÚ¾òµÄÓ¦Óó¡¾°Ï£¬±¾Îľ͸÷¸öËã·¨Öð¸ö·ÖÎöÌÖÂÛ¡£
±êÇ©£ºÊý¾ÝÍÚ¾òËã·¨  SQL Server 2008
1.¾ö²ßÊ÷Ëã·¨
¾ö²ßÊ÷£¬ÓÖ³ÆÅж¨Ê÷£¬ÊÇÒ»ÖÖÀàËƶþ²æÊ÷»ò¶à²æÊ÷µÄÊ÷½á¹¹¡£¾ö²ßÊ÷ÊÇÓÃÑù±¾µÄÊôÐÔ×÷Ϊ½áµã£¬ÓÃÊôÐÔµÄÈ¡Öµ×÷Ϊ·ÖÖ§£¬Ò²¾ÍÊÇÀàËÆÁ ......

SQL Server²éѯËٶȻºÂý½â¾ö°ì·¨(2)

ÔÚT-sqlµÄд·¨ÉÏÓкܴóµÄ½²¾¿£¬ÏÂÃæÁгö³£¼ûµÄÒªµã£ºÊ×ÏÈ£¬DBMS´¦Àí²éѯ¼Æ»®µÄ¹ý³ÌÊÇÕâÑùµÄ£º
1¡¢²éѯÓï¾äµÄ´Ê·¨¡¢Óï·¨¼ì²é
2¡¢½«Óï¾äÌá½»¸øDBMSµÄ²éѯÓÅ»¯Æ÷
3¡¢ÓÅ»¯Æ÷×ö´úÊýÓÅ»¯ºÍ´æȡ·¾¶µÄÓÅ»¯
4¡¢ÓÉÔ¤±àÒëÄ£¿éÉú³É²éѯ¹æ»®
5¡¢È»ºóÔÚºÏÊʵÄʱ¼äÌá½»¸øϵͳ´¦ÀíÖ´ÐÐ
6¡¢×îºó½«Ö´Ðнá¹û·µ»Ø¸øÓû§¡£
Æä´Î£¬¿´Ò»ÏÂS ......

³£ÓõÄORACLE PL/SQL¹ÜÀíÃüÁîÒ»

Ô­ÎÄ£ºÁõÎä| ³£ÓõÄORACLE PL/SQL¹ÜÀíÃüÁîÒ»
ÊìϤORACLE¹ÜÀíµÄÒ»¶¨¶ÔÕâЩÃüÁî²»»áÄ°Éú£¬²»¹ý¶ÔÓÚÎÒÕâ¸ö¸Õ½Ó´¥ORACLE¹ÜÀíµÄÀ´Ëµ£¬»¹ÊÇÓбØÒª×öϼǼ£¬ÒÔ±ãËæʱ²é¿´¡£
Ò» µÇ¼SQLPLUS
sqlplus Óû§Ãû/ÃÜÂë@Êý¾Ý¿âʵÀý as µÇ¼½ÇÉ«;
Èç:Óû§sys(ÃÜÂëΪ123)ÒÔsysdbaµÄ½ÇÉ«µÇ¼Êý¾Ý¿âORACL£¬ÎÒÃÇ¿ÉÒÔÊäÈ룺sqlplus sy ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ