Managing Database Files (SQL Server Express)

SQL Server 2008 Express (SQL Server Express) databases are stored in an .mdf file that can be copied and backed up.

Backing up Database Files

You can attach SQL Server Express database files to an instance of SQL Server Express on any server. This lets you copy database files from one computer to another and use the same database on multiple servers. This also simplifies backing up databases; simply copy your database files to a secure location. If a database becomes corrupted or data is accidentally deleted, you can restore the database from the secure location and re-attach the database. For more information about copying and attaching database files, see Xcopy Deployment (SQL Server Express) and How to: Attach a Database File to SQL Server Express.

Preserving Database Files During Uninstall

When you uninstall SQL Server Express, the main SQL Server Express database file is deleted, as are any sample database files installed in the default directory. All user-created database files are preserved. If you want to preserve changes you have made to sample databases, you must copy the database files out of the default data directory before uninstalling SQL Server Express. The database files can then be attached to a new instance of SQL Server. It is also a good practice to back up user-created database files on a regular schedule.