Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

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 use
> 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
> 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
use
> > when no one is connected to it. Is there a problem trying to do this?
> >
> >
> >|||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...
> > 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
> use
> > > when no one is connected to it. Is there a problem trying to do this?
> > >
> > >
> > >
>
>|||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?
>

Monday, February 20, 2012

restore master database using sqlservr.exe at command line

When I restore master database by executing sqlservr.exe
at command line I encountered an error message:
Cannot find the file 'C:\Program' (or one of its
components). Make sure the path and filename are correct
and that all required libraries are available.
I have checked sqlservr.exe file it is there.
Thank you for help in advance.
Jeff LeeJeff
It sounds like you might have just specified the location of the executable
incorrectly. Can you actual move to the right directory first, and then run
sqlservr.exe right from there? Or show us the entire command line you are
using.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
<anonymous@.discussions.microsoft.com> wrote in message
news:039901c3d3c7$9c67d930$a101280a@.phx.gbl...
> When I restore master database by executing sqlservr.exe
> at command line I encountered an error message:
> Cannot find the file 'C:\Program' (or one of its
> components). Make sure the path and filename are correct
> and that all required libraries are available.
> I have checked sqlservr.exe file it is there.
> Thank you for help in advance.
> Jeff Lee|||Kalen,
Thank you for your direction. Following is the command I
used in command line
C:\Program Files\Microsoft SQL
Server\MSSQL\Binn\sqlservr.exe -c -m
It appears that sqlservr.exe reacts (quickly shows command
window and disappears serveral seconds later) when just
executing it without parameters -c -m.
>--Original Message--
>Jeff
>It sounds like you might have just specified the location
of the executable
>incorrectly. Can you actual move to the right directory
first, and then run
>sqlservr.exe right from there? Or show us the entire
command line you are
>using.
>--
>HTH
>--
>Kalen Delaney
>SQL Server MVP
>www.SolidQualityLearning.com
>
><anonymous@.discussions.microsoft.com> wrote in message
>news:039901c3d3c7$9c67d930$a101280a@.phx.gbl...
>> When I restore master database by executing sqlservr.exe
>> at command line I encountered an error message:
>> Cannot find the file 'C:\Program' (or one of its
>> components). Make sure the path and filename are correct
>> and that all required libraries are available.
>> I have checked sqlservr.exe file it is there.
>> Thank you for help in advance.
>> Jeff Lee
>
>.
>|||If you use that as the command, the parser will choke at the first space and
give you the error about Program not being recognized. You could put the
whole command in quotes, or as I suggested, first navigate to the binn
directory, and run sqlservr.exe from there.
If I put the command below in quotes, with or without the parameters, it
starts the SQL Server in that command window. From another command window,
or from QA, I can connect normally. Note that if you close the command
window where you started SQL Server it will stop the SQL Server.
--
HTH
--
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
<anonymous@.discussions.microsoft.com> wrote in message
news:03ff01c3d3cc$da6e0ba0$a101280a@.phx.gbl...
> Kalen,
> Thank you for your direction. Following is the command I
> used in command line
> C:\Program Files\Microsoft SQL
> Server\MSSQL\Binn\sqlservr.exe -c -m
> It appears that sqlservr.exe reacts (quickly shows command
> window and disappears serveral seconds later) when just
> executing it without parameters -c -m.
>
> >--Original Message--
> >Jeff
> >
> >It sounds like you might have just specified the location
> of the executable
> >incorrectly. Can you actual move to the right directory
> first, and then run
> >sqlservr.exe right from there? Or show us the entire
> command line you are
> >using.
> >
> >--
> >HTH
> >--
> >Kalen Delaney
> >SQL Server MVP
> >www.SolidQualityLearning.com
> >
> >
> ><anonymous@.discussions.microsoft.com> wrote in message
> >news:039901c3d3c7$9c67d930$a101280a@.phx.gbl...
> >> When I restore master database by executing sqlservr.exe
> >> at command line I encountered an error message:
> >>
> >> Cannot find the file 'C:\Program' (or one of its
> >> components). Make sure the path and filename are correct
> >> and that all required libraries are available.
> >>
> >> I have checked sqlservr.exe file it is there.
> >>
> >> Thank you for help in advance.
> >>
> >> Jeff Lee
> >
> >
> >.
> >