Monday 8 February 2016

How to change the database username(i.e SCHEMA name)

If you want to modify a schema's name,you should have the privileged on USER$

1. Get Id of a schema's name

SQL> select user#,NAME from SYS.user$ WHERE NAME='E';

     USER# NAME
---------- ------------------------------
       104 E

Let's check what object has schema contains..so that after the change of the name of the schema,we can confirm,we have sucessfully did the changes by having every objects of the old schemaname.


2. modify the schema's name
 
SQL> UPDATE USER$ SET NAME='NEW_SCHEMA_NAME' WHERE USER#=104;

SQL> UPDATE USER$ SET NAME='F' WHERE USER#=104;

 

3. Shutdown the database and restart the database


 

4. Check whether the schema name has changed or not.

SQL> select user#,NAME from SYS.user$ WHERE user#=104;

     USER# NAME
---------- ------------------------------
       104 F
 
 5. Change the password of newly created schemname.
 
Alter user F identified by f;
 
6. Check whether new schema contains the old schema objects or not.
 
 
 
Done !!!

References

http://stackoverflow.com/questions/18730850/how-to-change-schema-name

No comments:

Post a Comment