ÈçºÎ»Ö¸´MS SQLÊý¾Ý¿âµÄMDFÎļþ
參¿¼: http://blog.sina.com.cn/s/blog_59b11d010100af1n.html
ÈçºÎ»Ö¸´/ÐÞ¸´MS SQLÊý¾Ý¿âµÄMDFÎļþ
Èç¹û±¸·ÝµÄÊý¾Ý¿âÓÐ2¸öÎļþ£¬·Ö±ðÊÇ.LDF ºÍ .MDF£¬´ò¿ªÆóÒµ¹ÜÀíÆ÷£¬ÔÚʵÀýÉÏÓÒ»÷---ËùÓÐÈÎÎñ--¸½¼ÓÊý¾Ý¿â£¬È»ºóÑ¡ÔñÄǸö.MDFÎļþ£¬¾Í¿ÉÒÔÁË¡£
¡¡¡¡»òÕßÔÚ²éѯ·ÖÎöÆ÷ÖÐÊäÈ룺
¡¡¡¡sp_attach_db "Êý¾Ý¿âÃû³Æ","·¾¶\ÎļþÃû.ldf","·¾¶\ÎļþÃû.MDF"
¡¡¡¡SQL ServerÊý¾Ý¿â±¸·ÝÓÐÁ½ÖÖ·½Ê½£¬Ò»ÖÖÊÇʹÓÃBACKUP DATABASE½«Êý¾Ý¿âÎļþ±¸·Ý³öÈ¥£¬ÁíÍâÒ»ÖÖ¾ÍÊÇÖ±½Ó¿½±´Êý¾Ý¿âÎļþmdfºÍÈÕÖ¾ÎļþldfµÄ·½Ê½¡£ÏÂÃ潫Ö÷ÒªÌÖÂÛһϺóÕߵı¸·ÝÓë»Ö¸´¡£±¾Îļٶ¨ÄúÄÜÊìÁ·Ê¹ÓÃSQL Server Enterprise Manager(SQL ServerÆóÒµ¹ÜÀíÆ÷)ºÍSQL Server Quwey Analyser(SQL Server²éѯ·ÖÎöÆ÷)
¡¡¡¡1¡¢Õý³£µÄ±¸·Ý¡¢»Ö¸´·½Ê½
¡¡¡¡Õý³£·½Ê½Ï£¬ÎÒÃÇÒª±¸·ÝÒ»¸öÊý¾Ý¿â£¬Ê×ÏÈÒªÏȽ«¸ÃÊý¾Ý¿â´ÓÔËÐеÄÊý¾Ý·þÎñÆ÷ÖжϿª£¬»òÕßÍ£µôÕû¸öÊý¾Ý¿â·þÎñÆ÷£¬È»ºó¸´ÖÆÎļþ¡£
¡¡¡¡Ð¶ÏÂÊý¾Ý¿âµÄÃüÁSp_detach_db Êý¾Ý¿âÃû
¡¡¡¡Á¬½ÓÊý¾Ý¿âµÄÃüÁSp_attach_db»òÕßsp_attach_single_file_db
¡¡¡¡s_attach_db [@dbname =] 'dbname', [@filename1 =] 'filename_n' [,...16]
¡¡¡¡sp_attach_single_file_db [@dbname =] 'dbname', [@physname =] 'physical_name'
¡¡¡¡Ê¹Óô˷½·¨¿ÉÒÔÕýÈ·»Ö¸´SQL Sever7.0ºÍSQL Server 2000µÄÊý¾Ý¿âÎļþ£¬ÒªµãÊDZ¸·ÝµÄʱºòÒ»¶¨Òª½«mdfºÍldfÁ½¸öÎļþ¶¼±¸·ÝÏÂÀ´£¬mdfÎļþÊÇÊý¾Ý¿âÊý¾ÝÎļþ£¬ldfÊÇÊý¾Ý¿âÈÕÖ¾Îļþ¡£
¡¡¡¡Àý×Ó£º
¡¡¡¡¼ÙÉèÊý¾Ý¿âΪtest£¬ÆäÊý¾ÝÎļþΪtest_data.mdf£¬ÈÕÖ¾ÎļþΪtest_log.ldf¡£ÏÂÃæÎÒÃÇÌÖÂÛÒ»ÏÂÈçºÎ±¸·Ý¡¢»Ö¸´¸ÃÊý¾Ý¿â¡£
¡¡¡¡Ð¶ÏÂÊý¾Ý¿â£ºsp_detach_db 'test'
¡¡¡¡Á¬½ÓÊý¾Ý¿â£ºsp_attach_db 'test','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_data.mdf','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_log.ldf'
¡¡¡¡sp_attach_single_file_db 'test','C:\Program Files\Microsoft SQL Server\MSSQL\Data\test_data.mdf'
¡¡¡¡// ±¾ÎÄת×Ô C++Builder Ñо¿ - http://www.ccrun.com/article.asp?i=986&d=oxit07
¡¡¡¡2¡¢Ö»ÓÐmdfÎļþµÄ»Ö¸´¼¼Êõ
¡¡¡¡ÓÉÓÚÖÖÖÖÔÒò£¬ÎÒÃÇÈç¹ûµ±Ê±½ö½ö±¸·ÝÁËmdfÎļþ£¬ÄÇô»Ö¸´ÆðÀ´¾ÍÊÇÒ»¼þºÜÂé·³µÄÊÂÇéÁË¡£
¡¡¡¡Èç¹ûÄúµÄmdfÎļþÊǵ±Ç°Êý¾Ý¿â²úÉúµÄ£¬ÄÇôºÜ½ÄÐÒ£¬Ò²ÐíÄãʹÓÃsp_attach_db»òÕßsp_attach_single_file_db¿ÉÒÔ»Ö¸´Êý¾Ý¿â£¬µ«ÊÇ»á³öÏÖÀàËÆÏÂÃæµÄÌáʾÐ
Ïà¹ØÎĵµ£º
OracleÖеĵݹé²éѯ¿ÉÒÔÒÀ¿¿ÔöÇ¿µÄsqlÓï¾äSTART WITH ...CONNECT BY PRIORÀ´¸ã¶¨.sql 2005Öв»Ö§³Ö¸ÃÓï¾ä,ÒÔÏÂʾÀý¿ÉÒÔʵÏֵݹé²éѯ.
WITH TREE(xzdm,Prexzdm,lvl,topxzdm)
AS
(
SELECT xzdm,prexzdm,1,prexzdm as topxzdm from xzdm WHERE Prexzdm = '000000000000'
&nbs ......
MMC ²»ÄÜ´ò¿ªÎļþ C:\Program Files\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC¡£¿ÉÒÔÔÒòÊÇÎļþ²»´æÔÚ£¬²»ÊÇÒ»¸öMMC¿ØÖÆ̨£¬»òÕßÓúóÀ´MMC°æ±¾´´½¨£¬Ò²ÐíҲûÓзÃÎÊ´ËÎļþµÄ×㹻ȨÏÞ¡£
½â¾ö·½·¨£º
ÖØд´½¨´ËÎļþ£¬ÔËÐжԻ°¿òÖÐÊäÈë:mmc
1) ¿ØÖÆ̨-->Ìí¼Ó/ɾ³ý¹ÜÀíµ¥Ôª-->Ìí¼ ......
ûÓÐÒýÓùØϵµÄ±í
£±.¡¡Áª±í¸üÐÂ
update a set a.education = '±¾¿Æ' from NT_UserInfo a ,NT_User b where a.UserID=b.UserID and b.email = 'carlfan2008@163.com'
£².¡¡Áª±í²éѯ
select a.*,b.* from nt_user as a, nt_userinfo as b where a.userid = b.userid and Email = 'carlfan2008@163.com ......
1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃExecÖ´ÐÐ
Àý: Select * from tableName
Exec('select * from tableName')
& ......
Òý×Ôhttp://www.05112.com/Article/200908/26674.html
ÍøÕ¾SQL×¢È멶´È«½Ó´¥£¨¸ß¼¶Æª£©
ÎÄÕÂÕûÀí·¢²¼£ººÚ¿Í·çÔÆ ÄÚÈݹØ×¢¶È£º
291 ¸üÐÂʱ¼ä£º2009-8-15 6:36:47
¿´ÍêÈëÃÅƪºÍ½ø½×ƪºó£¬ÉÔ¼ÓÁ·Ï°£¬ÆƽâÒ»°ãµÄÍøÕ¾ÊÇûÎÊÌâÁË¡£µ«Èç¹ûÅöµ½±íÃûÁÐÃû²Â²»µ½£¬»ò³ÌÐò×÷Õß¹ýÂËÁËһЩÌØÊâ×Ö·û£¬ÔõôÌá¸ß×¢ÈëµÄ³É¹¦ÂÊ£¿Ôõ ......