Wednesday, March 28, 2012

restore using isql

I have problems when trying to restore a database using the command line
isql program. I use a trusted connection and it says the database is in use
when no one is connected to it. Is there a problem trying to do this?What is the default database for your trusted connection? If the default
database of your trusted connection is the database you trying to restore it
will v=be problem.
Also make sure no automated jobs periodically connecting the database.
Thanks
Ravi
"Tom Reis" wrote:

> I have problems when trying to restore a database using the command line
> isql program. I use a trusted connection and it says the database is in us
e
> when no one is connected to it. Is there a problem trying to do this?
>
>|||The default database is master. Not the one I am trying to restore.
"Ravi" <ravishankart@.hotmail.com> wrote in message
news:203C4DFF-64B5-427E-A841-8AB5F8A51302@.microsoft.com...
> What is the default database for your trusted connection? If the default
> database of your trusted connection is the database you trying to restore
it[vbcol=seagreen]
> will v=be problem.
> Also make sure no automated jobs periodically connecting the database.
> --
> Thanks
> Ravi
>
> "Tom Reis" wrote:
>
use[vbcol=seagreen]|||try EXEC sp_who2 and see there are any connections to the database
Thanks
Ravi
"Tom Reis" wrote:

> The default database is master. Not the one I am trying to restore.
> "Ravi" <ravishankart@.hotmail.com> wrote in message
> news:203C4DFF-64B5-427E-A841-8AB5F8A51302@.microsoft.com...
> it
> use
>
>|||Tom,
From ISQL first go to SQL prompt using:-
ISQL -Usa -Ppassword (ENTER)
Now execute the below commands in sequence:-
ALTER DATABASE <dbname> SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE Command
GO
ALTER DATABASE <dbname> SET MULTI_USER
Note:
If the SQL Server version is 2000 then use OSQL instead of ISQL.
Thanks
Hari
SQL Server MVP
"Tom Reis" <reistom@.cdnet.cod.edu> wrote in message
news:%23Y8VXZbfFHA.3988@.TK2MSFTNGP10.phx.gbl...
>I have problems when trying to restore a database using the command line
> isql program. I use a trusted connection and it says the database is in
> use
> when no one is connected to it. Is there a problem trying to do this?
>

No comments:

Post a Comment