1

When a DB2 database is restored and recovered from backups

  • is the restored database a physical copy - ie: identical block for block with the source database (as it was at time of backup) - and of identical size of source database?

or

  • is the restored database a logical copy - where datafile blocks are reorganized and coalesced (so the most of unused, fragmented free space in datafiles has been removed - causing restored database to often be smaller in storage footprint?
prosoitos
  • 6,679
  • 5
  • 27
  • 41
Tom12345
  • 11
  • 4

2 Answers2

1

It is a page-for-page physical copy, but only of the used extents of pages in each table space. You can not change the logical contents of the data during a restore but you could alter the layout of the physical persistent storage.

There are also some changes you can cause during the restore process which can affect the persistently stored state of the system, such as a redirected restore altering the table space definitions or storage groups, replacing the DB history file, changing the encryption method in use, or upgrading the DB to a new release level.

  • Thanks Kelly . Could you please elaborate "but only of the used extents of pages in each table space". ? – Tom12345 Oct 31 '19 at 08:59
  • @Tom12345 , as others have commented here, if you had for instance a DMS table space with much more storage pre-allocated than is in use at the time of the BACKUP operation, free (unused) extents of pages would not be copied into the backup image. Space in the table space containers on disk/SSD which is freely available for use by new rows of data, either because that space was allocated and never used or because the data has been deleted and space free'd up for re-use, are not necessarily included in the backup image. – Kelly Rodger Nov 01 '19 at 14:10
0

It's a page-for-page physical copy. (This is why you can't, for example, backup on a little-endian system and restore onto a big-endian system.)

  • Does it actually copy empty pages above the HWM though? Judging by the image size it doesn't look like it. – mustaccio Oct 30 '19 at 17:40
  • My understanding is that free extents above HWM are reclaimed on the source DB side at the start of the backup, and this will also be reflected on the target after the restore. – David Mooney Oct 30 '19 at 20:58
  • Interestingly, DMS containers are nevertheless restored to their original, "Max HWM" sizes. – mustaccio Oct 30 '19 at 22:32
  • mustaccio .. Does it mean ... "max HWM" and "HWM" values in restored database will remains same as in source database but storage will be used as per HWM value only? – Tom12345 Oct 31 '19 at 09:07
  • No, it's the opposite: Max HWM moves back to HWM, but the container size is at Max HWM. – mustaccio Oct 31 '19 at 15:54