MSDE database backup and restore to MSQLExpress 2005/2008
- To find out the databases in the MSDE run this command
- OSQL -E –S SQLServerInstanceName –Q "SELECT name FROM sysdatabases"
- To backup a specific database run this command
- OSQL -U sa -P admin -S
Or - OSQL -E-S
- BACKUP DATABASE dbname TO DISK = 'c:\path\to\backupfile.dat'
Go
- OSQL -U sa -P admin -S
- To restore a specific database run this command
- RESTORE DATABASE newdb FROM DISK = 'c:\path\to\backupfile.dat' WITH REPLACE
go
- If that does not work, then you can enter the following statement as one continuous string, but follow the capitalizations and the spacing in the example.
RESTORE DATABASE newdb FROM DISK = 'c:\path\to\backupfile.dat' WITH MOVE' to 'c:\Program Files\Microsoft SQL Server\MSSQL$METRIX\Data\METRIXV120copy.mdf', MOVE'to 'c:\Program Files\Microsoft SQL Server\MSSQL$METRIX\Data\METRIXV120copy.ldf'
- To get the logical names run this command RESTORE FILELISTONLY FROM DISK = 'c:\path\to\backup.dat'
- RESTORE DATABASE newdb FROM DISK = 'c:\path\to\backupfile.dat' WITH REPLACE
No comments:
Post a Comment