数据库的附加和分离

▪DB的附加和分离命令如下
>sqlcmd -E -S localhost¥DPMDBI 
//attach命令
1>sp_attach_db 'MyDB', @filename1='F:\MyPath\Data\MyDB_DATA.MDF', @filename2='F:\MyPath\Data\MyDB_LOG.LDF' 
2>go 
1>exit
//detach命令
1>alter database [MyDB] set offline with ROLLBACK IMMEDIATE
2>exec sp_detach_db 'MyDB',TRUE
3>go
1>exit
posted @ 2018-05-30 10:43  山的那一边  阅读(188)  评论(0编辑  收藏  举报