ELECTRONIC T-NOTES


CHESSBASE USA'S WEEKLY ON-LINE NEWSLETTER


FOR THE WEEK OF APRIL 29, 2001


MAKING DATABASE BACKUPS

by Steve Lopez

This week's article is a sort of adjunct to last week's rambling screed on Internet security. Although this topic was discussed previously in ETN (January 3, 1999), it bears repeating in light of the virus/trojan horse mayhem we examined last week.

Even if you take precautions against viruses and other outside grief happening to your computer, there are internal forces that can also wreck your databases. Files do become corrupted (for all sorts of reasons that have nothing to do with the program with which the files are associated) and hard drives do crash. Consequently, it's just plain prudent for you to make backups of any important irreplacable data stored on your computer -- and this includes (but isn't limited to) your databases of chess games.

If you're using an "out of the box" database (such as the Big or Mega databases) and haven't added, deleted, or otherwise changed anything in them, you don't need to back them up. You can just restore them from the original CD to your hard drive and you're good to go. But if you've added games or notes to these databases, you'll want to make a backup of your altered version. Likewise, you'll want to make a backup of any of your personal databases (like your ICC games, games from OTB tournaments, your ongoing correspondence games, etc.) that you've created and stored on your hard drive.

The first thing you'll need to understand is that any database in ChessBase format actually consists of multiple files. When you create a database in .CBH format, you'll notice that the program (ChessBase, Fritz, or one of the other playing programs) will ask you to name the .CBH file. This does not indicate that the whole database is stored in just that one file! The .CBH file stores just the header information from the games in the database; the annotations are stored in another file, the moves in yet another, each key is kept in its own file, etc.

What this means is that when you make a backup of a ChessBase/Fritz database, you need to backup all the files that make up the database. A ChessBase/Fritz database in .CBH format is composed of a minimum of seven and as many as twenty separate files. If you backup or save just the .CBH file and try to open it later, you'll get squadoo -- the additional files are required.

But ChessBase and the various playing programs we offer give you the option of bundling all of these files together into one unified archive file. This file ends in the extension .CBV and is an archive that stores the multiple database files into a single compressed file. This allows for easier copying to a storage medium (such as a CD or floppy disk) since you'll only need to copy one file instead of seven to twenty of them.

Archiving a database is really easy. In ChessBase 8, all you need to is single-click a database's icon to highlight it. Then go to the Tools menu, select "Database", and then "Backup database" from the submenu. A dialogue appears asking if you want the archive file to be "crypted" or "uncrypted". This is just a fancy way of asking if you'd like to password-protect your archive file. If you protect it with a password, the program will prompt you to enter that password when you try to open that archive file. If you can't provide the password, you'll not be able to access the database -- and there's no "back door" that lets some programmer or techie from ChessBase open the archive for you in case you forget the password. So unless you're a top GM who needs to keep his "secret analysis" secret, I strongly recommend against using the "crypted" option. If you forget your password later, you're sunk -- there is no way to get into a crypted archive file without the password.

Select "uncrypted", click "OK", and you'll get our old compadré, the Windows file select dialogue. This lets you name the .CBV file and determine what folder it'll be stored in. The filename defaults to the same name as the original database, while the folder defaults to the same folder as the original database. For reasons which I will explain later in this article, I also strongly urge you to store the .CBV file in a folder other than the one containing the original database. We'll come back to this in a minute.

In the playing programs, such as Fritz6, you first go to the database window, where you'll see the list of games for the current database. To archive it, go to the File menu and select "Archive". Note that the playing programs don't give you the option to password-protect the archive file -- they jump you right to the Windows file select dialogue (as described in the preceding paragraph). Here again it's best to create the .CBV file in a different folder.

Once the multiple database files have been compressed into the single .CBV file, you can copy that archive file onto a floppy, CD, ZIP disk, or tape backup (or any external storage medium I might have missed mentioning). If your original database (which is still in its original location, by the way -- nothing happens to it just because you made an archive copy) gets corrupted or accidentally deleted, you now have a replacement copy.

To understand why I advise against creating a .CBV archive file in the same folder as the original database, you need to understand what happens when you open a .CBV archive file. Let's look at a hypothetical case. Let's say that I have a database called mygames (the path to which is c:\mychessdocs\mygames.cbh) in which I've stored a few hundred games I've played at chess clubs, tournaments, and online. I've added an opening key to it, as well as a few theme keys and a search booster. So to copy the files individually onto a floppy, I'd have to copy about a dozen or so files over to my A: drive. Instead, I create a .CBV file (called mygames.cbv) and copy that to the floppy as a single operation.

Now what I did here was heeded my own advice and created the mygames.cbv file in a different folder from the original database and then copied it to a floppy disk. A couple of weeks later, I try to open the original mygames database and see nothing but "Data error" listings in the game list. The database has become corrupted -- dang! So I copy the mygames.cbv file from the floppy disk over to the folder c:\mychessdocs (the location of the original database). In ChessBase or Fritz, I go to the File menu, select "Open", then "Database" from the submenu, and use the Windows file select dialogue to go to c:\mychessdocs. I'll see both mygames.cbh and mygames.cbv listed there. I know that I already have an icon for the mygames.cbh database (and that the files are corrupted), so I select the archive file mygames.cbv instead.

Here's what happens once I've selected mygames.cbv and clicked "OK":

  1. The mygames.cbv file uncompresses the previously archived mygames database files into the same folder the .CBV file is currently located in;
  2. In this particular case, these files overwrite the mygames database files currently on the hard drive;
  3. The mygames.cbv archive file is automatically deleted once the individual database files are uncompressed.

Now I can double-click on the icon for the mygames database in CB8 and see game headers instead of "Data errors".

If you're very quick on the uptake, you've already spotted the danger of storing a .CBV file in the same folder as the original database from which it was created. If you should accidentally select that .CBV file when accessing File/Open/Database, you'll accidentally overwrite your current database with a previously archived version. This can be very bad, especially if you're not in the habit of making frequent backups. I once talked to a user who had created a .CBV file in the same folder as the original database, manually added a few hundred games to that database over the next few weeks, then accidentally selected the .CBV file from the "Open Database" dialogue. The .CBV file uncompressed and overwrote his database with the last version he'd archived. In an instant, his few hundred new games were gone, with no way of getting that work back.

That's the reason why I strongly urge you to always create your .CBV files in a different folder from the original database. In fact, I created a special folder on my hard drive and named it Archives. Whenever I create a .CBV file, I create it in this folder rather than the original one. This has an additional benefit: when I want to back these files up on a CD, I can just copy the whole folder to the CD as a single operation and get all of my archived databases copied there in one shot.

Some additional tips and pointers:

Backing up data is boring and a pain in the neck, but it beats the pain and embitterment you'll experience when important data gets lost, deleted, overwritten, or corrupted and you realize that you don't have a backup. Again, trust me on this -- been there, done that. Take the time to make backups and when something goes wrong later, you'll be much happier than you'd be if you didn't have a backup.

Until next week, have fun!

You can e-mail me with your comments, suggestions, and analysis for Electronic T-Notes.