DBA Tips Archive for Oracle

  


Using the REPLACE Keyword with ALTER USER

by Jeff Hunter, Sr. Database Administrator

The REPLACE keyword is new to Oracle 9.2. In previous versions of Oracle, any user could change their password using the ALTER USER statement. Keep in mind that this included all users regardless of whether they had the ALTER USER system privilege.

With Oracle 9.2 and higher, if you do not have the system privilege ALTER USER and there is a PASSWORD_VERIFY_FUNCTION associated with a profile that is assigned to that user, then you must use the REPLACE keyword along with the old password. If you have the ALTER USER system privilege, then you do not need to use REPLACE.

The following is a sample session I put together. The user ecartman does not initially have the ALTER USER privilege and is assigned the USER_PROFILE profile that has a PASSWORD_VERIFY_FUNCTION.


SQL> connect ecartman/southpark Connected. SQL> alter user ecartman identified by newpassword123#; alter user ecartman identified by newpassword * ERROR at line 1: ORA-28221: REPLACE not specified SQL> alter user ecartman identified by newpassword123# replace southpark; User altered. SQL> connect system/manager Connected. SQL> grant alter user to ecartman; Grant succeeded. SQL> connect ecartman/newpassword123# Connected. SQL> alter user ecartman identified by southpark123$; User altered.



Copyright (c) 1998-2014 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Tuesday, 04-Sep-2012 00:24:38 EDT
Page Count: 52558