-- To Change user name without changing password.
-- Apllies to: Any Oracle version (Tested version more than 10.1.x.x.x)
-- Requirement: Some times a dumy user may be converted to prod user and vise-versa. If any L2 support user left and same to be assigned to new user etc.
-- Collect user details
sql> select user#,name from sys.user$ where username='HR_DUMY';
-- Give data to change
sql> update sys.user$ set name='HR_PROD' where user#=285 and name='HR_DUMY';
-- To change similar kind of users at one go
-- Manually change required name for set name
sql> select 'update sys.user$ set name='''||username||''' where user#='||
user_id||' and name='''||username||''';'
from all_users where username like '%_UAT'
-- If password to reset
sql>select 'alter user '||username||' identified by '||username||';'
from all_users where username like '%_PROD';
Hope this approch will minimize to drop and re-create user details and give grants.
Thanks & Regards
-- Apllies to: Any Oracle version (Tested version more than 10.1.x.x.x)
-- Requirement: Some times a dumy user may be converted to prod user and vise-versa. If any L2 support user left and same to be assigned to new user etc.
-- Collect user details
sql> select user#,name from sys.user$ where username='HR_DUMY';
-- Give data to change
sql> update sys.user$ set name='HR_PROD' where user#=285 and name='HR_DUMY';
-- To change similar kind of users at one go
-- Manually change required name for set name
sql> select 'update sys.user$ set name='''||username||''' where user#='||
user_id||' and name='''||username||''';'
from all_users where username like '%_UAT'
-- If password to reset
sql>select 'alter user '||username||' identified by '||username||';'
from all_users where username like '%_PROD';
Hope this approch will minimize to drop and re-create user details and give grants.
Thanks & Regards
No comments:
Post a Comment