I am familiar with the detach/attach process. But I cannot take the database offline.
Is there a way to back a database, and end up with a usable mdf database file, without taking it offline?
I am familiar with the detach/attach process. But I cannot take the database offline.
Is there a way to back a database, and end up with a usable mdf database file, without taking it offline?
You don't need to take a database offline to back it up. The backup process will create a
.BAK
file, which you can use in a restore operation.If you're using SQL Server Management Studio (SSMS), right-click the database, select "Tasks", then "Back up".
The next window will prompt for some details such as location, back up type, etc. Select the appropriate options for your environment and click "OK".
You may also use T-SQL to script a backup:
See the following MSDN articles for more details:
You can take a normal full backup of the database and restore it as a different database on the same SQL Server instance or as the same database on a different SQL Server intance. This will create a new .mdf file as of the point in time of the backup.
Other than that, no. The database must be stopped in order for the files to be finalized and closed.