|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 8:55 AM
Points: 1,038,
Visits: 1,355
|
|
Toreador (9/22/2010) ...I'm not sure what the question was supposed to teach us though - would anybody really try doing a backup inside a transaction?!
Perhaps not intentionally, but indirectly: how many of you know what all of the stored procs on your systems actually do? I can think of no logical reason* for someone to include a backup within a stored proc that does something else, but if they did, and you didn't know it, and called the proc from within a transaction...
*And since there's no logical reason to do it, it almost certainly has been done.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 24, 2013 9:59 PM
Points: 1,354,
Visits: 1,299
|
|
Dave62 (9/22/2010)
I think the proper way to "rollback" a backup is to do a restore. 
No, because that will bring the database back to a previous state. The way to rollback the backup would be to delete the file that was created.
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 1,497,
Visits: 1,508
|
|
cengland0 (9/22/2010)
Dave62 (9/22/2010)
I think the proper way to "rollback" a backup is to do a restore.  No, because that will bring the database back to a previous state. The way to rollback the backup would be to delete the file that was created.
This may be one of those "it depends" things. In my way of thinking, when you rollback a transaction, returning it to the previous state (before the transaction began) is the desired outcome. So restoring the database after a backup is like rolling back a transaction. They both return the database to the state prior to the respective action.
I see what you are saying though because if the database is live a restore would lose all transactions from all users that occurred after the backup.
But if the database was in single-user mode during a maintenance window or something than the effect of a restore is the same as rolling back a transaction. And this is one situation I can think of where a DBA may want to "rollback" a backup. Something went wrong during maintenance and he or she wants to start over. But since you can't rollback a backup the next best option is to restore. In this case, trying to rollback by deleting the backup file would be disastrous for the DBA.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 8:55 AM
Points: 1,038,
Visits: 1,355
|
|
Dave62 (9/22/2010)
cengland0 (9/22/2010)
Dave62 (9/22/2010)
I think the proper way to "rollback" a backup is to do a restore.  No, because that will bring the database back to a previous state. The way to rollback the backup would be to delete the file that was created. This may be one of those "it depends" things. In my way of thinking, when you rollback a transaction, returning it to the previous state (before the transaction began) is the desired outcome. So restoring the database after a backup is like rolling back a transaction. They both return the database to the state prior to the respective action.
Not quite. Rolling back a transaction does NOT restore a database to the state it was in before the transaction began. It ONLY restores those items affected by the transaction --other data changes (e.g, by other users) are not rolled back. In this case, the items related to a backup are the backup file itself, and the metadata stored about the backup by SQL server. So "rolling back" a backup would be deleting the backup file and the metadata but leaving any changes to the database intact.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Tuesday, December 07, 2010 8:13 AM
Points: 436,
Visits: 322
|
|
Carlo Romagnano (9/22/2010) Some operations have no sense inside a transaction. I surprise to see so many wrong answers. For me, it came down to a guess between would it just do the backup anyway or would it tell you that what you are doing does not make sense?
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Today @ 9:03 AM
Points: 1,497,
Visits: 1,508
|
|
sknox (9/22/2010) ... --other data changes (e.g, by other users) are not rolled back. In this case, the items related to a backup are the backup file itself, and the metadata stored about the backup by SQL server. So "rolling back" a backup would be deleting the backup file and the metadata but leaving any changes to the database intact.
Agreed. This is the best way to deal with the live scenario. But would utterly fail in the maintenance scenario. If you actually want to get back to the state prior to the backup operation deleting the backup file is not going to work out too well.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 8:55 AM
Points: 1,038,
Visits: 1,355
|
|
Dave62 (9/22/2010)
sknox (9/22/2010) ... --other data changes (e.g, by other users) are not rolled back. In this case, the items related to a backup are the backup file itself, and the metadata stored about the backup by SQL server. So "rolling back" a backup would be deleting the backup file and the metadata but leaving any changes to the database intact.Agreed. This is the best way to deal with the live scenario. But would utterly fail in the maintenance scenario. If you actually want to get back to the state prior to the backup operation deleting the backup file is not going to work out too well.
Agreed agreed. And at this point, we've taken what was essentially a cute joke on your part and utterly destroyed it. Apologies for our pedantry.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 4:11 PM
Points: 3,390,
Visits: 3,403
|
|
sknox (9/22/2010)
Dave62 (9/22/2010)
sknox (9/22/2010) ... --other data changes (e.g, by other users) are not rolled back. In this case, the items related to a backup are the backup file itself, and the metadata stored about the backup by SQL server. So "rolling back" a backup would be deleting the backup file and the metadata but leaving any changes to the database intact.Agreed. This is the best way to deal with the live scenario. But would utterly fail in the maintenance scenario. If you actually want to get back to the state prior to the backup operation deleting the backup file is not going to work out too well. Agreed agreed. And at this point, we've taken what was essentially a cute joke on your part and utterly destroyed it. Apologies for our pedantry.
Thanks, I did learn something useful today. The definition of pedantry.
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 4:56 PM
Points: 1,434,
Visits: 398
|
|
Nice question. Although I can't see why anyone would try to do this.
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|