Detaching and Attaching a database in SQLSERVER
We do detach and attach a database to improve the Performance, to move the physical drive location of datafiles on the same server or to different server and due to space constraints. Steps to Detach and Attach a database: Step-1: Change the Restrict Access to Single mode Right click on database (devdb) -> Properties -> Options -> modify the Restrict Access to Single mode -> Ok Step-3: Right click on database (devdb) -> Tasks -> Detach -> select "Drop connections" and "Update Statistics" -> Ok Step-4: Move the datafiles and logfiles from old location to the new location from OS level Old location: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA New location: D:\Datafiles\devdb Step-5: Right click on Databases -> Attach -> select the datafile from new location. Step-6: Validate the database attached and the file locations. Manual Method using Script: Step-1: Locate the database file location sp_helpdb devdb Step-2...