Sunday, July 28, 2013

Jserv Log in 11i/R12

R12
$LOG_HOME/ora/10.1.3/opmn

11i
$IAS_ORACLE_HOME/Apache/Jserv/logs/jvm

Monday, January 7, 2013

FND User creation script


Oracle provides below API to create FND User.

/*procedure FND_USER_PKG.CreateUser (
  x_user_name                  in varchar2,
  x_owner                      in varchar2,
  x_unencrypted_password       in varchar2 default null,
  x_session_number             in number default 0,
  x_start_date                 in date default sysdate,
  x_end_date                   in date default null,
  x_last_logon_date            in date default null,
  x_description                in varchar2 default null,
  x_password_date              in date default null,
  x_password_accesses_left     in number default null,
  x_password_lifespan_accesses in number default null,
  x_password_lifespan_days     in number default null,
  x_employee_id                in number default null,
  x_email_address              in varchar2 default null,
  x_fax                        in varchar2 default null,
  x_customer_id                in number default null,
  x_supplier_id                in number default null)
*/

Below is an example of the above seeded API. You may add/remore parameters based on your requirement.  

DECLARE
   l_user_name             VARCHAR2(100)  := 'TEST_FND_USER';
   l_user_password         VARCHAR2(100)  := 'welcome1';
   l_password_date         VARCHAR2(100)  := SYSDATE;
   l_password_lifespan_days    NUMBER     := 90;
   l_email_address         VARCHAR2(100) := 'test@default.com';

BEGIN
  FND_USER_PKG.CREATEUSER
  (  x_user_name            => l_user_name,
     x_owner                => NULL,
     x_unencrypted_password => l_user_password,
     x_password_date        => l_password_date,
     x_password_lifespan_days   => l_password_lifespan_days,
     x_email_address        => l_email_address
 );

 COMMIT;

 DBMS_OUTPUT.PUT_LINE('Apps User ' || l_user_name || ' has been successfully created');

EXCEPTION
       WHEN OTHERS THEN
           ROLLBACK;
           DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;

Monday, December 31, 2012

Reset an Oracle Apps User Password via script


DECLARE
      l_ret_val BOOLEAN;
      l_user_name   varchar2(50) := '&USER_NAME';
      l_new_pwd     varchar2(20) := '&PASSWORD';
BEGIN
      l_ret_val :=
           fnd_user_pkg.changepassword(username=> l_user_name
                                      ,newpassword => l_new_pwd);
     IF l_ret_val
     THEN
           DBMS_OUTPUT.PUT_LINE('The password is successfully reset to '||  l_new_pwd);
           COMMIT;
     ELSE
           DBMS_OUTPUT.PUT_LINE('The password reset has failed');
     END IF;
END;

Adding Responsibility to the Oracle Apps User using SQL Script


DECLARE

   CURSOR C_RESP
   IS
      SELECT fav.application_short_name,
             fav.application_name,
             frv.responsibility_key,
             frv.responsibility_name
        FROM FND_APPLICATION_VL fav, FND_RESPONSIBILITY_VL frv
       WHERE     frv.application_id = fav.application_id
             AND frv.responsibility_name IN
                    ('System Administrator',
                     'Functional Administrator',
                     'Application Developer');


   l_user_name         VARCHAR2 (15) := '&USER_NAME';
   l_appl_short_name   fnd_application_vl.application_short_name%TYPE;
   l_resp_name         FND_RESPONSIBILITY_VL.responsibility_name%TYPE;
   l_resp_key          FND_RESPONSIBILITY_VL.responsibility_key%TYPE;

   l_description       VARCHAR2 (100)
                          := 'Adding Responsibility to the user using script';
BEGIN

  FOR resp_rec IN C_RESP
  LOOP
     l_appl_short_name := resp_rec.application_short_name;
     l_resp_key := resp_rec.responsibility_key;
     l_resp_name := resp_rec.responsibility_name;

     BEGIN
        FND_USER_PKG.ADDRESP (username         => l_user_name,
                              resp_app         => l_appl_short_name,
                              resp_key         => l_resp_key,
                              security_group   => 'STANDARD',
                              description      => l_description,
                              start_date       => SYSDATE,
                              end_date         => NULL);
        COMMIT;
        DBMS_OUTPUT.put_line (
              'The responsibility '
           || l_resp_name
           || ' is added to the user '
           || l_user_name);
     EXCEPTION
        WHEN OTHERS
        THEN
           DBMS_OUTPUT.put_line (
                 'Responsibility '
              || l_resp_name
              || ' IS NOT added to the user '
              || l_user_name
              || ' due to '
              || SQLCODE
              || '; '
              || SUBSTR (SQLERRM, 1, 250));
           DBMS_OUTPUT.put_line ('');
           ROLLBACK;
     END;
  END LOOP;
END;

Tuesday, February 7, 2012