SQL0970N The system attempted to write to a read-only file. SQLSTATE=55009
I looked at the db2diag.log and found following message.
INSTANCE: inst2 NODE : 000 DB : {existing db name} EDUID : 9933 EDUNAME: db2loggr ({existing db name}) 0 FUNCTION: DB2 UDB, oper system services, sqlomkdirp, probe:10 MESSAGE : ZRC=0x840F0001=-2079391743=SQLO_ACCD "Access Denied" DIA8701C Access denied for resource "", operating system return code was "". CALLED : OS, -, mkdir OSERR : EACCES (13) "Permission denied" DATA #1 : File name, 78 bytes /home/inst1/db2fs/inst1/NODE0000/{old db name}/LOGARC/inst2/{existing db name}/NODE0000/C0000001/ DATA #2 : signed integer, 4 bytes 488 DATA #3 : signed integer, 4 bytes 488 DATA #4 : String, 105 bytes Search for ossError*Analysis probe point after this log entry for further self-diagnosis of this problem.
Looks like db2 still tries to restore to the path that is there hidden in the backup set. In my case inst2 was trying to restore on inst1's (db) file system paths, to which it did not had access permissions.
So whats the solution ? use following format of restore command.
db2 "RESTORE DB {dbname in image} FROM {backup image file path} TAKEN AT {timestamp} ON {db2fs_path} DBPATH ON {db_path} INTO {existing db name} db2 "rollforward db {existing db name} complete"
And this the case with "automatic storage tablespace paths" and I guess the DMS should not have this issue.