SQL Server ErrorLog
תÖÁhttp://mbtk.blog.sohu.com/150003773.html £¬²¢²¹³äһЩÏà¹Ø֪ʶ¡£
DBCC ErrorLog £ºÈç¹ûºÜÉÙÖØÆðmssqlserver·þÎñ£¬ÄÇô·þÎñÆ÷µÄÈÕÖ¾»áÔö³¤µÃºÜ¿ì£¬¶øÇÒ´ò¿ªºÍ²é¿´ÈÕÖ¾µÄËÙ¶ÈÒ²»áºÜÂý¡£Ê¹ÓÃÕâ¸öÃüÁ¿ÉÒԽضϵ±Ç°µÄ·þÎñÆ÷ÈÕÖ¾£¬Ö÷ÒªÊÇÉú³ÉÒ»¸öеÄÈÕÖ¾¡£¿ÉÒÔ¿¼ÂÇÉèÖÃÒ»¸öµ÷¶ÈÈÎÎñ£¬Ã¿ÖÜÖ´ÐÐÕâ¸öÃüÁî×Ô¶¯½Ø¶Ï·þÎñÆ÷ÈÕÖ¾¡£Ê¹Óô洢¹ý³Ìsp_cycle_errorlogÒ²¿ÉÒԴﵽͬÑùµÄÄ¿µÄ¡£
ĬÈÏÇé¿öÏ£¬SQL Server ±£´æ 7 ¸ö ErrorLog Îļþ£¬ÃûΪ£º
ErrorLog
ErrorLog.1
ErrorLog.2
ErrorLog.3
ErrorLog.4
ErrorLog.5
ErrorLog.6
ÔÚ APACS OS °æ±¾ 6.1 ÖУ¬ErrorLog Îļþ±£´æÔÚ c:\Program Files\Microsoft SQL Server\MSSQL$WINCC\LOG Îļþ¼ÐÖС£
ÔÚ APACS OS °æ±¾ 7.0 ÖУ¬ErrorLog Îļþ±£´æÔÚ c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG Îļþ¼ÐÖС£
ErrorLog Îļþ°üº¬×îÐÂÐÅÏ¢£»ErrorLog.6 Îļþ°üº¬×îÀϵÄÐÅÏ¢¡£Ã¿´ÎÖØÆô¶¯ SQL Server ʱ£¬ÕâЩÈÕÖ¾Îļþ¶¼ÈçÏÂÑ»·£º
ɾ³ý ErrorLog.6 ÎļþÖеÄËùÓÐÊý¾Ý£¬²¢´´½¨Ò»¸öÐ嵀 ErrorLog Îļþ¡£
Éϸö ErrorLog ÎļþÖеÄËùÓÐÊý¾Ý±»Ð´Èëµ½ ErrorLog.1 ÎļþÖС£
Éϸö ErrorLog.1 ÎļþÖеÄËùÓÐÊý¾Ý±»Ð´Èëµ½ ErrorLog.2 ÎļþÖС£
Éϸö ErrorLog.2 ÎļþÖеÄËùÓÐÊý¾Ý±»Ð´Èëµ½ ErrorLog.3 ÎļþÖС£
Éϸö ErrorLog.3 ÎļþÖеÄËùÓÐÊý¾Ý±»Ð´Èëµ½ ErrorLog.4 ÎļþÖС£
Éϸö ErrorLog.4 ÎļþÖеÄËùÓÐÊý¾Ý±»Ð´Èëµ½ ErrorLog.5 ÎļþÖС£
Éϸö ErrorLog.5 ÎļþÖеÄËùÓÐÊý¾Ý±»Ð´Èëµ½ ErrorLog.6 ÎļþÖС£
Èç¹ûÆäÖÐÒ»¸ö ErrorLog ÎļþÒѺܴó£¬Ôò¿Éͨ¹ýÔËÐÐ sp_cycle_errorlog ´æ´¢¹ý³ÌÊÖ¶¯Ñ»·ÕâЩ ErrorLog Îļþ¡£×¢ÒâÊÂÏ¾ÉµÄ ErrorLog ÎļþÖеÄÊý¾Ý½«±»¸²¸Ç£¡Èç¹û±ØÐë±£´æ¾ÉµÄ ErrorLog ÎļþÖеÄÊý¾Ý£¬Ôò¿É½«ÕâЩ¾ÉµÄ ErrorLog Îļþ¸´ÖƵ½Ä³¸öÍⲿ´æ´¢½éÖÊÖС£
ÔÚ APACS OS °æ±¾ 6.1 ÖУ¬¿ÉÀûÓà SQL Query Analyzer Tool ´Ó SQL Server Enterprise Manager ÔËÐÐ sp_cycle_errorlog ´æ´¢¹ý³Ì¡£ÔÚ APACS OS °æ±¾ 7.0 ÖУ¬¿É´Ó SQL Server Management Studio ÔËÐÐ sp_cycle_errorlog ´æ´¢¹ý³Ì¡£
ËùÒÔÐèÒª¶¨ÆÚÄÜÇл»Ð´Èëerror log . Ò»°ã¿ÉÒÔʹÓÃDBCC errorlogÃüÁîÀ´²Ù×÷ ¡£
Exec('DBCC ErrorLog')
»òÕß¿ÉÒÔͨ¹ýÒÔÏÂÃüÁ½«sp ·ÅÔÚJobÖж¨ÆÚÖ´ÐС£
create procedure sp_cycle_errorlog
if (not (is_srvrol
Ïà¹ØÎĵµ£º
1. ¸´ÖƱí½á¹¹
Sql´úÂë
1. select * into B from A where 1=0;
select * into B from A where 1=0;
2.¸´ÖƱí¼Ç¼ ¸´ÖÆijЩ×Ö¶Î
Sql´úÂë
1. insert into B(a, b, c) select d, e, f from A;
insert into B(a, b, c) select d, e, f from A;
¸´Ö ......
×òÍí£¬µ½Î¢Èí¹Ù·½ÏÂÁËÒ»¸ö32°æ±¾µÄTrial°æ±¾¡£ÎļþÃûΪSQLFULL_x86_ENU.exe¡£Îļþ´óСΪ1.30G×óÓÒ¡£ÒòΪֻÓÐ32λһ¸ö°æ
±¾£¬±ÈSQL Server 2008ÄǸö3GµÄҪС¶àÁË¡£ºÇºÇ¡£
http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.aspx
ÏÂ
ÔØÍê³Éºó£¬ÏÈжÔØÔÀ´µÄSQL Server 2008¡¡sp2,½á¹ûÕûÕûÔËÐÐÁËÁ½¸ ......
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [±í ......
ÕâÊÇCSDNÂÛ̳ÀïÃæµÄÒ»¸öÌû×Ó£¬×÷ÕßÊÇ°®Ð¾õÂÞ.ع»ª¡£¸Ð¾õ±È½ÏÈ«Ã棬¾ÍÕûÀíÏÂÀ´ÁË£¬Áô×÷ÒÔºó²Î¿¼±¸Óá£ÔÚ´Ë£¬Ôڴ˸Ðл±¾ÎĵÄ×÷Õß¡£
/*
±êÌ⣺һ¸öÏîÄ¿Éæ¼°µ½µÄ50¸öSqlÓï¾ä(ÕûÀí°æ)
×÷Õߣº°®Ð¾õÂÞ.ع»ª(Ê®°ËÄê·çÓ꣬ÊصñùɽѩÁ«»¨¿ª)
ʱ¼ä£º2010-05-10
µØµã£ºÖØÇ캽ÌìְҵѧԺ
˵Ã÷£ºÒÔÏÂÎåÊ®¸öÓï¾ä¶¼°´ÕÕ²âÊÔÊý¾Ý½øÐ ......
Ò»¡¢Ô¼Êø
Ô¼Êø¶¨Òå¹ØÓÚÁÐÖÐÔÊÐíÖµµÄ¹æÔò£¬ÊÇÇ¿ÖÆÍêÕûÐԵıê×¼»úÖÆ¡£
ʹÓÃÔ¼ÊøÓÅÏÈÓÚʹÓô¥·¢Æ÷¡¢¹æÔòºÍĬÈÏÖµ¡£²éѯÓÅ»¯Æ÷ҲʹÓÃÔ¼Êø¶¨ÒåÉú³É¸ßÐÔÄܵIJéѯִÐмƻ®¡£SQL Server 2005Ö§³ÖÎåÀàÔ¼Êø£º
1. NOT ......