Showing posts with label sqlexpress. Show all posts
Showing posts with label sqlexpress. Show all posts

Tuesday, March 27, 2012

BackUp SQLEXPRESS mdf files

Hi All,

I searched the archives but I could not find any useful stuff for me.

I can backup a database on SQLExpress like

USE master
EXEC sp_addumpdevice 'disk', 'Store_1', 'c:\Store_1.dat'
BACKUP DATABASE Store TO Store_1

Here is my problem:

If I use logins,roles etc. in an application automatically a mdf file is created. Or I can create a new sql database. SQLExpress dynamically use the mdf file when connection string defined.

This mdf file is not defined as a database on SQLExpress. Because SQLExpress has not a gui, I cannot see the registered database.

How can I backup any sqlexpress mdf file without deattaching or attaching?

Thanks

That has changed there is now a Management tool now download it install it and use the backup and restore wizard or modify the code in the thread below and use it. Hope this helps.

http://forums.asp.net/thread/1049663.aspx
http://msdn.microsoft.com/vstudio/express/sql/compare/default.aspx

Backup SQLExpress database

I have installed the community preview version of SQL Express (I think the April preview version). I can't find a way to backup a database created with the SQL Express UI tools. Can you point me in the right direction? Thanks, Leo

Hi,

I'm not very familar with Express Manager Tool. But if you do not find anything like dts or export/import function of dbs. I woul just write a small script that takes all tables into a dataset and would then write that dataset into a different database base or write it to a xml-file, using the writexml method of the dataset class.|||

You should be able to use the same T-SQL BACKUP syntax that works with any other database.

Something like:
SQLCMD -S machine\instance
SQLCMD> BACKUP DATABASE [foo] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\foo.bak'
Books Online has the full syntax of the BACKUP DATABASE command.

|||thanks