Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

backup database Expand / Collapse
Author
Message
Posted Wednesday, September 22, 2010 7:20 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 12:53 PM
Points: 1,295, Visits: 1,652
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.
Post #991134
Posted Wednesday, September 22, 2010 7:56 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen 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.
Post #991185
Posted Wednesday, September 22, 2010 8:21 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 2,006, Visits: 2,003
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.
Post #991210
Posted Wednesday, September 22, 2010 8:29 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 12:53 PM
Points: 1,295, Visits: 1,652
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.
Post #991221
Posted Wednesday, September 22, 2010 8:36 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Tuesday, December 7, 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?
Post #991236
Posted Wednesday, September 22, 2010 8:38 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 11:09 AM
Points: 2,006, Visits: 2,003
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.
Post #991241
Posted Wednesday, September 22, 2010 8:42 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 12:53 PM
Points: 1,295, Visits: 1,652
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.
Post #991248
Posted Wednesday, September 22, 2010 9:02 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 7:30 AM
Points: 3,871, Visits: 3,621
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.
Post #991264
Posted Wednesday, September 22, 2010 10:22 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Wednesday, June 4, 2014 10:28 AM
Points: 1,434, Visits: 412
Nice question. Although I can't see why anyone would try to do this.
Post #991347
Posted Wednesday, September 22, 2010 11:15 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 3:00 PM
Points: 21,211, Visits: 14,903
Thanks for the question



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #991395
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse