简体   繁体   中英

How do I backup a SQL Server 2012 database using SMO

I have some code that uses the SQL Server 2005 SMO objects to backup and restore SQL Server databases this is working fine but I have been tasked with updating the code to work with SQL Server 2012 databases.

I understand I need to use the latest SQL Server 2012 SDK to do this up the backup and restore methods are no longer there.

Have these methods been deprecated and should I just write SQL script to do the same thing instead ?

As far as I know they are still there. Are you sure you've got the right download? Also they've twiddled with what is in what dll, and namespaces.

We just got rid of DMO, and just issue back up and restore commands instead. Had to write a bit more code, but not that much more. Only thing we were using DMO for was feedback for a progress bar, just swapped that for an animation. PS have you tried your SMO code. DMO with backwards compatibility pack still works with 2012, though it's not meant to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM