- sp_helpdb smrtest
- --Set the database to a single user mode from multiuser mode
USE [master]
GO
ALTER DATABASE [smrtest]
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
--Detach the database using the sprocs
USE [master]
GO
CREATE DATABASE [smrtest1] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SMRPLM\MSSQL\DATA\smrtest.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SMRPLM\MSSQL\DATA\smrtest_log.ldf' )
FOR ATTACH --<<use for attach to attach the sales database
GO
No comments:
Post a Comment