Last post Mar 27, 2008 08:15 PM by XPSCodes
Mar 27, 2008 07:43 PM|Dhuka|LINK
I would really appreciate if you can help me with this problem. I am currently using SQL Server 2005 Express for one of my web application. I have a .bak file (backup file) provided by my client which I want to use for
testing purpose. Now I just want to know how can I use that backup file without installing SQL SERVER 2005 as one way to do this I know is to restore the database in SQL Server 2005 Enterprise Manager but I can't install SQL Server 2005.
To my knowledge, SQL Server Express uses .mdf file for database but what I have is .BAK file..
I would be really glad to see your quick answers.
Thank you for reading this far.
.NET SQL Server 2005
SQL Server Express
SQL 2005 ASP.NET
sql server 2005 express restore bak
SQL 2005 Express or Standard
SQL Server 2005 Express
SQL Server 2005
Mar 27, 2008 08:13 PM|tmpuzer|LINK
First of all, before you do anything make sure you make a copy of the .bak file and put it in a safe place. Now, open Microsoft SQL Server Managment Studio Express and connect to your database server. Right-click on the databases folder and choose "Restore
database ..." type in the name you want to give to the database (e.g., "mytest_db"). Under the source for restore section select the "From Device" radio button. Click the ellipsis next to it and click the add button on the dialog box that appears. Find
your .bak file and hit OK and then OK again. The check the restore check box and click OK.
Mar 27, 2008 08:15 PM|XPSCodes|LINK
I hope you have SQL Server 2005 installed. If you do, you can try command line options using sqlcmd.
Run sqlcmd from command prompt with -q option.
Create a database:
sqlcmd -q "CREATE DATABASE [YourDB] ON PRIMARY ( NAME = N'YourDB_Data', FILENAME = N'C:\DATA\YourDB.mdf') LOG ON ( NAME = N'YourDB_log', FILENAME = N'C:\DATA\YourDB_log.LDF')"
Restore Your Backup:
sqlcmd -q "RESTORE DATABASE [YourDB]
FROM DISK = 'C:\Backup\YourDBBackup.BAK'
WITH MOVE 'YourDB_Data' TO 'C:\Data\northwind_log.ldf',
MOVE 'YourDB_log' TO 'C:\DATA\YourDB_log.LDF'"
PS: You have to enter the whole query in one line.