Tuesday 17 October 2023

SQL Developer displaying Junk characters (??????)

Change the Encoding in SQL Developer Preferences as below Tools --> Preferences --> Environment --> Encoding --> UTF-8 --> Restart the SQL Developer
After Restart we get the output as below

Monday 16 October 2023

EBS : SQL to find SID from Concurrent Request ID

SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID ,d.inst_id FROM apps.fnd_concurrent_requests a left outer join apps.FND_CONCURRENT_PROCESSES b on a.controlling_manager = b.concurrent_process_id left outer join GV$PROCESS c on c.pid = b.oracle_process_id left outer join GV$SESSION d on b.session_id=d.audsid WHERE a.request_id =&ccr_req_id

Sunday 18 June 2023

Oracle: Purge UINIFIED AUDIT TRAIL

1. Get the count from audsys table:

    select count(1) from audsys.aud$unified;

2. Get the count from unified_audit_trail view:

    select  count(*) from unified_audit_trail;

3. Get the list of unified audit polices with action name and count

select unified_audit_policies,action_name,count(*) from unified_audit_trail group by unified_audit_policies,action_name;

4. Set the Timestamp that to be deleted as here it is set to 10 days before SYSDATE

begin

dbms_audit_mgmt.set_last_archive_timestamp(audit_trail_type=>dbms_audit_mgmt.audit_trail_unified,last_archive_time=>sysdate-10);

end;

/

 5. Execute the below PL/SQL block to delete the UNIFIED_AUDIT_TRAIL to the timestamp set above

set serveroutput on;

begin

DBMS_OUTPUT.PUT_LINE('Time Started: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));

dbms_audit_mgmt.clean_audit_trail(audit_trail_type=>dbms_audit_mgmt.audit_trail_unified

,use_last_arch_timestamp=>TRUE);

DBMS_OUTPUT.PUT_LINE('Time Ended: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));

end;

/

6. Execute the below PL/SQL block to delete All UNIFIED_AUDIT_TRAIL

set serveroutput on;

begin

DBMS_OUTPUT.PUT_LINE('Time Started: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));

DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL(

audit_trail_type         =>  DBMS_AUDIT_MGMT.AUDIT_TRAIL_UNIFIED,

use_last_arch_timestamp  =>  FALSE);

DBMS_OUTPUT.PUT_LINE('Time Ended: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));

end;

/


SQL Developer displaying Junk characters (??????)

Change the Encoding in SQL Developer Preferences as below Tools --> Preferences --> Environment --> Encoding --> UTF...