Malformed String Errors During Restores
During a restore operation, most likely when restoring a backup taken using an older gbak
version, it is possible to see failure messages, in gbak
's output, indicating malformed Unicode strings.The reason that these may occur is as explained by Helen Borrie:
The source text of stored procedures (and several other types of object, such as CHECK constraints) is stored in a blob, as is the "compiled" BLR code.When you restore a database, the BLR is not recreated: the same BLR is used until next time you recreate or alter the object.
Historically, the engine did not do the right thing regarding the transliteration of strings embedded in the source and the BLR.In v.2.1 and 2.5 a lot of work was done to address the international language issues, as you probably know.A side effect of this was that everything that was read from data and meta data became subject to "well-formedness" checks.Hence, on restoring, those previously stored source and BLR objects are throwing "malformed string" errors when gbak tries to read and write the data in these system table records.This very old bug affects user blobs, too, if they have been stored using character set NONE and the client is configured to read a specified character set to which the stored data could not be transliterated.
In v.2.1 there were scripts in ../misc that you could run to repair the meta data blobs and also use as a template for repairing the similar errors in blobs in your user data.The repair switches were added to the gbak restore code in v.2.5 to do the same corrections to meta data and data, respectively, during the process of restoring a database for upgrade.