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
 Restore Database Error

Author  Topic 

zamaan
Starting Member

19 Posts

Posted - 2006-01-18 : 07:21:05
Hello !

I am just few months started to learn SQL server.
I just attempt to restore a database which I have backuped last week.
The following error appears each time when I was trying Restore it from Hard Disk.

Error :

RESTORE DATABASE must be used in single user mode. when trying restore the master database. RESTORE DATABASE is terminating abnormally.

Please help me to restore my database.

mr_mist
Grunnio

1870 Posts

Posted - 2006-01-18 : 07:25:08
The error message tells you what you need to do.

Why are you trying to restore the master database?

-------
Moo. :)
Go to Top of Page

zamaan
Starting Member

19 Posts

Posted - 2006-01-18 : 11:34:02
quote:
Originally posted by mr_mist

The error message tells you what you need to do.

Why are you trying to restore the master database?

-------
Moo. :)



Hello Mr_Mist

What is actually a single user mode. actually i dont have a net work. it is just an stand alone pc with windowsxp. Loged in as administartor.

Also which portion of the data base i should backup
Go to Top of Page

druer
Constraint Violating Yak Guru

314 Posts

Posted - 2006-01-18 : 14:32:56
This error message happens even with a single user computer if there are existing queries that are running against that database, since all connections have a database lock set. It could be a SQL Job executing in the background, or the restore job you are trying to run is actually set to run under the database that you are trying to restore. You need to be sure that the restore job is set to run from Master not the database you are trying to restore. You can write code to kill any process that is using that database before you try to do the restore to ensure that it can be taken into single user mode to do the restore.

Hope this helps,
Dalton
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-18 : 19:34:24
How do you restore the database ? Are you using Enterprise Manager (EM) or via Query Analyser (QA) ? What database are you trying to restore, master, msdb or other database?

If you are restoring via EM Make sure no users are accessing the database. If you are using QA, execute the restore command in master and not from your database. Also you can use sp_who to see any users is accessing the database

-----------------
'KH'

Go to Top of Page

zamaan
Starting Member

19 Posts

Posted - 2006-01-18 : 23:38:41
quote:
Originally posted by khtan

How do you restore the database ? Are you using Enterprise Manager (EM) or via Query Analyser (QA) ? What database are you trying to restore, master, msdb or other database?

If you are restoring via EM Make sure no users are accessing the database. If you are using QA, execute the restore command in master and not from your database. Also you can use sp_who to see any users is accessing the database

-----------------
'KH'





Hello Dalton, Khtan thanks for posts.

I have to say for post of Khtan is :

I am using Enterprise Manager (EM) to restore the Database.
I am not restoring master, msdb or any buil in Databases. The one I created called “User Manager”. So I use “From Device” Radio button from “General” tab in the Restore Database window.

Since it a single computer at the time of restore I am not using the database.

Thank you and looking forward….
Go to Top of Page

zamaan
Starting Member

19 Posts

Posted - 2006-01-19 : 00:14:15
Hello every body.

I just managed to solve the problem. You have to certify weather it is correct what I did.

I just created a new Database and put the same Name of the database which I am trying to restore. Then I started the backup process as follows.

First I select “User Manager” (which is Just created) form “Restore as Database”.
* I noticed actually in my all previous failed Attempts “Master” is selected in “Restore as Database”. This is what made the problem I think. As you sad I was just trying to restore the master database.

Then I select “From Device” to browser the file in the hard drive.

Then I selected “OK”.

It is just restored with out any trouble. All tables are there with the data’s.

Is this process I used to restore the Data Base is correct?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-01-19 : 01:41:23
Sounds good to me.

Make sure MASTER and MSDB, as well as all your "user databases", are part of your backup plan, then if they get damaged you'll be able to recover them.

Kristen
Go to Top of Page

zamaan
Starting Member

19 Posts

Posted - 2006-01-19 : 07:14:13
quote:
Originally posted by Kristen

Sounds good to me.

Make sure MASTER and MSDB, as well as all your "user databases", are part of your backup plan, then if they get damaged you'll be able to recover them.

Kristen



Hello Kristen

Thank you for your advise. I appriciate it.

Bye.
Go to Top of Page
   

- Advertisement -