Headmasters
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.MD F
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.md f', 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
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.MD
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
I did manage to restore the database using a graphical interface in enterprise manager.
Any help would be gratefully appreciated.
Many Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER