Tuesday, August 27, 2013

Transfer object owner to a new profile during deletion of a user

On IBM i every object has an owner. Normally the owner of an object is the creator of the object. When you want to delete an user with DLTUSRPRF which is still the owner of objects you will get a CPF2215 error that the deletion of the user is not allowed. You can view all objects an user owns with  "WRKOBJOWN USERPRF(username)". One possible solution for the CPF2215 is to change the owner of all objects in the WRKOBJOWN overview to another user.

But there is a much easier way to solve this problem. Add the parameter "OWNOBJOPT(*CHGOWN newowner)" to the DLTUSRPRF command and all owned objects will be transfered to the newowner automatically.

An example - the admin want to delete "usera" and want to transfer all objects to "userb":

DLTUSRPRF USRPRF(usera) OWNOBJOPT(*CHGOWN userb)

No comments:

Post a Comment

ad