How Do I Backup and Restore My Windows Dedicated Server Databases?
The following procedures will work for both MSDE and MS SQL Server databases.
To Back Up Databases
- Remote desktop to your Windows dedicated server.
- Create a backup folder in a convenient location, like the one below:
C:database_backup
- From the command line, run the following:
osql -E
- At the numbered prompts, run the following commands to return the names of all existing databases:
SELECT name FROM master.dbo.sysdatabases WHERE DBID > 4GO
- For each database you want to back up, run the following two commands, substituting the appropriate database name, database backup name, and backup folder:
backup database [database name] to disk = 'c:[backup folder][database backup name].bak'GO
The backup database file(s) now reside in the specified folder.
To Restore Databases
- Remote desktop to your Windows dedicated server.
- From the command line, run the following:
osql -E
- At the numbered prompts, run the following commands, substituting the appropriate database name, database backup name, and backup folder:
restore database [database name] from disk = 'c:[backup folder][database backup name].bak' with replace, file=1, nounload, stats=10GO