数据库的附加和分离

  • Post author:
  • Post category:其他


▪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

转载于:https://www.cnblogs.com/mountain2011/p/9109613.html