Showing posts with label prompt. Show all posts
Showing posts with label prompt. Show all posts

Monday, March 19, 2012

How to take the database online/ bring it offline by command prompt?

Hi,
I now using MS SQL SERVER Desktop Edition, as I know there is no enterpirse
belongs with this edition. I would like to perform a task that is provided
in the enterprise manager.
The task is "select a database--rightclick->All Tasks-->Taks Offline/Bring
Online"
The database file will then disconnect and connect to the server.
Anybody know how to perform the same task by command prompt as there is no
enterprise manager?
Thanks
RC
Hi,
From OSQL use the below commands:-
For Offline
ALTER DATABASE <DBNAME> SET OFFLINE
For Online
ALTER DATABASE <DBNAME> SET ONLINE
Note:
You have many options in ALTER DATABASE command, refer books online for more
information.
THanks
Hari
SQL Server MVP
"RC" <rc@.gmail.com> wrote in message
news:u2q2ST%23PFHA.3560@.TK2MSFTNGP14.phx.gbl...
> Hi,
> I now using MS SQL SERVER Desktop Edition, as I know there is no
> enterpirse
> belongs with this edition. I would like to perform a task that is provided
> in the enterprise manager.
> The task is "select a database--rightclick->All Tasks-->Taks Offline/Bring
> Online"
> The database file will then disconnect and connect to the server.
> Anybody know how to perform the same task by command prompt as there is no
> enterprise manager?
> Thanks
> RC
>

How to Take Backup from Command prompt

Hi all,
Please tell me how to take MS SQL backup from command
prompt.
With regards,
Anna Patil
Generate the BACKUP command you want to run (see the BACKUP topic in Books
Online for syntax and usage). Then, you can save this script in a .sql
file, and run it using osql from the command line. osql has its own topic
in Books Online too, so you can learn how to use it there...
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Anna Patil" <anna.patil@.ddsl.net> wrote in message
news:11ee001c4425e$b666b580$a301280a@.phx.gbl...
> Hi all,
> Please tell me how to take MS SQL backup from command
> prompt.
> With regards,
> Anna Patil
|||Hi,
From command prompt execute the below command:-
OSQL -Usa -Ppassword -Sservername -Q"backup database pubs to
disk='c:\pubs.bak' with init"
(replace the database pubs with actual database)
Thanks
Hari
MCDBA
"Anna Patil" <anna.patil@.ddsl.net> wrote in message
news:11ee001c4425e$b666b580$a301280a@.phx.gbl...
> Hi all,
> Please tell me how to take MS SQL backup from command
> prompt.
> With regards,
> Anna Patil

How to Take Backup from Command prompt

Hi all,
Please tell me how to take MS SQL backup from command
prompt.
With regards,
Anna PatilGenerate the BACKUP command you want to run (see the BACKUP topic in Books
Online for syntax and usage). Then, you can save this script in a .sql
file, and run it using osql from the command line. osql has its own topic
in Books Online too, so you can learn how to use it there...
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Anna Patil" <anna.patil@.ddsl.net> wrote in message
news:11ee001c4425e$b666b580$a301280a@.phx
.gbl...
> Hi all,
> Please tell me how to take MS SQL backup from command
> prompt.
> With regards,
> Anna Patil|||Hi,
From command prompt execute the below command:-
OSQL -Usa -Ppassword -Sservername -Q"backup database pubs to
disk='c:\pubs.bak' with init"
(replace the database pubs with actual database)
Thanks
Hari
MCDBA
"Anna Patil" <anna.patil@.ddsl.net> wrote in message
news:11ee001c4425e$b666b580$a301280a@.phx
.gbl...
> Hi all,
> Please tell me how to take MS SQL backup from command
> prompt.
> With regards,
> Anna Patil

How to Take Backup from Command prompt

Hi all,
Please tell me how to take MS SQL backup from command
prompt.
With regards,
Anna PatilGenerate the BACKUP command you want to run (see the BACKUP topic in Books
Online for syntax and usage). Then, you can save this script in a .sql
file, and run it using osql from the command line. osql has its own topic
in Books Online too, so you can learn how to use it there...
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Anna Patil" <anna.patil@.ddsl.net> wrote in message
news:11ee001c4425e$b666b580$a301280a@.phx.gbl...
> Hi all,
> Please tell me how to take MS SQL backup from command
> prompt.
> With regards,
> Anna Patil|||Hi,
From command prompt execute the below command:-
OSQL -Usa -Ppassword -Sservername -Q"backup database pubs to
disk='c:\pubs.bak' with init"
(replace the database pubs with actual database)
Thanks
Hari
MCDBA
"Anna Patil" <anna.patil@.ddsl.net> wrote in message
news:11ee001c4425e$b666b580$a301280a@.phx.gbl...
> Hi all,
> Please tell me how to take MS SQL backup from command
> prompt.
> With regards,
> Anna Patil