Click here to Skip to main content
15,885,767 members
Articles / Oracle
Alternative
Tip/Trick

How to Change Password in Oracle

Rate me:
Please Sign up or sign in to vote.
4.86/5 (4 votes)
26 Jul 2015CPOL2 min read 18.4K   4  
This alternative is created to correct few mistakes in the original tip. Most importantly: Never update system tables.

This is not meant as an alternative to the original tip "How to Change Password in Oracle" but as a clarification for changing passwords.

One option to change the password is to include the new password to a GRANT statement, for example:

SQL
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 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. The change is automatically effective.

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. In the unlikely event that this would work out as it should, 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)


Written By
Architect
Europe Europe
Biography provided

Comments and Discussions

 
-- There are no messages in this forum --