API to end date responsibility from fnd user

End date oracle Responsibility from Oracle FND User:-

Being Oracle Database administrator, we are using various API scripts to do the administrative task in Oracle Database.Before executing script we should test it on test/dev instance, then migrate the solution/script to production carefully. Here we are discussing 'how to end date responsibility in oracle apps from backend' using API.

Copy below api to remove responsibility in oracle apps from backend.

-- -----------------------------------------------------------------
-- API to end date user responsibility in oracle apps
-- -----------------------------------------------------------------
DECLARE
   v_user_name                   VARCHAR2 (100) := '&Enter_FND_LOGIN';
   v_responsibility_name   VARCHAR2 (100) := '&Enter_Responsibility_name';
   v_application_name        VARCHAR2 (100) := NULL;
   v_responsibility_key        VARCHAR2 (100) := NULL;
   v_security_group              VARCHAR2 (100) := NULL;


BEGIN
   SELECT  fa.application_short_name,
                     fr.responsibility_key,
                     frg.security_group_key
    INTO        v_application_name,
                      v_responsibility_key,
                      v_security_group
    FROM      fnd_responsibility       fr,
                     fnd_application            fa,
                     fnd_security_groups  frg,
                     fnd_responsibility_tl   frt
    WHERE  fr.application_id               = fa.application_id
     AND        fr.data_group_id             = frg.security_group_id
     AND        fr.responsibility_id          = frt.responsibility_id
     AND        frt.LANGUAGE                 = USERENV ('LANG')
     AND        frt.responsibility_name  = v_responsibility_name;

      fnd_user_pkg.delresp
      (    username           => v_user_name,
           resp_app            => v_application_name,
           resp_key             => v_responsibility_key,
           security_group   => v_security_group
      );

     COMMIT;

     DBMS_OUTPUT.put_line (   'Responsiblity '
        || v_responsibility_name
        || ' is removed from the user '
        || v_user_name
        || ' Successfully'
        );


EXCEPTION
     WHEN OTHERS THEN
              DBMS_OUTPUT.put_line
               (   'Error encountered while deleting responsibilty from the user and the error is '
                    || SQLERRM
                );
END;
/



API to add responsibility to user in oracle apps from backend

Assign responsibility to user in oracle apps from backend | Being Oracle Database administrator, we are using various API scripts to do the administrative task in Oracle Database.Before executing script we should test it on test/dev instance, then migrate the solution to production carefully. Here we are discussing 'how to add responsibility in oracle apps from backend' using API.



Copy below api script to add responsibility to FND User .

----------------------------------------------------------------
---------API Script to add responsibility to user in oracle apps
----------------------------------------------------------------
DECLARE
   v_user_name             VARCHAR2 (30)  := '&user_name';
   v_responsibility_name   VARCHAR2 (100) := '&Enter_responsibility_name';
   v_application_name      VARCHAR2 (100) := NULL;
   v_responsibility_key    VARCHAR2 (100) := NULL;
   v_security_group        VARCHAR2 (100) := NULL;
   v_description           VARCHAR2 (100) := NULL;
BEGIN
   SELECT fa.application_short_name, fr.responsibility_key,
          fsg.security_group_key, frt.description
     INTO v_application_name, v_responsibility_key,
          v_security_group, v_description
     FROM apps.fnd_responsibility fr,
          fnd_application fa,
          fnd_security_groups fsg,
          fnd_responsibility_tl frt
    WHERE frt.responsibility_name = v_responsibility_name
      AND frt.LANGUAGE = USERENV ('LANG')
      AND frt.responsibility_id = fr.responsibility_id
      AND fr.application_id = fa.application_id
      AND fr.data_group_id = fsg.security_group_id;

   fnd_user_pkg.addresp (username            => v_user_name,
                         resp_app            => v_application_name,
                         resp_key            => v_responsibility_key,
                         security_group      => v_security_group,
                         description         => v_description,
                         start_date          => SYSDATE,
                         end_date            => NULL
                        );
   COMMIT;
   DBMS_OUTPUT.put_line(   'Responsiblity '
                         || v_responsibility_name
                         || ' is attached to the user '
                         || v_user_name
                         || ' Successfully'
                        );
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line
                         (   'Unable to attach responsibility to user due to'
                          || SQLCODE
                          || ' '
                          || SUBSTR (SQLERRM, 1, 100)
                         );

END;
/
SHOW ERR;





It's your turn!

What do you think? Share your experience in the comments box below.⤋

rman catalog commands to register old backupset

RMAN catalog command tips | To restore the oracle database using rman , first of all we have to Cataloging RMAN backup in RMAN Catalog. There are many rman catalog commands to register the rman catalog backup piece to new location, so that rman read the backup piece and restore them. Below are some RMAN CATALOG command example.


#Catalog as Backuppiece 
in RMAN repository:-

If you wiil execute 'CATALOG BACKUPPIECE' backup will cataloged by piece. We have to run the CATALOG BACKUPPIECE command for every Backuppiece from different location so that rman register old backupset. Once all Backup piece will cataloged , start restoration oracle database.

RMAN> CATALOG BACKUPPIECE '/DATA01/BACKUP/PROD_2123.BKP';



#Catalog as Whole bakuppiece 
in RMAN repository:-

Here RMAN CATALOG START WITH command,will catalog all backup piece in single execution. Here no need to run one by one, it will cataloged all backup piece, once we will run CATALOG BACKUPPIECE with exact Backup location. 


RMAN> CATALOG START WITH '/DATA01/BACKUP/';


using target database control file instead of recovery catalog
searching for all files that match the pattern /DATA01/BACKUP/

List of Files Unknown to the Database
=====================================


File Name: /DATA01/BACKUP/DB_1_20180904_22226.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22224.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22212.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22211.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22205.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22219.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22213.rbkp
File Name: /DATA01/BACKUP/CNT_1_20180904_22238.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22229.rbkp
File Name: /DATA01/BACKUP/DB_1_20180904_22225.rbkp

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done



Now we have ‘catalog backup piece from disk ‘ , Need to do the restoration steps.



#Catalog archive log in RMAN repository.

RMAN> CATALOG ARCHIVELOG  '/oradata/archive/archive_100.dbf','/oradata/archive/archive_101.dbf';


#Catalog data filecopy in RMAN repository.

RMAN> CATALOG DATAFILECOPY '/oradata/datafile/users01.dbf' LEVEL 0;


#Catalog user managed controlfile copy in RMAN repository.


SQL> alter database backup controlfile as '/tmp/control01.ctl';

RMAN> CATALOG controlfilecopy '/tmp/control01.ctl';



#Catalog file in Flash Recovery Area and Recovery file destination in RMAN repository.



RMAN> CATALOG RECOVERY AREA NOPROMPT;


RMAN> CATALOG DB_RECOVERY_FILE_DEST;