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:
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
- 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
. - As far as I know, the password is encrypted in
sys.user$
so setting the password in non-encrypted format won't work correctly. - 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.