Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 new user attempting to import a db

Author  Topic 

greenman
Starting Member

2 Posts

Posted - 2009-03-21 : 13:51:22
I'm a brand new user to sql server 2005 ... all development in the past has been done with mysql and access.

A customer has supplied a mssql .bak file and I'm having trouble importing it. Using the following code found on http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=34770:

----------------
RESTORE DATABASE rBB
FROM DISK = 'C:\wamp\www\test-wamp\_db_backups\rBB_backup_200805152339.bak'
WITH REPLACE, MOVE 'rBB_Data' to 'C:\MSSQL\DATA\rBB_Data.MDF',
MOVE 'rBB_Log' TO 'C:\MSSQL\DATA\rBB_Log.LDF', STATS
----------------------

The following error is displaying:

---------------------
Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database 'rBB' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
------------------

Do I need to delete the new, empty rBB I created earlier?
Any help would be greatly appreciated.

thanks,
david

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-03-21 : 13:54:31
you can delete or rename the old db in management studio with a right click


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-03-21 : 13:55:52
and type:
USE MASTER
GO

on top of your script


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

greenman
Starting Member

2 Posts

Posted - 2009-03-21 : 14:57:44
Thanks! I'm all set now.

david
Go to Top of Page
   

- Advertisement -