|
In situations where many users log on to the database with a single account, it is very important to prevent a user from changing the password. The following article provides code that enables a DBA to prevent certain users to change their password. The following function can be used to prevent a user from changing their password. This function requires use of a USER PROFILE to activate the function. This script MUST be run while connected as the SYS user.
Create the function
Connect as sysdba
set term on
set echo on
CREATE OR REPLACE FUNCTION verify_function_fix_pwd (
username VARCHAR2
, password VARCHAR2
, old_password VARCHAR2) RETURN boolean IS
BEGIN
raise_application_error(-20009, 'ERROR: Password cannot be changed');
END;
/
show errors
Create profile
The following profile will contain a limit PASSWORD_VERIFY_FUNCTION associated to the previously created function.
This profile must be assigned to all users who are NOT allowed to change their password.
Connect to user test_pwd Try to change the password |