DECLARE
v_user_name VARCHAR2(30) := 'SRIKKAMTM'; -- User Name
v_password VARCHAR2(30) := 'Welcome123'; -- Password
-- List of responsibilities to be added automatically
CURSOR cur_get_responsibilities IS
SELECT
resp.responsibility_key,
resp.responsibility_name,
app.application_short_name
FROM
fnd_responsibility_vl resp,
fnd_application app
WHERE
resp.application_id = app.application_id
AND resp.responsibility_name IN ( 'System Administrator', 'Application
Developer' );
BEGIN
fnd_user_pkg.createuser(
x_user_name => upper(v_user_name),
x_owner => NULL,
x_unencrypted_password => v_password,
x_session_number => userenv(
'sessionid'
),
x_start_date => sysdate,
x_end_date => NULL
);
dbms_output.put_line('User '
|| v_user_name
|| ' created !!!!!');
FOR c_get_resp IN cur_get_responsibilities LOOP
fnd_user_pkg.addresp(
username => v_user_name,
resp_app => c_get_resp.application_short_name,
resp_key => c_get_resp.responsibility_key,
security_group => 'STANDARD',
description => NULL,
start_date => sysdate,
end_date => NULL
);
dbms_output.put_line('Responsibility '
|| c_get_resp.responsibility_name
|| ' added !!!!!!');
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception : '
|| substr(
sqlerrm,
1,
500
));
ROLLBACK;
END;
---------
Update Password
SET serveroutput ON;
DECLARE
v_user_name VARCHAR2(30):= UPPER('SYSADMIN');
v_new_password VARCHAR2(30):= 'welcome1';
v_status BOOLEAN;
BEGIN
v_status := fnd_user_pkg.ChangePassword ( username => v_user_name,
newpassword => v_new_password
);
IF v_status THEN
dbms_output.put_line ('The password reset successfully for the User:'||
v_user_name);
COMMIT;
ELSE
DBMS_OUTPUT.put_line ('Unable to reset password due to'||SQLCODE||' '||
SUBSTR(SQLERRM, 1, 100));
ROLLBACK;
END IF;
END;
------------
SELECT usr.user_name,usr.user_id,usr.description,
get_pwd.decrypt
((SELECT (SELECT get_pwd.decrypt
(fnd_web_sec.get_guest_username_pwd,
usertable.encrypted_foundation_password
)
FROM DUAL) AS apps_password
FROM fnd_user usertable
WHERE usertable.user_name =
(SELECT SUBSTR
(fnd_web_sec.get_guest_username_pwd,
1,
INSTR
(fnd_web_sec.get_guest_username_pwd,
'/'
)
- 1
)
FROM DUAL)),
usr.encrypted_user_password
) PASSWORD
FROM fnd_user usr
WHERE usr.user_name IN ('JOHMCCOR'/Jurgen@01) NATFLUTE/5678asdfghj@;