SQL ServerÊý¾Ý¿âËéƬ
µ±Ë÷ÒýËùÔÚÒ³ÃæµÄ»ùÓÚÖ÷¹Ø¼ü×ÖµÄÂ߼˳Ðò£¬ºÍÊý¾ÝÎļþÖеÄÎïÀí˳Ðò²»Æ¥Åäʱ£¬ËéƬ¾Í²úÉúÁË¡£ËùÓеÄÒ¶¼¶Ò³°üº¬ÁËÖ¸ÏòÇ°Ò»¸öºÍºóÒ»¸öÒ³µÄÖ¸Õë¡£ÕâÑù¾Í
ÐγÉÒ»¸öË«Á´±í¡£ÀíÏëÇé¿öÏ£¬Êý¾ÝÎļþÖÐÒ³µÄÎïÀí˳Ðò»áºÍÂ߼˳ÐòÆ¥Åä¡£Õû¸ö´ÅÅ̵Ť×÷ÐÔÄÜÔÚÎïÀí˳ÐòÆ¥ÅäÂ߼˳Ðòʱ½«ÏÔÖøÌáÉý¡£¶ÔijЩÌض¨µÄ²éѯ¶øÑÔ£¬
Õ⽫´øÀ´¼«¼ÑµÄÐÔÄÜ¡£µ±ÎïÀíÅÅÐòºÍÂß¼ÅÅÐò²»Æ¥Åäʱ£¬´ÅÅ̵Ť×÷ÐÔÄÜ»á±äµÃµÍЧ£¬ÕâÊÇÒòΪ´ÅÍ·±ØÐëÏòÇ°ºÍÏòºóÒƶ¯À´²éÕÒË÷Òý£¬¶ø²»ÊÇÖ»Ïóij¸öµ¥Ò»·½ÏòÀ´ËÑ
Ë÷¡£ËéƬ»áÓ°ÏìI/OÐÔÄÜ£¬²»¹ý¶ÔÓÚλÓÚSQL ServerÊý¾Ý»º³åÄÚµÄÊý¾ÝÒ³¶øÑÔ£¬ËéƬ²¢²»»á´øÀ´ÈκÎÓ°Ïì¡£
ÔÚË÷ÒýËéƬÕûÀíÇ°£¬ÇëÈ·±£ÏµÍ³×ÊÔ´µÄһЩÎÊÌ⣬±ÈÈçÎïÀí´ÅÅÌËéƬ£¬²»ºÏÀíµÄ»ù´¡½á¹¹µÈÒòËØ»á¸øÐÔÄÜ´øÀ´¸ºÃæÓ°Ï죬²Î¿´KB935089£ºÊ¹Óà Defrag ¹ÜÀíÆ÷¿ÉÒÔ such as Exchange Server »ò SQL Server Êý¾Ý¿â·þÎñÆ÷µÄ¾í½øÐÐËéƬÕûÀí
¡£
DBCC SHOWCONTIGÊÇÏÔʾָ¶¨µÄ±íµÄÊý¾ÝºÍË÷ÒýµÄËéƬÐÅÏ¢¡£µ±ÔËÐиÃÃüÁîʱ£¬ÒªÌرð×¢ÒâÂß¼ËéƬ(Logical Fragmentation)ºÍÒ³ÃܶÈ(Page Density)Á½¸öÖ¸±ê¡£
Page Scanned-ɨÃèÒ³Êý£º
Èç¹ûÄãÖªµÀÐеĽüËƳߴçºÍ±í»òË÷ÒýÀïµÄÐÐÊý£¬ÄÇôÄã¿ÉÒÔ¹À¼Æ³öË÷ÒýÀïµÄÒ³Êý¡£¿´¿´É¨ÃèÒ³Êý£¬Èç¹ûÃ÷ÏÔ±ÈÄã¹À¼ÆµÄÒ³ÊýÒª¸ß£¬ËµÃ÷´æÔÚÄÚ²¿ËéƬ¡£
Extents Scanned-ɨÃèÀ©Õ¹ÅÌÇøÊý£º
ÓÃɨÃèÒ³Êý³ýÒÔ8,ËÄÉáÎåÈëµ½ÏÂÒ»¸ö×î¸ßÖµ¡£¸ÃÖµÓ¦¸ÃºÍDBCC SHOWCONTIG·µ»ØµÄɨÃèÀ©Õ¹ÅÌÇøÊýÒ»Ö¡£Èç¹ûDBCC SHOWCONTIG·µ»ØµÄÊý¸ß£¬ËµÃ÷´æÔÚÍⲿËéƬ¡£ËéƬµÄÑÏÖس̶ÈÒÀÀµÓÚ¸Õ²ÅÏÔʾµÄÖµ±È¹À¼ÆÖµ¸ß¶àÉÙ¡£
Extent Switches-À©Õ¹ÅÌÇø¿ª¹ØÊý£º
¸ÃÊýÓ¦¸ÃµÈÓÚɨÃèÀ©Õ¹ÅÌÇøÊý¼õ1¡£¸ßÁËÔò˵Ã÷ÓÐÍⲿËéƬ¡£
Avg. Pages per Extent-ÿ¸öÀ©Õ¹ÅÌÇøÉϵÄƽ¾ùÒ³Êý£º
¸ÃÊýÊÇɨÃèÒ³Êý³ýÒÔɨÃèÀ©Õ¹ÅÌÇøÊý£¬Ò»°ãÊÇ8¡£Ð¡ÓÚ8˵Ã÷ÓÐÍⲿËéƬ¡£
Scan Density [Best Count:Actual Count]-ɨÃèÃܶȣÛ×î¼ÑÖµ
:ʵ¼ÊÖµ£Ý£º
DBCC SHOWCONTIG·µ»Ø×îÓÐÓõÄÒ»¸ö°Ù·Ö±È¡£ÕâÊÇÀ©Õ¹ÅÌÇøµÄ×î¼ÑÖµºÍʵ¼ÊÖµµÄ±ÈÂÊ¡£¸Ã°Ù·Ö±ÈÓ¦¸Ã¾¡¿ÉÄÜ¿¿½ü100£¥¡£µÍÁËÔò˵Ã÷ÓÐÍⲿËéƬ¡£
Logical Scan Fragmentation-Â߼ɨÃèËéƬ£º
ÎÞÐòÒ³µÄ°Ù·Ö±È¡£¸Ã°Ù·Ö±ÈÓ¦¸ÃÔÚ0£¥µ½10£¥Ö®¼ä£¬¸ßÁËÔò˵Ã÷ÓÐÍⲿËéƬ¡£
Extent Scan Fragmentation-À©Õ¹ÅÌÇøɨÃèËéƬ£º
ÎÞÐòÀ©Õ¹ÅÌÇøÔÚɨÃèË÷ÒýÒ¶¼¶Ò³ÖÐËùÕ¼µÄ°Ù·Ö±È¡£¸Ã°Ù·Ö±ÈÓ¦¸ÃÊÇ0£¥£¬¸ßÁËÔò˵Ã÷ÓÐÍⲿËéƬ¡£
Avg. Bytes Free per Page-ÿҳÉϵÄƽ¾ù¿ÉÓÃ×Ö½ÚÊý£º
ËùɨÃèµÄÒ³ÉϵÄƽ¾ù
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
CREATE FUNCTION [dbo].[f_num_chn] (@num numeric(14,2))
RETURNS varchar(100) WITH ENCRYPTION --¼ÓÃÜ
AS
BEGIN
--°æȨËùÓУºpbsql
DECLARE @n_data VARCHAR(20),@c_data VARCHAR(100),@n_str VARCHAR(10),@i int
SET @n_data=RIGHT(SPACE(14)+CAST(CAST(ABS(@num*100) AS bigint) AS varchar(20)), ......
SQLÓï¾äÓÅ»¯¼¼Êõ·ÖÎö
·Ò룺Jerry [2005-11-11]
ÔÎijö´¦£ºhttp://www.51testing.com
ÔÎÄ×÷Õߣº²»Ïê
תÔØÇë×¢Ã÷£ºÀ´×ÔSawinϵͳ·ÖÎöÖ®´°
²Ù×÷·ûÓÅ»¯
IN ²Ù×÷·û
ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵ģ¬´ÓORACLEÖ´ÐеIJ½ÖèÀ´·ÖÎöÓÃI ......
insert into mysql.user
SELECT '%', 'admin', PASSWORD('admin'), Select_priv, Insert_priv, Update_priv,
Delete_priv, Create_priv, Drop_priv, Reload_priv,
Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv,
Index_priv, Alter_priv, Show_db_priv, Super_priv, ......
×î½üÔÚºÍÒ»¸ö¹«Ë¾ºÏ×÷ÏîÄ¿£¬Óв¿·ÖÁ´½ÓÊÇÓÉËûÃǹ«Ë¾ÌṩµÄ£¬ÓÉÓÚµ±Ê±»¹Ã»ÓÐÉêÇëÓòÃû£¬Ö±½ÓÌṩ¸øÎÒÃǵÄÊÇipµØÖ·£¬ÏÖÔÚÕýʽÉÏÏߺó£¬ÐèÒªÎÒÃǽ«ÔÀ´µÄipµØÖ·Ì滻ΪÓòÃû£¬Èç¹ûÒ»¸ö¸öÌæ»»ÆðÀ´ÌرðÂé·³£¬¶øÇÒ¿ÉÄܳöÏÖÎÊÌ⣬Òò´ËÕÒÁËÏÂoracleÖÐsqlÅúÁ¿Ìæ»»µÄ¹¦ÄÜ£¬Ê¹ÓÃÆðÀ´Ì«·½±ãÁË£¬ÔÚÕâÀï¼Ç¼Ï£¬±ãÓÚÒÔºó²éÕÒ¡£¾ßÌåʹÓÃ˵Ã÷ÈçÏ ......