¹ØÓÚSQLServerËÀËøµÄÕï¶ÏºÍ¶¨Î»
Ô´´ÓÚ2008Äê06ÔÂ18ÈÕ£¬2009Äê10ÔÂ18ÈÕǨÒÆÖÁ´Ë¡£
¹ØÓÚ
SQLServer
ËÀËøµÄÕï¶ÏºÍ¶¨Î»
ÔÚ
SQLServer
Öо³£»á·¢ÉúËÀËøÇé¿ö£¬±ØÐëÁ¬½Óµ½ÆóÒµ¹ÜÀí
Æ÷—
>
¹ÜÀí—
>
µ±Ç°»î¶¯—
>
Ëø
/
½ø³Ì
ID
È¥²éÕÒÏà¹ØËÀËø½ø³ÌºÍ¶¨Î»ËÀËøµÄÔÒò¡£
ITPUB¸öÈË¿Õ¼ä4eD!w!`JD
&h{X!tH{6517
ͨ¹ý²éѯ·ÖÎöÆ÷Ò²Òª¾¹ý¶à¸öϵͳ±í
(sysprocesses,sysobjects
µÈ
)
ºÍϵͳ´æ´¢¹ý³Ì
(sp_who,sp_who2,sp_lock
µÈ
)
£¬¶øÇÒ²»Ò»¶¨Äܹ»Ö±½Ó¶¨Î»µ½¡£
±¾´æ´¢¹ý³Ì²Î¿¼
sp_lock_check
ºÍ
sysprocesses
ϵͳ±í£¬Í¬Ê±ÀûÓÃÁË
DBCC
ÃüÁֱ½Ó½«ËÀËøºÍÔì³ÉËÀËøµÄ½ø³ÌºÍÏà¹ØÓï¾äÁгö£¬ÒÔ·½±ã·ÖÎöºÍ¶¨Î»¡£
ITPUB¸öÈË¿Õ¼ä&g5yR
P5Bt~
ITPUB¸öÈË¿Õ¼äyv?wpH7B
Create procedure sp_check_deadlock
as
set nocount on
/*
selectITPUB¸öÈË¿Õ¼ä6lE|*`f4`\0jE
spid
±»Ëø½ø³Ì
ID,
Mao^#Qz9w~6517
blocked
Ëø½ø³Ì
ID,
2WO+G;a2KSP6517
status
±»Ëø״̬
,
!j0Qzbhx6517
SUBSTRING(SUSER_SNAME(sid),1,30)
±»Ëø½ø³ÌµÇ½ÕʺÅ
,
%i'j/Z;w(G7v3fO)Sf2E6517
SUBSTRING(hostname,1,12)
±»Ëø½ø³ÌÓû§»úÆ÷Ãû³Æ
,ITPUB¸öÈË¿Õ¼ä h9@uU2W&e6eT
SUBSTRING(DB_NAME(dbid),1,10)
±»Ëø½ø³ÌÊý¾ÝÃû³Æ
,
wUX\2o6517
cmd
±»Ëø½ø³ÌÃüÁî
,
U}]fa8x,U?"q
{6517
waittype
±»Ëø½ø³ÌµÈ´ýÀàÐÍ
4[P1M[VM@Y$r6517
from master..sysprocessesITPUB¸öÈË¿Õ¼ä9O2s"OQ*@
WHERE blocked>0ITPUB¸öÈË¿Õ¼ä*PD2C,Z%Giq
-ZVf4d4y/bz6517
--dbcc inputbuffer(66)
Êä³öÏà¹ØËø½ø³ÌµÄÓï¾ä
*/ITPUB¸öÈË¿Õ¼ä_
R~!kt;TW a
-H4HSV1O6517
--
´´½¨Ëø½ø³ÌÁÙʱ±í
CREATE TABLE #templocktracestatus (ITPUB¸öÈË¿Õ¼ä&X7X8Ix8z,` @8~
EventType varchar(100),ITPUB¸öÈË¿Õ¼ämn^V `
Parameters INT,
w'a"r p!G6517
EventInfo varchar(200)
dDM2z&l0A6517
)
ITPUB¸öÈË¿Õ¼äxPuK^ KF5I&o%Y
9d#}g`_y(j6517
--
´´½¨±»Ëø½ø³ÌÁÙʱ±í
CREATE TABLE
Ïà¹ØÎĵµ£º
ÓÉÓÚÒÔÇ°¶¼ÊÇÔÚsqlserver 2005´¦Àí£¬ÏÖÔÚ¿Í»§ÒªÇóoracleÊý¾Ý¿â·þÎñÆ÷£¬
×î³õµÄ´úÂëΪ£º
allRecordSize = (Integer) rs1.getObject(1); //Integer allRecordSize=0;
µ±Ö´ÐеÄʱºò±¨£ºBigDecimalÎÞ·¨×ª»¯ÎªIntegerÀàÐÍ
ΪÁ˼æÈÝÁ½ÕßÐ޸ĺóµÄ´úÂëΪ£º
Object o = rs1.getObject(1);
&nbs ......
SQLSERVER ´óÊý¾ÝÁ¿²åÈëÃüÁ
BULK INSERTÊÇSQLSERVERÖÐÌṩµÄÒ»Ìõ´óÊý¾ÝÁ¿µ¼ÈëµÄÃüÁËüÔËÓÃDTS(SSIS)µ¼ÈëÔÀí£¬¿ÉÒÔ´Ó±¾µØ»òÔ¶³Ì·þÎñÆ÷ÉÏÅúÁ¿µ¼ÈëÊý¾Ý¿â»òÎļþÊý¾Ý¡£ÅúÁ¿²åÈëÊÇÒ»¸ö¶ÀÁ¢µÄ²Ù×÷£¬ÓŵãÊÇЧÂʷdz£¸ß¡£È±µãÊdzöÏÖÎÊÌâºó²»¿ÉÒԻعö¡£
¡¡¡¡BULK INSERTÊÇÓÃÀ´½«ÍⲿÎļþÒÔÒ»ÖÖÌض¨µÄ¸ñʽ¼ÓÔ ......
· ±¾ÎÄÌÖÂÛÁËÈçºÎͨ¹ýTransact-SQLÒÔ¼°ÏµÍ³º¯ÊýOPENDATASOURCEºÍOPENROWSETÔÚͬ¹¹ºÍÒì¹¹Êý¾Ý¿âÖ®¼ä½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬²¢¸ø³öÁËÏêϸµÄÀý×ÓÒÔ¹©²Î¿¼¡£
1. ÔÚSQL ServerÊý¾Ý¿âÖ®¼ä½øÐÐÊý¾Ýµ¼Èëµ¼³ö
(1).ʹÓÃSELECT INTOµ¼³öÊý¾Ý
  ......
SQLserver×Ö·û´®·Ö¸îº¯Êý
Ò»¡¢°´Ö¸¶¨·ûºÅ·Ö¸î×Ö·û´®£¬·µ»Ø·Ö¸îºóµÄÔªËظöÊý£¬·½·¨ºÜ¼òµ¥£¬¾ÍÊÇ¿´×Ö·û´®ÖдæÔÚ¶àÉÙ¸ö·Ö¸ô·ûºÅ£¬È»ºóÔÙ¼ÓÒ»£¬¾ÍÊÇÒªÇóµÄ½á¹û¡£
CREATE function Get_StrArrayLength
(
@str varchar(1024), --Òª·Ö¸îµÄ×Ö·û´®
@split varchar(10) --·Ö¸ô·ûº ......
1.Èç¹ûÏÈprepare ºóÌí¼Ó²ÎÊý£¬ÕâÑùÒ»²¿·ÖÊý¾ÝÀàÐÍ¿ÉÒÔ²»ÓÃÉèÖÃÆäsize´óС£¬ÀýÈçchar
2.Èç¹ûÏÈÌí¼Ó²ÎÊýÔÙprepare£¬¾Í±ØÐëÉèÖòÎÊýµÄÀàÐÍ£¬´óС£¬¾«¶È²ÅÄÜͨ¹ý£¬±ÈÈçchar,varchar,decimalÀàÐÍ£¬¶øint,floatÓй̶¨×Ö½ÚÀàÐ͵ÄÊý¾ÝÀàÐÍÔò¿É²»ÓÃÉèÖôóС¡£
3.¹ØÓÚSqlServerµÄtimestampÀàÐÍ£º¸ÃÀàÐÍΪSqlServerµÄʱ¼ä´ÁÀàÐÍ£¬´´½ ......