pl plusÖ´Ðб¾µØµÄsqlÎļþÖеÄsqlÓï¾ä
¹¦ÄÜ£ºpl plusÖ´Ðб¾µØµÄsqlÎļþÖеÄsqlÓï¾ä
˵Ã÷£º±ÈÈ磺e:\zhaozhenlongÏÂÓÐcreate_table.sqlÎļþ£¬Ôò°´ÈçÏ·½·¨Ö´ÐУº
²½Ö裺
1¡¢ÔÚpl plusµÄ windowÏ£¬
2¡¢Ö´ÐУº
@e:\zhaozhenlong\drop_table.sql
@e:\zhaozhenlong\create_table.sql
Ïà¹ØÎĵµ£º
drop table #t
create table #t(req_spid int,obj_name sysname)
declare @s nvarchar(4000)
,@rid int,@dbname sysname,@id int,@objname sysnam ......
´ÓÕâÒ»½Ú¿ªÊ¼ÄØ£¬ÎÒÃǾÍÒª¿ªÊ¼CLRµÄ±à³ÌÖ®ÂÃÁË¡£ÔÚÕâ֮ǰ£¬ÎÒÏȰѱ¾½ÚÖÐÐèÒªÁ˽âµÄÁ½¸öÐÂÀàSqlDataRecordºÍSqlMetaData£¬¼°Îå¸öз½·¨SqlContext.Pipe.SendResultsStart£¬SqlContext.Pipe.SendResultsRow£¬SqlContext.Pipe.SendResultsEnd£¬SqlContext.Pipe.SendºÍSqlContext.Pipe.ExecuteAndSend½øÐÐһϱØÒªµÄ˵Ã÷£¬·½±ã´ ......
Ò»¡¢±íµÄµ¼Èëµ¼³öÓï¾ä¼°Ê±¼ä×Ö·û´®²¿·Ö´¦Àíº¯Êý
µ¼³öÊý¾Ý¿âËùÓбíµÄ½á¹¹ mysqldump -uroot -proot db_name -d > d:/export_db.sql(½áβ²»Ó÷ֺÅ)
µ¼³öÊý¾Ý¿âij¸ö±íµÄ½á¹¹ mysqldump -uroot -proot db_n ......
µ½½ñÌìΪֹ£¬ÈËÃǶԹØϵÊý¾Ý¿â×öÁË´óÁ¿µÄÑо¿£¬²¢¿ª·¢³ö¹ØϵÊý¾ÝÓïÑÔ£¬Îª²Ù×÷¹ØϵÊý¾Ý¿âÌṩÁË·½±ãµÄÓû§½Ó¿Ú¡£¹ØϵÊý¾ÝÓïÑÔÄ¿Ç°Óм¸Ê®ÖÖ£¬¾ßÓÐÔö¼Ó¡¢É¾³ý¡¢Ð޸ġ¢²éѯ¡¢Êý¾Ý¶¨ÒåÓë¿ØÖƵÈÍêÕûµÄÊý¾Ý¿â²Ù×÷¹¦ÄÜ¡£Í¨³£°ÑËüÃÇ·ÖΪÁ½Àࣺ¹Øϵ´úÊýÀàºÍ¹ØϵÑÝËãÀà¡£
ÔÚÕâЩÓïÑÔÖУ¬½á¹¹»¯²éѯÓïÑÔSQLÒÔÆäÇ¿´óµÄÊý¾Ý¿â²Ù× ......
ת×Ôhttp://www.111cn.cn/database/109/b992816b1dddbb641c25c0999883427e.htm
declare @text nvarchar(max);
with tb
as
(
select blocking_session_id,
session_id,db_name(database_id) as dbname,text from master.sys.dm_exec_requests a
CROSS APPLY master.sys.dm_exec_sql_text(a.sql_handle)
),
tb1 a ......