Discussion Locked

SQL

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a database that has all its data forwarded to a vendor. The vendor will do some conversion and then recreate the database for us. When the vendor is done , he will send the database with all the data back to us and I am supposed to restore the database for my office.
What I plan on doing is ; on the query_analyzer, I will execute the following;

exec sp_detach_db ' current_db_name'

This I hope will detach my existing database. First question do I run this from the master_database or from the existing database that I want to detach?

when this is done, I plan on insertig the vendor's CD or diskette and copy the contents to the filepath i want to use for the datafile and logfiles. question2, do you think the CD or diskette will have just two or more files containing the db with .mdf and .ldf for the data and log respectively and if so, can I just copy it/them to the necessary file path/directory without any conversion?

If all is ok and correct up to now, I plan on then running the following to restore the database.

exec sp_attach_db 'db_name'
filename1='F:\mssql7\..........data.mdf',
filename2='F:\mssql7\..........data.ndf',
filename3='F:\mssql7\..........log.ldf',
filename4='F:\mssql7\..........log.2ldf'
GO
question3, Will this do the job? Please note also that the filenames are the files from the vendor, assuming what I get back from them are just files.

question4, if all's correct, do I have to worry about any connectivity issues,like the client accessing the database?

question5, if I am not correct, or this is not the logical/accepted/expected way to restore the database,db, can you give me a detailed step by step synatax included on how to tackle this job.

3 replies

by ricky

You really don't need to do all that. Just make sure you first have a back-up of your original DB.

Then:
1. Ask the vendor to send you a "Complete Backup" file of the DB from his end.

2. At your end just "Restore full" the DB onto the Db you need it to be. [REMEMBER to have a copy of your original backed-up in case of any problems].

3. You'll need "sa" permissions for this, the new-backup (from your vendor -- make sure he sends you the COMPLETE Backup) will restore-onto the existing one and RELACE it. Any permissions, etc will remain the same as when you'd sent him (the vendor) a copy.

Should do it.

This discussion is closed to new replies.