Problems with Microsoft.SqlServer.Management.Smo and SQL 2008 R2

Hi,

I have a need to copy a database from one SQL Server instance to another and to this end I use the SMO Transfer.TransferData object/method.

This has always worked OK against SQL Server 2008 but I have just tried it against my new SQL 2008 R2 server and I get an error saying that the .mdf file for my database could not be found - the path listed is correct, accessible and the file exists.

I am just trying to go back and re-install the standard SQL Server 2008 to see if I can still get it to work with that version.

Do you need an updated version of the SMO DLL for this to work with 2008 R2 and if so would it niot have been installed as part of 2008 R2?

If I build against this SMO library will I still be able to work with a 2005/2008 database server as I do not know what database my clients will use - I support 2005 on.
ChrisMDrewAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan McCauleyData and Analytics ManagerCommented:
SMO is backwards-compatible, so if you do include the new version from the 2008 R2 feature pack (at http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=ceb4346f-657f-4d28-83f5-aae0c5c83d52), if will connect to a 2005/2008 server without any issues. First, I'd try installing that, adding the reference in your project (in place of the 2008 version of SMO) and see if that corrects your problem.

I would have expected the 2008 SMO to be forward compatible as well, since 2008R2 isn't that different, but I know that 2005 wasn't forward compatible to 2008, so maybe the same is true here. In either case, I think your best bet is to include/deploy the new DLLs.
0
ChrisMDrewAuthor Commented:
Thanks for the suggestion - however the cause of the problem seems to be rather strange.  It would seem that the SMO Transfer:TransferData call fails with an error saying that the .mdf could not be found if the INSTANCE NAME is different between the source and destination server.

For example I had two SQL Server installations named

DEVELOPMENT\SQL2008
HPDV7\SQLEXPRESS

Calling TransferData to copy a database from the one to the other causes the error however if I add a new instance of

HPDV7\SQL2008

Now I can transfer from DEVELOPMENT\SQL2008 to HPDV7\SQL2008

Very odd but this does seem to be the case.  Hope it helps someone else!!!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ChrisMDrewAuthor Commented:
My answer seems to be the actual cause of the problem...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.