Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do these Copy Only Backup options mean?

I am currently trying to backup an empty SQL Server 2008 R2 database that I designed for a project that is getting shelved for the time being. I was going through the back up procedure through the SQL Management Studio when I noticed there was an option to make a Copy Only Back Up. I looked it up to see what it was but I didn't fully understand the options I was getting.

http://technet.microsoft.com/en-us/library/ms191495.aspx

I read the entry above as well as other entries and I keep seeing the phrase "independent of the sequence of conventional SQL Server backups."

Can anyone elaborate what this statement means or more about Copy Only Backups in general? I'm not sure if it's the backup I should do in this case? (My first reaction is no)

like image 201
SmashCode Avatar asked Sep 26 '13 18:09

SmashCode


People also ask

What does copy only backup mean?

A copy-only backup is a SQL Server backup that is independent of the sequence of conventional SQL Server backups. Usually, taking a backup changes the database and affects how later backups are restored.

What is the difference between full backup and copy option in full backup?

The difference between copy-only and a full backup is that a copy-only backup doesn't become a base for the next differential backup. A full backup works on all database recovery models. Copy-only backup, on the other hand, is applicable only to a full or bulk-logged recovery models.

Can we restore log backup on copy only full backup?

You should be able to. The copy only backup merely prevents resets for the diff map. A normal restore chain should apply.

What are the 3 types of backups?

The most common backup types are a full backup, incremental backup and differential backup. Other backup types include synthetic full backups and mirroring.


2 Answers

It's a full dump of a database, where you intent to take that dump and load it into some OTHER sql server instance. e.g. It's a nice way of making a complete copy of a DB without having to take down the db, detach the db, copy the .mdf files, re-attach, etc...

Naturally, since you're not using this "backup" as an actual backup, you don't want it to interfere with your normal backup schedules, hence the copy-only functionality. It's a full backup, but will not reset the backup schedule, so your normal next incremental/snapshot backup will work as usual.

This mechanism is necessary since the built-in hotcopy/migration tools in MSSMS are basically useless and can't handle its own databases in many cases.

like image 140
Marc B Avatar answered Nov 08 '22 12:11

Marc B


Normally when you take a backup, it starts (or continues, depending on the type of backup that you took) what is called a log chain. Let's say that you need a copy of your database and, for whatever reason, you can't use your normally scheduled backups for this purpose. Let's walk through the scenario where you don't use a copy_only backup

  1. Normal full backup
  2. A bunch of differential backups
  3. Another full backup (to make your copy database)
  4. More differential backups
  5. Delete the backup from step 3 (you know... to save space)
  6. Disaster on your actual database that necessitates restore from backup

In this case, you can only restore to the last differential backup made in step 2 because the differential backups made in step 4 depend on the full backup from step 3. Now, if the backup in step 3 were a copy_only backup, you'd be fine because you're not re-establishing a log chain (which is to say that the differential backups in step 4 depend on the full backup from step 1.

like image 31
Ben Thul Avatar answered Nov 08 '22 14:11

Ben Thul