Avatar of Headmasters
HeadmastersFlag for United Kingdom of Great Britain and Northern Ireland

asked on 

SQL DB Restore using OSQL

Hi,

I'd like to restore a sql database using OSQL but seem to be running into a few problems:

The sql database was originally backed up on a different machine the MDF files were located in a different location and the Database name was different.

Backed up From:
Database Name: Experts
Database Path: c:\Program Files\Experts Directory\Experts_Data.MDF
Database Path: c:\Program Files\Experts Directory\Experts_Log.LDF
Backup FIle: C:\Backup\Experts.BAK

Restore To:
Database Name: Exchange
Database Path: C:\Program Files\Exchange Directory\Exchange_Data.MDF
Database Path: C:\Program Files\Exchange Directory\Exchange_Log.LDF
Restore from: C:\Backup\Experts.BAK

I am using the following command but am running into problems:

osql -SDBServer -E -Q " RESTORE DATABASE Experts FROM DISK = 'C:\Backup\Expert.Bak' WITH MOVE 'C:\Program Files\Experts Directory\Experts_data.mdf' TO 'C:\Program Files\Exchange Directory\Exchange_Data.mdf', MOVE 'C:\Program Files\Experts Directory\Experts_log.ldf' TO 'C:\Program Files\Exchange Directory\Exchange_log.ldf' "

I did manage to restore the database using a graphical interface in enterprise manager.

Any help would be gratefully appreciated.

Many Thanks

Microsoft SQL Server

Avatar of undefined
Last Comment
Headmasters
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Headmasters
Headmasters
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Thank you very much!
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo