sql ±¸·ÝºÍɾ³ý
±¸·Ý
DECLARE @strPath NVARCHAR(200)
set @strPath = convert(NVARCHAR,getdate(),120)
set @strPath='hq'+rtrim(left(replace(@strPath,'-',''),8))
set @strPath = 'D:\sqlback\mydb\' + @strPath + '.bak'
BACKUP DATABASE [mydb] TO DISK = @strPath WITH NOFORMAT, NOINIT, NAME = N'mydb-ÍêÕû Êý¾Ý¿â ±¸·Ý', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
ɾ³ý
declare @date nvarchar(20)
set @date=convert(nvarchar,dateadd(d,-1,getdate()),120)
EXECUTE master.dbo.xp_delete_file 0,N'D:\sqlback\mydb',N'bak',@date
Ïà¹ØÎĵµ£º
ÆäʵÔÚÐÞ¸ÄÊý¾Ý¿âÃû³Æ֮ǰ£¬Èç¹ûÓÐÓû§Á¬½Óµ½Êý¾Ý¿âµÄ»°»áÔì³ÉÊý¾Ý¿âÖØÃüÃûʧ°Ü£¬¿ÉÒÔÏÈÖ´ÐÐ
select spid
from master.dbo.sysprocesses
where dbid=db_id('OldDbName')
½á¹û¼¯ÖÐÏÔʾµÄÊǵ±Ç°Á¬½Óµ½Êý¾Ý¿âOldDbNameµÄÁ¬½Ó
±ÈÈç½á¹ûÊÇ
79
81
µ±È»£¬Êµ¼ÊÖµÓ¦¸Ã²»ÊÇÕâÁ½¸ö
È»ºóÖ´ÐÐ
kill 79
kill 81
¹Ø±ÕÒѽ¨Á¢ ......
Êý¾Ý´¦ÀíÊǵ±Ç°Êý¾Ý¿â³£¼ûµÄÓ¦Óá£Ò»Ð©Êý¾Ý¿â×é³ÉDATA mart´ÓÊý¾ÝÔ´Àï³éÈ¡¹ØÐĵıí½øÐоۺϣ¬½«½á¹ûÍÆË͵½Ëã·¨ÖнøÐд¦Àí£¬´Ó¶ø¸ßÐÔÄܵĻشðÓû§µÄ²éѯ¡£
×ÜËùÖÜÖª£¬LogÎļþÊǼǼÊý¾Ý¿â²Ù×÷µÄÎļþ£¬¶ÔÊý¾Ý¿âµÄÍêÕûÐÔ£¬Ò»ÖÂÐÔÓÐ×ÅÖØÒªµÄÒâÒå¡£×÷ΪÊý¾Ý´¦ÀíµÄÒ»¸ö³£¼ûºó¹ûÊÇLogÎļþµÄ³¬¼¶ÅÓ´ó¡£ËäÈ»½«Êý¾Ý¿âµÄ»Ö¸´Ä£Ê½ÉèÖó ......
CLR¿ÉÒÔʵÏÖDMLºÍDDLÁ½ÖÖ´¥·¢ÐÎʽ£¬µ«ÊDZ¾ÈËÒ»°ã²»½¨ÒéʹÓÃCLRµÄ´¥·¢Æ÷£¬Ö÷ÒªÊÇ¿¼Âǵ½Ð§ÂÊÎÊÌâ¡£±ÈÈçÎÒÃÇʹÓÃtriggerÀ´ÊµÏÖ·¢mailµÈ²Ù×÷ʱ£¬¾ÍÒª¿¼ÂÇpop3»òÊÇsmtpµÈ´ýʱ¼ä£¬ÒòΪtrigger±¾Ê¾ÍÊǸöÊÂÎñ£¬Ò²¾ÍÊÇ˵£¬ÔÚsmtpµÈ´ýʱ¼äÒ²ËãÔÚÁËÕû¸öÊÂÎñÖУ¬ÕâÑù¾Í»á´ó´óÓ°ÏìЧÂÊ¡£
1.CLR DML´¥·¢Æ÷
DMLÖ¸µÄÊÇÊý¾Ý²Ù×÷ÓïÑÔ£¬Ò²¾Í ......
ÔÚÎÒÃǵÄÈÕ³£±à³ÌÖУ¬Êý¾Ý¿âµÄ³ÌÐò»ù±¾É϶¼ÒªÓëSQLÓï¾ä´ò½»µÀ£¬SQLÓï¾äµÄ±àд²»¿É±ÜÃâµÄ³ÉΪһ¸öÍ·Ì۵Ť×÷¡£ÇÒÒòΪSQLÓï¾äÊÇSTRINGÀàÐÍ£¬Òò´ËÔÚ±àÒë½×¶Î²é²»³ö´í£¬Ö»Óе½ÔËÐÐʱ²ÅÄÜ·¢ÏÖ´íÎó¡£
±¾ÎĵĽâ¾ö·½°¸£¬Í¨¹ý×Ô¶¯Éú³ÉSQLÓï¾ä£¬ÔÚÒ»¶¨³Ì¶ÈÉϽµµÍ³ö´íµÄ¸ÅÂÊ£¬´Ó¶øÌá¸ß±à³ÌЧÂÊ¡£ public int ......
--> Title : SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ
--> Author : wufeng4552
--> Date : 2009-11-11
SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ
(Ò»)¸ÅÄî:
·Ö²¼Ê½ÊÂÎñÊÇÉæ¼°À´×ÔÁ½¸ö»ò¶à¸öÔ´µÄ×ÊÔ´µÄÊÂÎñ¡£Microsoft® SQL Server™ 2000Ö§³Ö·Ö²¼Ê½ÊÂÎñ£¬Ê¹Óû§µÃÒÔ´´½¨ÊÂÎñÀ´¸üжà¸öSQL ServerÊý¾Ý¿âºÍÆäËüÊý¾ÝÔ ......