Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

How to Change Password in Oracle

, 21 Feb 2011
Rate this:
Please Sign up or sign in to vote.
One option to change the password is to include the new password to a GRANT statement, for example:GRANT CONNECT TO SomeUser IDENTIFIED BY SomePassword;However be careful: If you specify a non-existent user, the user will be created so it's easy to mistakenly create unwanted users.Few...
One option to change the password is to include the new password to a GRANT statement, for example:
GRANT CONNECT TO SomeUser IDENTIFIED BY SomePassword;
However be careful: If you specify a non-existent user, the user will be created so it's easy to mistakenly create unwanted users.
 

Few comments on the original trick:
 
General comment:
In your examples, the passwords are changed for users, not roles. Role password is a different thing and is defined typically using CREATE ROLE statement.
 
Option B:
kaveh Yazdi Nezhad wrote:
if you wante to change sys/system password , you have to work a little more :
1- connect to oracle
2- run this command :
alter user sys/system identified by newpassword;
3- restart your oracle service or your O.S

 
ALTER USER can be used for any user (as long as you have the necessary privileges), not only for SYS or SYSTEM.
 
Also there's no need to restart the database instance when using ALTER USER.
 
Option C:
 
kaveh Yazdi Nezhad wrote:
You can use Update command :
update sys.user$ set password='Newpass' where name='SCOTT';
it's needed to mention that sys/system passwords will change after system/service restart and before that still you can connect with old passwords

 
1. In my opinion, this is something that should never be done. System tables are not meant to be modified using DML statements instead we have the necessary DDL statements such as ALTER USER.
 
2. As far as I know, the password is encrypted in sys.user$ so setting the password in non-encrypted format won't work correctly.
 
3. If the password is changed by updating sys.user$ I believe that instance restart is needed in order to reset the password in SGA.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Mika Wendelius
Architect
Finland Finland
I've been a programmer since mid 80's using languages like assembler, C/C++, PL/I (mainframe environment), pascal, VB (I know, I know, no comments please) and C# and utilizing different techniques and tools.
 
However I'm specialized in databases and database modeling. Mostly I have used products like Oracle (from version 6), SQL Server (from version 4.2), DB2 and Solid Server (nowadays an IBM product).
 
For the past 10+ years my main concerns have been dealing with different business processes and how to create software to implement and improve them. At my spare time (what ever that actually means) I'm also teaching and consulting on different areas of database management, development and database oriented software design.

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 22 Feb 2011
Article Copyright 2011 by Mika Wendelius
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid