Tuesday, March 20, 2012

Restore Database

Dear All
I am have trouble restoring a database from a device called 1.bak. When I
try restoring the database it tells me that I need to be in single user mode.
To do this I go to the command prompt and type:
sqlservr -s BBC024579
where BBC024579 is the server name (and local pc name).
I get an error message saying that it cannot find the specified server
instance running.
I have tried this with the SQL Server Service running and not running.
I am using a Server 2000 developer edition on a local machine that will not
have anyone connected to it. Can someone offer me some help?
Thanks again.
Alastair
Hello,
Use the below command from Master database in query analyzer to restore the
database
ALTER DATABASE EAGLE SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
Now issue the RESTORE database command. After the restore issue the below
command to make database multi user.
go
ALTER DATABASE EAGLE SET MULTI_USER
Thanks
Hari
"Alastair MacFarlane" <AlastairMacFarlane@.discussions.microsoft.com> wrote
in message news:6B8EB502-98B3-4277-8C5A-0E1FD27E31F1@.microsoft.com...
> Dear All
> I am have trouble restoring a database from a device called 1.bak. When I
> try restoring the database it tells me that I need to be in single user
> mode.
> To do this I go to the command prompt and type:
> sqlservr -s BBC024579
> where BBC024579 is the server name (and local pc name).
> I get an error message saying that it cannot find the specified server
> instance running.
> I have tried this with the SQL Server Service running and not running.
> I am using a Server 2000 developer edition on a local machine that will
> not
> have anyone connected to it. Can someone offer me some help?
> Thanks again.
> Alastair
|||Hi Alastair
"Alastair MacFarlane" wrote:

> Dear All
> I am have trouble restoring a database from a device called 1.bak. When I
> try restoring the database it tells me that I need to be in single user mode.
Does the database already exist? If it does then you are probably getting
the message that other users are connected to the database, rather than it
needs to bin in single user mode. If this is the case check sp_who2 to see
what users are connected and use KILL for the given SPIDs or issue the
statements
USE dbname
ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
USE master
RESTORE DATABASE myDatabase
FROM DISK = 'c:\1.bak'

> To do this I go to the command prompt and type:
> sqlservr -s BBC024579
> where BBC024579 is the server name (and local pc name).
If this is the default instance then you don't have to specify a name

> I get an error message saying that it cannot find the specified server
> instance running.
> I have tried this with the SQL Server Service running and not running.
> I am using a Server 2000 developer edition on a local machine that will not
> have anyone connected to it. Can someone offer me some help?
If you run NET START from a command prompt you should see SQL Server running
(or not)

> Thanks again.
> Alastair
John
|||John and Hari,
Thanks for the advise and I have now restored my database.
Thanks.
Alastair
"John Bell" wrote:

> Hi Alastair
> "Alastair MacFarlane" wrote:
>
> Does the database already exist? If it does then you are probably getting
> the message that other users are connected to the database, rather than it
> needs to bin in single user mode. If this is the case check sp_who2 to see
> what users are connected and use KILL for the given SPIDs or issue the
> statements
> USE dbname
> ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
> USE master
> RESTORE DATABASE myDatabase
> FROM DISK = 'c:\1.bak'
>
> If this is the default instance then you don't have to specify a name
>
> If you run NET START from a command prompt you should see SQL Server running
> (or not)
>
> John

No comments:

Post a Comment