User rename in Confluence
Asked by Sri Deppthi:

Hi,

I'm trying to rename users in confluence4.2 with the below updates and it doesn't seems to be working.

Though it renamed the user (over user search from UI), when I click on the username I have an error

```
org.apache.velocity.exception.MethodInvocationException: 
Invocation of method 'canRemove' in  class com.atlassian.confluence.user.actions.ViewUserAction threw exception java.lang.NullPointerException at /admin/users/viewuser.vm[line 141, column 42]

Please help in fixing 
```

update attachments atach set atach.creator = c1_rec.newusername WHERE atach.creator = c1_rec.oldusername;  
update attachments atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update content atach set atach.creator = c1_rec.newusername WHERE atach.creator = c1_rec.oldusername;  
update content atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update content atach set atach.username = c1_rec.newusername where atach.username = c1_rec.oldusername;  
update content_label atach set atach.owner = c1_rec.newusername where atach.owner = c1_rec.oldusername;  
update content_perm atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update content_perm atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update content_perm atach set atach.username = c1_rec.newusername where atach.username = c1_rec.oldusername;  
update cwd_user atach set atach.lower_user_name = c1_rec.newusername where atach.lower_user_name = c1_rec.oldusername;  
update cwd_user atach set atach.user_name = c1_rec.newusername where atach.user_name = c1_rec.oldusername;  
update extrnlnks atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update extrnlnks atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update follow_connections atach set atach.followee = c1_rec.newusername where atach.followee = c1_rec.oldusername;  
update follow_connections atach set atach.follower = c1_rec.newusername where atach.follower = c1_rec.oldusername;  
update label atach set atach.owner = c1_rec.newusername where atach.owner = c1_rec.oldusername;  
update links atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update links atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update notifications atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update notifications atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update notifications atach set atach.username = c1_rec.newusername where atach.username = c1_rec.oldusername;  
update pagetemplates atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update pagetemplates atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update remembermetoken atach set atach.username = c1_rec.newusername where atach.username = c1_rec.oldusername;  
update spacegroups atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update spacegroups atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update spacepermissions atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update spacepermissions atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update spacepermissions atach set atach.permusername = c1_rec.newusername where atach.permusername = c1_rec.oldusername;  
update spaces atach set atach.spacename = '\~' \|\| c1_rec.newusername where atach.spacename = '\~' \|\| c1_rec.oldusername;  
update spaces atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update trackbacklinks atach set atach.creator = c1_rec.newusername where atach.creator = c1_rec.oldusername;  
update trackbacklinks atach set atach.lastmodifier = c1_rec.newusername where atach.lastmodifier = c1_rec.oldusername;  
update os_propertyentry atach set atach.entity_name = 'CWD_' \|\| c1_rec.newusername where atach.entity_name = 'CWD_' \|\| c1_rec.oldusername;  
update spaces atach set atach.spacekey = '\~' \|\| c1_rec.newusername where atach.spacekey = '\~' \|\| c1_rec.oldusername;  
update bandana atach set atach.bandanacontext = '\~' \|\| c1_rec.newusername where atach.bandanacontext = '\~' \|\| c1_rec.oldusername;  
update bandana atach set atach.bandanavalue = '\~' \|\| c1_rec.newusername where atach.bandanacontext = '\~' \|\| c1_rec.oldusername;  
update bandana atach set atach.bandanavalue = replace(bandanavalue, '\~' \|\| c1_rec.oldusername, '\~' \|\| c1_rec.newusername);  
update bodycontent atach set atach.body = replace(body, '\~' \|\| c1_rec.oldusername, '\~' \|\| c1_rec.newusername);


Answers:
author: Amalia
body: Not sure how you did a username changing, but this doco might help: <https://confluence.atlassian.com/display/DOC/Changing+Usernames>

comments: author: Sri Deppthi
body: I went through the doc and covered all the tables listed under MySql script. I have made the changes to run for Oracle11g. Pls, help in fixing this


author: Amalia
body: Does this comment help? <https://confluence.atlassian.com/display/DOC/Changing+Usernames?focusedCommentId=269982098#comment-269982098>


author: Sri Deppthi
body: I got the script working when I have added Lower for usernames.

Thanks for the help