Tuesday, May 17, 2011

Recover TOCOPY Dataset Not Found

At our site, we use the Copy Utility to take back up of the data. The respective entries are made in the SYSCOPY catalog table. Once I came across an issue in which the TOCOPY dataset was not present.

Now what I was expecting was that the Job will simply abend saying TOCOPY dataset not found, but it ended with Maxcc 4. In the Sysprint I saw that the Recover has picked up the last full image copy dataset whose entry was present in SYSCOPY instead of failing. Now my question was What should I do if I want the restore to abend if the dataset is not found instead of restoring the last full image copy taken?

I asked the same thing in some of the forums and I received very good replies.

"By default, RECOVER looks for the last usable dataset in SYSCOPY. If the last one is unusable, unreachable or whatever RECOVER goes to the next back in time and so on, then applies the necessary log records. The RC 4 probably means the dataset it wanted originally was not found so it had to settle for another one.
If you want to recover from a specific dataset, you can use TOCOPY. Note that this will NOT apply log records and, for an IC taken with SHRLEVEL CHANGE, may leave you with inconsistent data."

"If an image copy dataset has some kind of problem, db2 will look for prior image copies that can be used. Once a valid dataset is found, the tablespace is recovered using that copy as a starting point. You may wonder 'How does db2 get the data to the place I want it?' The answer is log apply. Archived logs, incremental backups, and active logs are applied to get the data to where you want it. BTW, the newer utilities make it easy to do image copies with non-logged operations. If you do non-logged operations (e.g. load log no), then fallback recovery has some limitations. Based on your description, I don't think you had non logged operations or were lucky. BUT, my point is you must take image copies after or with non logged operations."

Hope it helps.

Cheers!!!

No comments:

Post a Comment