SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


backup database


backup database

Author
Message
sknox
sknox
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2578 Visits: 2827
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.
cengland0
cengland0
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1666 Visits: 1300
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.
Dave62
Dave62
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3243 Visits: 2777
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.
sknox
sknox
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2578 Visits: 2827
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.
JF1081
JF1081
SSC-Addicted
SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)SSC-Addicted (454 reputation)

Group: General Forum Members
Points: 454 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?
Dave62
Dave62
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3243 Visits: 2777
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.
sknox
sknox
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2578 Visits: 2827
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.
Cliff Jones
Cliff Jones
SSCarpal Tunnel
SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)SSCarpal Tunnel (4.3K reputation)

Group: General Forum Members
Points: 4273 Visits: 3648
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.
rlwilde
rlwilde
UDP Broadcaster
UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)UDP Broadcaster (1.4K reputation)

Group: General Forum Members
Points: 1447 Visits: 442
Nice question. Although I can't see why anyone would try to do this. Hehe
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)SSC-Dedicated (31K reputation)

Group: General Forum Members
Points: 31906 Visits: 18551
Thanks for the question



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


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search