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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Restoring SQL .bak files from dos command line

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-23 : 07:59:27
Donovan Sobrero writes "Hello i have been looking to be able to do a "Dos batch script in sql" for some time but i'm not really big in sql. my goal is to restore 3 database.

Livedata_Dosrun.BAK
LiveData_CustDB1.BAK
LiveData_Sys.BAK

from a directory called "d:\stream\livedata\data"

it would also be great if i could have the SQL data to be stored on drive "D:\SQLDATA" IE:

D:\SQLDATA\Livedata_Dosrun.mdf
D:\SQLDATA\Livedata_Dosrun_Log.ldf
D:\SQLDATA\LiveData_CustDB1.mdf
D:\SQLDATA\LiveData_CustDB1_Log.ldf
D:\SQLDATA\LiveData_Sys.mdf
D:\SQLDATA\LiveData_Sys_log.ldf

And have the "SA" account assigned ownership. Is this possible? and if so could i get a copy of the .cmd file please it would be really help me out a LOT!!

Please reply to me at
Donovan@networkmechanics.net"

Kristen
Test

22859 Posts

Posted - 2006-01-23 : 12:08:10
You can run standard SQL commands from "DOS prompt / batch file" by using OSQL.EXE, which comes with SQL Server Client Utilities.

That will enable you to write a standard RESTORE command which should do the job.

But I don't have the time to write it all for you ...

Kristen
Go to Top of Page
   

- Advertisement -