Monday, November 28, 2022

Database Initialization Parameters for Oracle 19c

 

Database Initialization Parameters for Oracle 19c

1 Required Parameters

The following list describes database initialization parameters required for this specific release of the Oracle Database 19c and is in addition to the common database initialization parameters which can be referred to in note 396009.1.

####################################################################
#
# Oracle E-Business Suite Release 12
# Release-Specific Database Initialization Parameters for 19c
#
####################################################################

compatible = 19.0.0 #MP
optimizer_adaptive_plans = TRUE #MP
optimizer_adaptive_statistics = FALSE #MP
pga_aggregate_limit = 0 #MP
temp_undo_enabled = FALSE
_pdb_name_case_sensitive = TRUE #MP
event='10946 trace name context forever, level 8454144' #MP
_optimizer_gather_stats_on_conventional_dml = FALSE #MP
_optimizer_use_stats_on_conventional_dml = FALSE #MP
optimizer_real_time_statistics = FALSE #MP


###############################################################################
#
# End of Release-Specific Database Initialization Parameters Section for 19c
#
###############################################################################

2 Parameter Removal List for Oracle Database 19c

If they exist, you should remove the following parameters from your database initialization parameters file for Oracle Database 19c.

Note: Parameters may appear on a "removal list" because they are obsolete; because the default value is required and no other value may be set; or to cater for certain special cases where a non-default value has to be set to meet specific needs (currently, there is only one such case, which is described in Section 6).

_kks_use_mutex_pin
_shared_pool_reserved_min_alloc
_sqlexec_progression_cost
exafusion_enabled
exclude_seed_cdb_view
global_context_pool_size
max_enabled_roles
o7_dictionary_accessibility
olap_page_pool_size
optimizer_adaptive_features
optimizer_features_enable
parallel_automatic_tuning
parallel_degree_level
parallel_io_cap_enabled
parallel_server
parallel_server_instances
plsql_compiler_flags
plsql_native_library_dir
plsql_native_library_subdir_count
plsql_optimize_level
standby_archive_dest
timed_statistics
use_indirect_data_buffers
utl_file_dir

 

Thursday, November 24, 2022

DB LINKS

 The following script queries the DBA_DB_LINKS view to access link information:

COL OWNER FORMAT a10

COL USERNAME FORMAT A8 HEADING "USER"

COL DB_LINK FORMAT A30

COL HOST FORMAT A7 HEADING "SERVICE"

SELECT * FROM DBA_DB_LINKS

/




COL DB_LINK FORMAT A25

COL OWNER_ID FORMAT 99999 HEADING "OWNID"

COL LOGGED_ON FORMAT A5 HEADING "LOGON"

COL HETEROGENEOUS FORMAT A5 HEADING "HETER"

COL PROTOCOL FORMAT A8

COL OPEN_CURSORS FORMAT 999 HEADING "OPN_CUR"

COL IN_TRANSACTION FORMAT A3 HEADING "TXN"

COL UPDATE_SENT FORMAT A6 HEADING "UPDATE"

COL COMMIT_POINT_STRENGTH FORMAT 99999 HEADING "C_P_S"

SELECT * FROM V$DBLINK

/



Example 32-1 Determining the Host of Outgoing Database Links

This query results show the connect data, including the host name, for each outgoing

database link.


SELECT DB_LINK, DBMS_TNS.RESOLVE_TNSNAME(HOST) FROM DBA_DB_LINKS;



SELECT DB_NAME, HOST_NAME, FIRST_LOGON_TIME, LAST_LOGON_TIME

 FROM DBA_DB_LINK_SOURCES;


Monday, November 7, 2022

Performance Tunning

 SQL History:

All in one:


set lines 1000 pages 9999

COL instance_number FOR 9999 HEA 'Inst';

COL end_time HEA 'End Time';

COL plan_hash_value HEA 'Plan|Hash Value';

COL executions_total FOR 999,999 HEA 'Execs|Total';

COL rows_per_exec HEA 'Rows Per Exec';

COL et_secs_per_exec HEA 'Elap Secs|Per Exec';

COL cpu_secs_per_exec HEA 'CPU Secs|Per Exec';

COL io_secs_per_exec HEA 'IO Secs|Per Exec';

COL cl_secs_per_exec HEA 'Clus Secs|Per Exec';

COL ap_secs_per_exec HEA 'App Secs|Per Exec';

COL cc_secs_per_exec HEA 'Conc Secs|Per Exec';

COL pl_secs_per_exec HEA 'PLSQL Secs|Per Exec';

COL ja_secs_per_exec HEA 'Java Secs|Per Exec';

SELECT 'gv$dba_hist_sqlstat' source,h.instance_number,

TO_CHAR(CAST(s.begin_interval_time AS DATE), 'DD-MM-YYYY HH24:MI') snap_time,

TO_CHAR(CAST(s.end_interval_time AS DATE), 'DD-MM-YYYY HH24:MI') end_time,

h.sql_id,

h.plan_hash_value,

h.executions_total,

TO_CHAR(ROUND(h.rows_processed_total / h.executions_total), '999,999,999,999') rows_per_exec,

TO_CHAR(ROUND(h.elapsed_time_total / h.executions_total / 1e6, 3), '999,990.000') et_secs_per_exec,

TO_CHAR(ROUND(h.cpu_time_total / h.executions_total / 1e6, 3), '999,990.000') cpu_secs_per_exec,

TO_CHAR(ROUND(h.iowait_total / h.executions_total / 1e6, 3), '999,990.000') io_secs_per_exec,

TO_CHAR(ROUND(h.clwait_total / h.executions_total / 1e6, 3), '999,990.000') cl_secs_per_exec,

TO_CHAR(ROUND(h.apwait_total / h.executions_total / 1e6, 3), '999,990.000') ap_secs_per_exec,

TO_CHAR(ROUND(h.ccwait_total / h.executions_total / 1e6, 3), '999,990.000') cc_secs_per_exec,

TO_CHAR(ROUND(h.plsexec_time_total / h.executions_total / 1e6, 3), '999,990.000') pl_secs_per_exec,

TO_CHAR(ROUND(h.javexec_time_total / h.executions_total / 1e6, 3), '999,990.000') ja_secs_per_exec

FROM dba_hist_sqlstat h, dba_hist_snapshot s WHERE h.sql_id = '&sql_id'

AND h.executions_total > 0 AND s.snap_id = h.snap_id

AND s.dbid = h.dbid AND s.instance_number = h.instance_number

UNION ALL

SELECT 'gv$sqlarea_plan_hash' source,h.inst_id,

TO_CHAR(sysdate, 'DD-MM-YYYY HH24:MI') snap_time,

TO_CHAR(sysdate, 'DD-MM-YYYY HH24:MI') end_time,

h.sql_id, h.plan_hash_value, h.executions,

TO_CHAR(ROUND(h.rows_processed / h.executions), '999,999,999,999') rows_per_exec,

TO_CHAR(ROUND(h.elapsed_time / h.executions / 1e6, 3), '999,990.000') et_secs_per_exec,

TO_CHAR(ROUND(h.cpu_time / h.executions / 1e6, 3), '999,990.000') cpu_secs_per_exec,

TO_CHAR(ROUND(h.USER_IO_WAIT_TIME / h.executions / 1e6, 3), '999,990.000') io_secs_per_exec,

TO_CHAR(ROUND(h.CLUSTER_WAIT_TIME / h.executions / 1e6, 3), '999,990.000') cl_secs_per_exec,

TO_CHAR(ROUND(h.APPLICATION_WAIT_TIME / h.executions / 1e6, 3), '999,990.000') ap_secs_per_exec,

TO_CHAR(ROUND(h.CLUSTER_WAIT_TIME / h.executions / 1e6, 3), '999,990.000') cc_secs_per_exec,

TO_CHAR(ROUND(h.PLSQL_EXEC_TIME / h.executions / 1e6, 3), '999,990.000') pl_secs_per_exec,

TO_CHAR(ROUND(h.JAVA_EXEC_TIME / h.executions / 1e6, 3), '999,990.000') ja_secs_per_exec

FROM gv$sqlarea_plan_hash h

WHERE h.sql_id = '&&sql_id'

AND h.executions > 0

order by source ;


AWR DATA:


set lines 1000 pages 9999

COL instance_number FOR 9999 HEA 'Inst';

COL end_time HEA 'End Time';

COL plan_hash_value HEA 'Plan|Hash Value';

COL executions_total FOR 999,999 HEA 'Execs|Total';

COL rows_per_exec HEA 'Rows Per Exec';

COL et_secs_per_exec HEA 'Elap Secs|Per Exec';

COL cpu_secs_per_exec HEA 'CPU Secs|Per Exec';

COL io_secs_per_exec HEA 'IO Secs|Per Exec';

COL cl_secs_per_exec HEA 'Clus Secs|Per Exec';

COL ap_secs_per_exec HEA 'App Secs|Per Exec';

COL cc_secs_per_exec HEA 'Conc Secs|Per Exec';

COL pl_secs_per_exec HEA 'PLSQL Secs|Per Exec';

COL ja_secs_per_exec HEA 'Java Secs|Per Exec';

SELECT h.instance_number,

TO_CHAR(CAST(s.begin_interval_time AS DATE), 'DD-MM-YYYY HH24:MI') snap_time,

TO_CHAR(CAST(s.end_interval_time AS DATE), 'DD-MM-YYYY HH24:MI') end_time,

h.sql_id, h.plan_hash_value, h.executions_total,

TO_CHAR(ROUND(h.rows_processed_total / h.executions_total), '999,999,999,999') rows_per_exec,

TO_CHAR(ROUND(h.elapsed_time_total / h.executions_total / 1e6, 3), '999,990.000') et_secs_per_exec,

TO_CHAR(ROUND(h.cpu_time_total / h.executions_total / 1e6, 3), '999,990.000') cpu_secs_per_exec,

TO_CHAR(ROUND(h.iowait_total / h.executions_total / 1e6, 3), '999,990.000') io_secs_per_exec,

TO_CHAR(ROUND(h.clwait_total / h.executions_total / 1e6, 3), '999,990.000') cl_secs_per_exec,

TO_CHAR(ROUND(h.apwait_total / h.executions_total / 1e6, 3), '999,990.000') ap_secs_per_exec,

TO_CHAR(ROUND(h.ccwait_total / h.executions_total / 1e6, 3), '999,990.000') cc_secs_per_exec,

TO_CHAR(ROUND(h.plsexec_time_total / h.executions_total / 1e6, 3), '999,990.000') pl_secs_per_exec,

TO_CHAR(ROUND(h.javexec_time_total / h.executions_total / 1e6, 3), '999,990.000') ja_secs_per_exec

FROM dba_hist_sqlstat h,

dba_hist_snapshot s

WHERE h.sql_id = '&sql_id'

AND h.executions_total > 0

AND s.snap_id = h.snap_id

AND s.dbid = h.dbid

AND s.instance_number = h.instance_number

ORDER BY

s.begin_interval_time,

s.end_interval_time;


AWR-LIO:


col execs for 999,999,999

col avg_etime for 999,999

col avg_lio for 999,999,999

col avg_pio for 999,999,999

col begin_interval_time for a30

col node for 99999

break on plan_hash_value on startup_time skip 1

select ss.snap_id, ss.instance_number node, begin_interval_time, sql_id, plan_hash_value,

nvl(executions_delta,0) execs,

(elapsed_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta))/1000000 avg_etime,

(buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta)) avg_lio,

ROUND(disk_reads_delta/DECODE(executions_delta,0,1, executions_delta),1) avg_pio,

ROUND(rows_processed_delta/DECODE(executions_delta,0, 1, executions_delta), 1) avg_rows,

round(px_servers_execs_delta/decode(executions_delta,0,1, executions_delta), 1) avg_px

from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS

where sql_id = nvl('&sql_id','4dqs2k5tynk61')

and ss.snap_id = S.snap_id

and ss.instance_number = S.instance_number

and executions_delta > 0

order by 1, 2, 3

/


To find which is using Current memory:


set linesize 999

col avg_et_secs justify right format 9999999.99

col cost justify right format 9999999999

col timestamp justify center format a25

col parsing_schema_name justify center format a30

col inst_id format 999999999

alter session set nls_date_format='dd-mm-yyyy hh24:mi:ss';

select 'gv$sqlarea_plan_hash' source, INST_ID, SQL_ID, PLAN_HASH_VALUE,

round(elapsed_time/decode(nvl(executions,0),0,1,executions)/1e6/

decode(px_servers_executions,0,1,px_servers_executions)/decode(nvl(executions,0),0,1,executions),2) avg_et_secs,

px_servers_executions/decode(nvl(executions,0),0,1,executions) avg_px,

optimizer_cost cost, LAST_LOAD_TIME timestamp, parsing_schema_name --FIRST_LOAD_TIME, LAST_LOAD_TIME, LAST_ACTIVE_TIME, SQL_PROFILE

from gv$sqlarea_plan_hash

where sql_id = nvl(trim('&sql_id'),sql_id)

UNION

SELECT 'dba_hist_sql_plan' source, null INST_ID, t1.sql_id sql_id, t1.plan_hash_value plan_hash_value, t2.avg_et_secs avg_et_secs, t2.avg_px, t1.cost cost, t1.timestamp timestamp, NULL parsing_schema_name

FROM dba_hist_sql_plan t1,

(

SELECT sql_id, plan_hash_value, --round(SUM(elapsed_time_total)/decode(SUM(executions_total),0,1,SUM(executions_total))/1e6,2) avg_et_secs

round(SUM(elapsed_time_total)/decode(SUM(executions_total),0,1,SUM(executions_total))/1e6/

decode(SUM(px_servers_execs_total),0,1,SUM(px_servers_execs_total))/decode(SUM(executions_total),0,1,SUM(executions_total)),2) avg_et_secs,

SUM(px_servers_execs_total)/decode(SUM(executions_total),0,1,SUM(executions_total)) avg_px

FROM dba_hist_sqlstat

WHERE

executions_total > 0

GROUP BY sql_id, plan_hash_value

) t2

WHERE

t1.sql_id = nvl(TRIM('&sql_id'), t1.sql_id)

AND t1.depth = 0

AND t1.sql_id = t2.sql_id(+)

AND t1.plan_hash_value = t2.plan_hash_value(+)

order by avg_et_secs, cost

/


Identify the Culprit: SQL , SQL TEXT , BIND VARIABLE

col exact_matching_signature for 99999999999999999999999999

col sql_text for a50

select sql_id, exact_matching_signature, SQL_TEXT from v$sqlarea where UPPER(sql_text) like '%DUMMY%' order by UPPER(sql_text);


set long 20000

set lines 750 pages 9999

select sql_text from dba_hist_sqltext where sql_id = '&SQL_ID';


set long 20000

set lines 750 pages 9999

select sql_text from gv$sqlarea where sql_id = '&SQL_ID';


col VALUE_STRING for a50

SELECT NAME,POSITION,DATATYPE_STRING,VALUE_STRING FROM gv$sql_bind_capture WHERE sql_id='&sql_id';


statistics of objects of a specific sql id:

set lines 300 set pages 300

col table_name for a40

col owner for a30

select distinct owner, table_name, STALE_STATS, last_analyzed, stattype_locked

from dba_tab_statistics

where (owner, table_name) in

(select distinct owner, table_name

from dba_tables

where ( table_name)

in ( select object_name

from gv$sql_plan

where upper(sql_id) = upper('&sql_id') and object_name is not null))

--and STALE_STATS='YES'

/


col index_name for a50

SELECT owner, index_name, table_name,last_analyzed, sample_size, num_rows, partitioned, global_stats

FROM dba_indexes

WHERE index_name IN (

select distinct rtrim(substr(plan_table_output, instr(plan_table_output, '|', 1, 3)+2, (instr(plan_table_output, '|', 1, 4)-instr(plan_table_output, '|', 1, 3)-2)), ' ')

from (

SELECT plan_table_output

FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('&sql_id', null, 'BASIC'))

UNION ALL

SELECT * FROM TABLE(dbms_xplan.display_awr('&sql_id', null, null, 'ALL'))

)

where plan_table_output like '%INDEX%'

)

ORDER BY owner, table_name, index_name

/


Sql id current rows, I/O , read/wrire details:

select SQL_ID,PLAN_HASH_VALUE,ELAPSED_TIME,PHYSICAL_READ_BYTES,PHYSICAL_WRITE_BYTES,DISK_READS,DIRECT_WRITES,BUFFER_GETS,ROWS_PROCESSED from v$sqlstats where sql_id='&sql_id';


select sql_text,rows_processed from v$sql

where USERS_EXECUTING>0;


select s.sid, s.serial#, p.spid, s.username, s.program,

t.xidusn, t.used_ublk, t.used_urec, sa.sql_text from

v$process p,v$session s, v$sqlarea sa, v$transaction t

where s.paddr=p.addr

and s.taddr=t.addr

and s.sql_address=sa.address(+)

and s.sql_hash_value=sa.hash_value(+)

order by s.sid

/


exec dbms_stats.flush_database_monitoring_info;

select inserts,updates,deletes from user_tab_modifications where table_name = '&table_name';


Check the progress of DML statements:

col sql_text for a60

SELECT rows_processed "Total Rows Processed",

ROUND((SYSDATE - TO_DATE(first_load_time, 'yyyy-mm-dd hh24:mi:ss')) * 24 * 60, 1) "Total Time (Min)",

TRUNC(rows_processed /((SYSDATE - TO_DATE(first_load_time, 'yyyy-mm-dd hh24:mi:ss')) * 24 * 60)) "Rows/Min",

TRUNC(rows_processed /((SYSDATE - TO_DATE(first_load_time, 'yyyy-mm-dd hh24:mi:ss')) * 24 * 60 * 60)) "Rows/Sec" , SUBSTR(sql_text, 1, 60) sql_text

FROM gv$sqlarea

WHERE SQL_ID='&SQL_ID'

AND open_versions > 0

AND rows_processed > 0;


Detailed history of SQL_ID:

select instance_number inst_id,SESSION_ID,USER_ID,PROGRAM,sql_id,SQL_CHILD_NUMBER,sql_plan_hash_value,to_char (sql_exec_start, 'dd-Mon-yyyy hh24:mi:ss') sql_exec_start from

dba_hist_active_sess_history where

sql_id='&sql_id';


select sql_id,

starting_time,

end_time,

(EXTRACT(HOUR FROM run_time) * 3600

+ EXTRACT(MINUTE FROM run_time) * 60

+ EXTRACT(SECOND FROM run_time))/60 run_time_MIN,

READ_IO_BYTES,

PGA_ALLOCATED PGA_ALLOCATED_BYTES,

TEMP_ALLOCATED TEMP_ALLOCATED_BYTES

from (

select

sql_id,

max(sample_time - sql_exec_start) run_time,

max(sample_time) end_time,

sql_exec_start starting_time,

sum(DELTA_READ_IO_BYTES) READ_IO_BYTES,

sum(DELTA_PGA) PGA_ALLOCATED,

sum(DELTA_TEMP) TEMP_ALLOCATED

from

(

select sql_id,

sample_time,

sql_exec_start,

DELTA_READ_IO_BYTES,

sql_exec_id,

greatest(PGA_ALLOCATED - first_value(PGA_ALLOCATED) over (partition by sql_id,sql_exec_id order by sample_time rows 1 preceding),0) DELTA_PGA,

greatest(TEMP_SPACE_ALLOCATED - first_value(TEMP_SPACE_ALLOCATED) over (partition by sql_id,sql_exec_id order by sample_time rows 1 preceding),0) DELTA_TEMP

from

dba_hist_active_sess_history

where

sample_time >= trunc(sysdate)

--and sample_time < to_date ('2013/04/16 03:10:00','YYYY/MM/DD HH24:MI:SS')

and sql_exec_start is not null

and IS_SQLID_CURRENT='Y'

)

group by sql_id,SQL_EXEC_ID,sql_exec_start

order by sql_id

)

where sql_id = '&sql_id'

order by sql_id, run_time_MIN desc;


To find Sql Hanging or not:

select sess_io.inst_id,

sess_io.sid,

sesion.sql_id,

sess_io.block_gets,

sess_io.consistent_gets,

sess_io.physical_reads,

sess_io.block_changes,

sess_io.consistent_changes

from gv$sess_io sess_io, gv$session sesion

where sesion.sid = sess_io.sid and

sess_io.inst_id = sesion.inst_id and

sesion.sql_id='&sql_id'

and sesion.username is not null ;


select sess_io.inst_id,

sess_io.sid,

sess_io.block_gets,

sess_io.consistent_gets,

sess_io.physical_reads,

sess_io.block_changes,

sess_io.consistent_changes

from gv$sess_io sess_io, gv$session sesion

where sesion.sid = sess_io.sid and

sess_io.inst_id = sesion.inst_id

and sesion.username is not null ;


SQL to show the full SQL executing for active sessions:

select sesion.sid,sql_text from v$sqltext sqltext, v$session sesion where sesion.sql_hash_value = sqltext.hash_value and sesion.sql_address = sqltext.address and sesion.username is not null

order by sqltext.piece;


select a.sid,b.sql_fulltext from V$Session a, V$SQLAREA b where a.sql_id=b.sql_id and a.status='ACTIVE';

nn

 SELECT 

SQL_ID,pian_hash_value,SQL_PROFILE,SQL_PLAN_BASELINE,ROUND(SUM(etapsed tirne)/SUM(exec utions)/1e6, 3) 

avg_et_secs,ROUN D(SUM(cpu_time)/SUM(executions)/1e6, 

3 avg_cpu_secs,ROUNDiSUM(user_io_wa it_time)/SU M (exec uti o ns)/1 e6, 3) 

avg_io_secs, ROUND(SUM (bu ffer_g et s)/SU M (executions)) avg_buffer gets,

ROUND(SUM (disk_reads)/SUM (executions)) avg_disk reads,ROUND(SUM(rows_processed)/SUM(executions))

 avg_rows,SUM(executions) executions,Substr(sql_text1,100)

 "SQL Text"FROM gvSsqIWHERE executions > O 

 GROUP BY sql_id,plan_hash value,sql_text,SQL_PROFILE,SQL_PLAN_BASELINE ORDER 

BY 1;

Saturday, November 5, 2022

Post Cutover R12.2 - Clear the old editions script


SQL> 

select

 '/* '||e.object_name||' '||s.osuser||' '||s.username||' '||s.program||' */' info

 , 'ALTER SYSTEM KILL SESSION '||''''||s.sid||','||s.serial#||''';' kill

 from

 v$session s

 , v$process p

 , database_properties run /* run edition name */

 , dba_objects_ae e

 where s.type <> 'BACKGROUND'

 and p.addr = s.paddr

 and run.property_name = 'DEFAULT_EDITION'

 and e.object_id = s.session_edition_id

 and e.object_name < run.property_value

 order by 1

 /

Friday, November 4, 2022

EBS After adop CUTOVER oaea_wls.properties file was blank in application Intranet node2

 


EBS After adop CUTOVER oaea_wls.properties file was blank in application Intranet node2

 

 

To implement this workaround, please do the following:


Notes: Test the following steps in a development instance and then migrate accordingly:


1. Ensure a valid backup exists for the instance where the solution is being testing.


2. Copy file $INST_TOP/appl/admin/oaea_wls.properties from the original filesystem (fs1) over to the additional filesystems (fs2), to migrate the proper node settings to oaea_wls.properties


3. Restart the servers to ensure the file changes are processed.


4. Retest the login and confirm the error is resolved.


Reference:

12.2 AccessGate Login Fails with HTTP 500 Error 'Request Failed for : /accessgate/ssologin?, Resp Code : [500]' On Secondary Nodes After A Complete ADOP Patching Cycle As File oaea_wls.properties Is Not Updated On Multiple Filesystems (fs2) ( Doc ID 2273885.1 )

Friday, September 30, 2022

SQL script to find SQL ID's having more than one hash plan

 

SQL script to find SQL ID's having more than one hash plan

This will be for the last 7 days.

Script:

SELECT
    sql_id, COUNT(DISTINCT plan_hash_value)
   FROM
    dba_hist_sqlstat  stat,
    dba_hist_snapshot ss
WHERE
        stat.snap_id = ss.snap_id
    AND ss.dbid = stat.dbid
    AND ss.instance_number = stat.instance_number
    AND ss.begin_interval_time >= sysdate - 7
    AND ss.end_interval_time <= sysdate
    AND stat.plan_hash_value <> 0
    AND stat.executions_delta > 0
    AND stat.parsing_schema_name NOT IN ( 'SYS', 'SYSTEM' )
 GROUP BY
    sql_id
having COUNT(DISTINCT plan_hash_value) >1
ORDER BY
    1;



PL/SQL to Compare if they are the same or different


Script:

SET SERVEROUTPUT ON
DECLARE
    v_count number := 0;
    CURSOR SQLID IS
SELECT
    sql_id,
    COUNT(DISTINCT plan_hash_value) cnt
FROM
    dba_hist_sqlstat  stat,
    dba_hist_snapshot ss
WHERE
        stat.snap_id = ss.snap_id
    AND ss.dbid = stat.dbid
    AND ss.instance_number = stat.instance_number
    AND ss.begin_interval_time >= sysdate - 7
    AND ss.end_interval_time <= sysdate
    AND stat.plan_hash_value <> 0
    AND stat.executions_delta > 0
    AND stat.parsing_schema_name NOT IN ( 'SYS', 'SYSTEM' )
GROUP BY
    sql_id
ORDER BY
    1;

BEGIN
    FOR I IN SQLID
    loop
    DBMS_OUTPUT.PUT_LINE ('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
        IF I.cnt > 1 THEN
            DBMS_OUTPUT.PUT_LINE ('Multiple plan for this sql :-'||I.sql_id||'. Checked for last 7 days. Please login to DB and do action item as needed ');
       ELSE
             DBMS_OUTPUT.PUT_LINE ('This sqlid '||I.sql_id||' has more than one plan, but the plan was not changed since last 7days'); 
        END IF;
        
    end loop;
END;
/

Thursday, September 8, 2022

sqlflip2.sql

 set lines 155

----------------------------------------------------------------------------------------

--

-- File name:   sqlflip2.sql

--

-- Purpose:     Attempts to find SQL statements with plan instability.

--

---------------------------------------------------------------------------------------

col execs for 999,999,999

col etime for 999,999,999.9

col avg_etime for 999,999.999

col avg_cpu_time for 999,999.999

col avg_lio for 999,999,999.9

col avg_pio for 9,999,999.9

col begin_interval_time for a30

col node for 99999

break on plan_hash_value on startup_time skip 1

select sql_id, plan_hash_value, 

sum(execs) execs, 

-- sum(etime) etime, 

sum(etime)/sum(execs) avg_etime, 

sum(cpu_time)/sum(execs) avg_cpu_time,

sum(lio)/sum(execs) avg_lio, 

sum(pio)/sum(execs) avg_pio

from (

select ss.snap_id, ss.instance_number node, begin_interval_time, sql_id, plan_hash_value,

nvl(executions_delta,0) execs,

elapsed_time_delta/1000000 etime,

(elapsed_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta))/1000000 avg_etime,

buffer_gets_delta lio,

disk_reads_delta pio,

cpu_time_delta/1000000 cpu_time,

(buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta)) avg_lio,

(cpu_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta)) avg_cpu_time

from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS

where sql_id = nvl('&sql_id','4dqs2k5tynk61')

and ss.snap_id = S.snap_id

and ss.instance_number = S.instance_number 

-- and executions_delta > 0

)

group by sql_id, plan_hash_value

order by 5

/

sqlflip1.sql

 ----------------------------------------------------------------------------------------

--

-- File name:   sqlflip1.sql

--

-- Purpose:     Provides list of all PHVs their execution count and resource consumption

--

---------------------------------------------------------------------------------------

set lines 155

col execs for 999,999,999

col min_etime for 999,999.99

col max_etime for 999,999.99

col avg_etime for 999,999.999

col avg_lio for 999,999,999.9

col norm_stddev for 999,999.9999

col begin_interval_time for a30

col node for 99999

break on plan_hash_value on startup_time skip 1

select * from (

select sql_id, sum(execs), min(avg_etime) min_etime, max(avg_etime) max_etime, stddev_etime/min(avg_etime) norm_stddev

from (

select sql_id, plan_hash_value, execs, avg_etime,

stddev(avg_etime) over (partition by sql_id) stddev_etime 

from (

select sql_id, plan_hash_value,

sum(nvl(executions_delta,0)) execs,

(sum(elapsed_time_delta)/decode(sum(nvl(executions_delta,0)),0,1,sum(executions_delta))/1000000) avg_etime

-- sum((buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta))) avg_lio

from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS

where ss.snap_id = S.snap_id

and ss.instance_number = S.instance_number 

and executions_delta > 0

and elapsed_time_delta > 0

and s.snap_id > nvl('&earliest_snap_id',0)

group by sql_id, plan_hash_value

)

)

group by sql_id, stddev_etime

)

where norm_stddev > nvl(to_number('&min_stddev'),2)

and max_etime > nvl(to_number('&min_etime'),.1)

order by norm_stddev

/

validation


 col directory_path  for a100

set pages 1000 lines 150            

select directory_name,directory_path from dba_directories;


SET LINESIZE 150

COLUMN owner FORMAT A20
COLUMN directory_name FORMAT A25
COLUMN directory_path FORMAT A80

SELECT *
FROM   dba_directories
ORDER BY owner, directory_name;


+++++++++

SQL:

 

select 'CREATE OR REPLACE DIRECTORY '||directory_name||' as '''|| directory_path||''';' from dba_directories;

                                      

OR

 

update dir$ set OS_PATH=replace(OS_PATH,'&OLD_VALUE','&NEW_VALUE') where OS_PATH like '%&OLD_VALUE%';



+++


Update Site Name:

 

Update the Below function. Change the value according to the instance

 

update fnd_form_functions_tl

set user_function_name = ' from PROD (BKP 16-MAY-16)'

where function_id in (select function_id from fnd_form_functions where function_name = 'FWK_HOMEPAGE_BRAND') and LANGUAGE='US';

 

 

set pages 1000 lines 150

col user_function_name for a80

select LANGUAGE,FUNCTION_ID,user_function_name  from fnd_form_functions_tl where function_id in (select function_id from fnd_form_functions where function_name = 'FWK_HOMEPAGE_BRAND') and LANGUAGE='US';

 +++


Once REGOID is completed, we need to follow the attached mail steps to populate the data in OID tables.

 SQL>  execute fnd_oid_plug.setPlugin;

 

SQL> SELECT * FROM fnd_user_preferences WHERE user_name='#INTERNAL' AND module_name='OID_CONF';



Oracle E-Business Suite Release 12 Release-Specific Database Initialization Parameters for 19c

 


Release-Specific Database Initialization Parameters for 19c

 ####################################################################

#
# Oracle E-Business Suite Release 12
# Release-Specific Database Initialization Parameters for 19c
#
####################################################################

compatible = 19.0.0 #MP
optimizer_adaptive_plans = TRUE #MP
optimizer_adaptive_statistics = FALSE #MP
pga_aggregate_limit = 0 #MP
temp_undo_enabled = FALSE
_pdb_name_case_sensitive = TRUE #MP
event='10946 trace name context forever, level 8454144' #MP
_optimizer_gather_stats_on_conventional_dml = FALSE #MP
_optimizer_use_stats_on_conventional_dml = FALSE #MP
optimizer_real_time_statistics = FALSE #MP


###############################################################################
#
# End of Release-Specific Database Initialization Parameters Section for 19c
#
###############################################################################

Parameter Removal List for Oracle Database 19c

 egrep -i '_kks_use_mutex_pin|_shared_pool_reserved_min_alloc|_sqlexec_progression_cost|exafusion_enabled|exclude_seed_cdb_view|global_context_pool_size|max_enabled_roles|o7_dictionary_accessibility|olap_page_pool_size|optimizer_adaptive_features|optimizer_features_enable|parallel_automatic_tuning|parallel_degree_level|parallel_io_cap_enabled|parallel_server|parallel_server_instances|plsql_compiler_flags|plsql_native_library_dir|plsql_native_library_subdir_count|plsql_optimize_level|standby_archive_dest|timed_statistics|use_indirect_data_buffers|utl_file_dir' init19c.ora


++++++++++++


 Parameter Removal List for Oracle Database 19c

If they exist, you should remove the following parameters from your database initialization parameters file for Oracle Database 19c.

Note: Parameters may appear on a "removal list" because they are obsolete; because the default value is required and no other value may be set; or to cater for certain special cases where a non-default value has to be set to meet specific needs (currently, there is only one such case, which is described in Section 6).

_kks_use_mutex_pin
_shared_pool_reserved_min_alloc
_sqlexec_progression_cost
exafusion_enabled
exclude_seed_cdb_view
global_context_pool_size
max_enabled_roles
o7_dictionary_accessibility
olap_page_pool_size
optimizer_adaptive_features
optimizer_features_enable
parallel_automatic_tuning
parallel_degree_level
parallel_io_cap_enabled
parallel_server
parallel_server_instances
plsql_compiler_flags
plsql_native_library_dir
plsql_native_library_subdir_count
plsql_optimize_level
standby_archive_dest
timed_statistics
use_indirect_data_buffers
utl_file_dir

 

Sunday, August 28, 2022

Important day to day scripts

 


–FIND DATABASE SIZE


 select 'DATA_n_INDEX: ' || sum(bytes)/1024/1024/1024 || ' GBytes' DATABASE_SIZE from dba_data_files

union

select 'TEMP: ' || sum(bytes)/1024/1024/1024 || ' GBytes' from dba_temp_files

union

select 'REDO LOGS: ' || sum(bytes)/1024/1024/1024 || ' GBytes' from v$log

union

select 'CONTROLFILE: ' || sum(FILE_SIZE_BLKS*BLOCK_SIZE)/1024/1024 || ' MBytes' from v$controlfile;


–CREATE NEW DATABASE USER


create user <username> identified by <password> default tablespace <tablespace_name> temporary tablespace <tablespace_name> profile <profile_name>;

 

grant create session to <username>;

 

alter user <username> password expire;

 


–CREATE DYNAMIC SQL SCRIPTS TO COMPILE INVALID OBJECTS


spool recompile_list.sql;

select 'ALTER '||

decode(substr(object_type,1,4),'PACK','PACKAGE ',object_Type||' ')||

owner || '.' || decode(object_type,'JAVA CLASS','"') || object_name ||

decode(object_type,'JAVA CLASS','" RESOLVE ','INDEX','REBUILD',' COMPILE ') ||

DECODE(object_type,'PACKAGE BODY','BODY', NULL)||';' OBJECTS_TO_COMPILE

from dba_objects

where object_type in ('PACKAGE','PROCEDURE','PACKAGE BODY','FUNCTION',

'TRIGGER','VIEW','JAVA CLASS','INDEX')

and status = 'INVALID'

order by object_name, object_type;

spool off;

 


–FIND ALL ACTIVE DATABASE SESSIONS


select event, program, module, sid, SECONDS_IN_WAIT

from v$session

where status = 'ACTIVE'

and module is not null

order by 2 desc;

OR


select sid, serial#, username, osuser, logon_time, program, module

from v$session where username is not null and status = 'ACTIVE'

 


–FIND EBS USER NAME FROM DATABASE SESSION ID


column "User Name" format a10

column "OS_PID" format a8

 

select d.user_name "User Name",

b.sid SID,b.serial# "Serial#", c.spid "srvPID", a.SPID "OS_PID",

to_char(START_TIME,'DD-MON-YY HH:MM:SS') "STime"

from fnd_logins a, v$session b, v$process c, fnd_user d

where b.paddr = c.addr

and a.pid=c.pid

and a.spid = b.process

and d.user_id = a.user_id

and (d.user_name = 'USER_NAME' OR 1=1)

and b.sid = &sid;

 


–FIND ORPHAN PROCESSES


select spid from v$process where not exists (select 1 from v$session where paddr=addr)

 


–FIND DETAILS WHEN CONCURRENT PROGRAM WAS RUN IN LAST 10 DAYS


select REQUEST_ID,

REQUEST_DATE,

REQUESTED_START_DATE,

RESUBMIT_END_DATE,

ACTUAL_START_DATE,

ACTUAL_COMPLETION_DATE

from fnd_concurrent_requests

where CONCURRENT_PROGRAM_ID = &Concurrent_Prog_ID

and ACTUAL_START_DATE between trunc(sysdate) - 10 and sysdate order by REQUESTED_START_DATE;

 


–FIND ALL FORMS RELATED SESSIONS


col CLIENT_IDENTIFIER format a10

col MODULE format a25

col MACHINE format a10

 

select sid, serial#, logon_time, client_identifier, module, status, machine, seconds_in_wait

from gv$session

where program like 'frmweb%'

order by logon_time;

 


–FIND USER_ID FROM USER_NAME


select USER_ID, USER_NAME

from apps.FND_USER

where USER_NAME = upper('&1');

 


–FIND EBS USER CONNECTION RELATED DETAILS FROM USER_ID


select SESSION_ID, CREATION_DATE, TIME_OUT, LIMIT_TIME, LIMIT_CONNECTS, COUNTER, FIRST_CONNECT, LAST_CONNECT

from apps.ICX_SESSIONS

where USER_ID = &user_id

order by CREATION_DATE;

 


–FIND EBS USER CONNECTION RELATED DETAILS FROM SESSION_ID


SELECT SESSION_ID, XSID, TIME_OUT, LIMIT_TIME, LIMIT_CONNECTS, COUNTER, TO_CHAR(SYSDATE,'DD-MM-YYYY HH24:MI:SS'), TO_CHAR(FIRST_CONNECT,'DD-MM-YYYY HH24:MI:SS'),TO_CHAR(LAST_CONNECT,'DD-MM-YYYY HH24:MI:SS'), DISABLED_FLAG

FROM apps.ICX_SESSIONS

WHERE SESSION_ID = '&session_id';

 


–FIND PID,SPID FROM SID


select p.PID,p.SPID,s.SID

from v$process p,v$session s

where s.paddr = p.addr

and s.sid = &sid;

 


–FIND WORKFLOW MAIL PREFRENCES FROM DISLAY_NAME


col DISPLAY_NAMEformata30

col name format a30

set lines 132

 

select NAME, DISPLAY_NAME, NOTIFICATION_PREFERENCE

from wf_users

where DISPLAY_NAME like upper('%&NAME%');

 


–FIND ORACLE DATABASE HIDDEN PARAMETER VALUE


set lines 132

column ksppinm format a50

column ksppstvl format a30

 

select a.ksppinm, b.ksppstvl

from x$ksppi a,x$ksppsv b

where a.indx=b.indx

and substr(a.ksppinm,1,1) = '_'

and lower(a.ksppinm) like '%&hidden_parameter%'

order by ksppinm;

 


–FIND WORKFLOW NAME AND DISPLAY_NAME FROM EMAIL ADDRESS


select name, display_name

from apps.WF_LOCAL_ROLES

where EMAIL_ADDRESS = '<email_address>';

 


–FIND EBS APPLICATION USER DETAILS FROM SID


rem to_char(max(l.start_time),'mm/dd/yy hh:mi:ssAM') startedat,

set lines 132

set verify off

col user_name head "Apps Signon" format a12 trunc

col description head "Real Name" format a25 trunc

rem col user_form_name head "Form Name" format a30 trunc

col forminfo head "Form Name" format a40 trunc

col time head "Elapsed Time" format a10

col zoom_level head "Zoom Level"

col startedat head "Logon At" format a19

col lastcallet format a11

accept trgtsid number prompt 'What is the SID : '

select /*+ rule */

to_char(s.logon_time,'mm/dd/yy hh:mi:ssAM') startedat,

a.time,

floor(s.last_call_et/3600)||':'||

floor(mod(s.last_call_et,3600)/60)||':'||

mod(mod(s.last_call_et,3600),60) "LastCallET",

u.user_name, u.description ,

s.module || ' - ' || a.user_form_name forminfo

from applsys.fnd_logins l,

applsys.fnd_user u,

apps.fnd_signon_audit_view a,

v$process p,

v$session s

where s.sid = &trgtsid

and s.paddr = p.addr

and p.pid = l.pid

and l.end_time is null

and l.spid = s.process

and l.start_time is not null

-- and l.start_time = u.last_logon_date

-- and l.session_number = u.session_number

and l.user_id = u.user_id

and u.user_id = a.user_id

and p.pid = a.pid

and l.start_time = (select max(l2.start_time)

from applsys.fnd_logins l2

where l2.pid = l.pid)

group by to_char(s.logon_time,'mm/dd/yy hh:mi:ssAM'),

floor(s.last_call_et/3600)||':'||

floor(mod(s.last_call_et,3600)/60)||':'||

mod(mod(s.last_call_et,3600),60),

u.user_name, u.description,a.time,s.module || ' - ' || a.user_form_name

order by to_char(s.logon_time,'mm/dd/yy hh:mi:ssAM'),a.time;

 


–FIND VALUE OF PROFILE OPTION FROM DATABASE


set serveroutput on

set echo on

set timing on

set feedback on

set long 10000

set linesize 120

set pagesize 132

column SHORT_NAME format A30

column NAME format A40

column LEVEL_SET format a15

column CONTEXT format a30

column VALUE format A60 wrap

 

select p.profile_option_name SHORT_NAME,

n.user_profile_option_name NAME,

decode(v.level_id,

10001, 'Site',

10002, 'Application',

10003, 'Responsibility',

10004, 'User',

10005, 'Server',

10007, 'SERVRESP',

'UnDef') LEVEL_SET,

decode(to_char(v.level_id),

'10001', '',

'10002', app.application_short_name,

'10003', rsp.responsibility_key,

'10005', svr.node_name,

'10006', org.name,

'10004', usr.user_name,

'10007', 'Serv/resp',

'UnDef') "CONTEXT",

v.profile_option_value VALUE

from fnd_profile_options p,

fnd_profile_option_values v,

fnd_profile_options_tl n,

fnd_user usr,

fnd_application app,

fnd_responsibility rsp,

fnd_nodes svr,

hr_operating_units org

where p.profile_option_id = v.profile_option_id (+)

and p.profile_option_name = n.profile_option_name

and (upper(n.user_profile_option_name) like upper('&user_rofile_name')

or upper(n.user_profile_option_name) like upper('&user_profle_name'))

and usr.user_id (+) = v.level_value

and rsp.application_id (+) = v.level_value_application_id

and rsp.responsibility_id (+) = v.level_value

and app.application_id (+) = v.level_value

and svr.node_id (+) = v.level_value

and org.organization_id (+) = v.level_value

order by short_name, level_set;

 


–FIND USER DETAILS FROM USER_NAME


select USER_GUID,START_DATE,END_DATE,LAST_LOGON_DATE,EMAIL_ADDRESS

from fnd_user

where user_name = '&USER_NAME';

 


–FIND ALL RUNNING CONCURRENT REQUESTS WHICH ARE CURRENTLY RUNNING


set linesize 120

col program for a34

col requestor for a9

SELECT REQUEST_ID "Req. ID",

to_char(REQUESTED_START_DATE,'YYYY-MM-DD HH24:MI:SS') "REQ START DATE",

to_char(ACTUAL_START_DATE,'YYYY-MM-DD HH24:MI:SS') "ACT START DATE",

to_char(ACTUAL_COMPLETION_DATE,'YYYY-MM-DD HH24:MI:SS') "ACT COMP DATE",

PHASE_CODE "P-CODE",STATUS_CODE "S-CODE",

PROGRAM, REQUESTOR

FROM

APPS.FND_CONC_REQ_SUMMARY_V WHERE PHASE_CODE = 'R'

order by actual_start_date DESC;

 


– UPDATE PROFILE OPTION FROM BACKEND


DECLARE

stat boolean;

BEGIN

dbms_output.disable;

dbms_output.enable(100000);

stat := FND_PROFILE.SAVE('XX_PROFILE_NAME', 'XX_NEW_VALUE', 'SITE');

IF stat THEN

dbms_output.put_line( 'Stat = TRUE - profile updated' );

ELSE

dbms_output.put_line( 'Stat = FALSE - profile NOT updated' );

END IF;

commit;

END;

 


— APPLICATION USER DEFINITION


rem fnduser.sql

rem

set linesize 132

rem

ttitle 'Application User Definitions'

rem

col user_name format a15 heading 'USER NAME'

col user_id format 99999 heading 'USER|ID'

col employee_flag format a1 heading 'E'

col description format a35 heading 'DESCRIPTION'

col start_date format a9 heading 'START|DATE'

col end_date format a9 heading 'END|DATE'

col last_logon_date format a9 heading 'LAST|LOGON|DATE'

col last_logon_time format a17 heading 'LAST LOGON|TIMESTAMP'

col last_logon_days format 9999 heading 'LAST|LOGON|DAYS'

col f format a1 heading 'F'

col p format a1 heading 'P'

col password_lifespan_days format 9999 heading 'PW|EXPIRE|DAYS'

col password_date format a9 heading 'PASSWORD|DATE'

col password_change_days format 9999 heading 'PW|CHANGE|DAYS'

rem

break on report

compute count of start_date end_date last_logon_time last_logon_days on report

rem

select user_name,

 user_id,

 decode( employee_id, null, null, 'E' ) employee_flag,

 description,

 start_date,

 end_date,

 decode( end_date, least( end_date, sysdate ), null, '+' ) f,

 to_char( last_logon_date, 'mm/dd/yy hh24:mi:ss' ) last_logon_time,

 decode( end_date, null, sysdate - last_logon_date ) last_logon_days,

 decode( end_date, null, decode( 30, greatest( 30, trunc(sysdate-last_logon_date) ), null, '*' ) ) p,

 password_lifespan_days,

 password_date,

 decode( end_date, null, sysdate - password_date ) password_change_days

 from applsys.fnd_user u

 where user_name like upper('%&userid%')

 order by description, user_name;

rem

set linesize 80

 


–LONG RUNNING EBS FORM SESSION


rem long_run_form.sql

rem

set linesize 132

set pagesize 60

set tab off

rem

ttitle 'Long Running Active Form Sessions'

rem

col email_address format a26 heading 'EMAIL ADDRESS'

col user_name format a10 heading 'USER NAME'

col pid format 9999 heading 'PID'

col spid format a6 heading 'SERVER|PID'

col inst_id format 9 heading 'I'

col sid format 9999 heading 'SID'

col serial# format 99999 heading 'SERIAL'

col process format a6 heading 'CLIENT|PID'

col osuser format a8 heading 'OS|USERNAME'

col log_per_sec format 99999 heading 'LOG|PER|SEC'

col logical format b999999999 heading 'LOGICAL|READS'

col phy_per_sec format b9999 heading 'PHY|PER|SEC'

col physical_reads format b99999999 heading 'PHYSICAL|READS'

col audsid format b9999999 heading 'AUDIT|SESSION'

col program format a30 heading 'PROGRAM NAME'

col module format a12 heading 'FORM NAME'

col logon_time format a8 heading 'LOGON|TIME'

col duration format a8 heading 'DURATION'

col last_call_min format 999 heading 'LAST|CALL|MIN'

col orcl_user format a6 heading 'ORACLE|USERID'

col status format a1 heading 'S'

col enqueue format a1 heading 'E'

rem

select distinct user_name,

decode( s.status, 'ACTIVE', '*', 'INACTIVE', null, 'KILLED', 'K', '?' ) status,

decode( s.lockwait, null, null, 'E' ) enqueue,

s.last_call_et/60 last_call_min,

s.module,

s.inst_id,

s.sid,

s.serial#,

-- s.username orcl_usr,

-- s.osuser osuser,

s.process,

p.spid,

to_char( trunc(sysdate) + ( sysdate - s.logon_time ), 'hh24:mi:ss' ) duration,

( i.block_gets + i.consistent_gets ) /

( ( sysdate - s.logon_time ) * 86400 ) log_per_sec,

i.block_gets + i.consistent_gets logical,

physical_reads /

( ( sysdate - s.logon_time ) * 86400 ) phy_per_sec,

i.physical_reads,

-- s.action,

email_address

from applsys.fnd_logins l,

applsys.fnd_user u,

gv$session s,

gv$sess_io i,

gv$process p

where l.user_id = u.user_id

and s.sid = i.sid

and s.inst_id = i.inst_id

and p.pid = l.pid

-- and s.process = l.spid

and p.spid = l.process_spid(+)

and l.end_time is null

and s.paddr = p.addr(+)

and s.inst_id = p.inst_id(+)

and ( s.module in ( 'FNDATTCH', 'FNDSCSGN' )

or substr( s.action, 1, 5 ) = 'FRM::' )

and s.last_call_et >= 300

and s.status in ( 'ACTIVE', 'KILLED' )

order by last_call_min desc;

rem

set linesize 80

set pagesize 24

set tab on

 


—FIND WHICH RESPONSIBILITIES CAN RUN SPECIFIC PROGRAM


 SELECT fcp.concurrent_program_name

 ,fr.responsibility_name

 ,frg.request_group_name

 ,fcp.user_concurrent_program_name

 FROM

 fnd_request_group_units frgup

 ,fnd_concurrent_programs_vl fcp

 ,fnd_request_groups frg

 ,fnd_responsibility_vl fr

 WHERE 1=1

 AND fr.request_group_id = frg.request_group_id

 AND frg.request_group_id = frgup.request_group_id

 AND frgup.request_unit_type = 'P'

 AND frgup.request_unit_id = fcp.concurrent_program_id

 AND fcp.concurrent_program_name LIKE '%&concurrent_program_name%';

 


– FIND WHICH SID IS BLOCKING OTHER SID


select s1.username || '@' || s1.machine

 || ' ( SID=' || s1.sid || ' ) is blocking '

 || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status

 from v$lock l1, v$session s1, v$lock l2, v$session s2

 where s1.sid=l1.sid and s2.sid=l2.sid

 and l1.BLOCK=1 and l2.request > 0

 and l1.id1 = l2.id1

 and l2.id2 = l2.id2 ;

 


–FIND DETAILS OF A SID


rem vusersid.sql

 rem

 set linesize 132

 rem

 ttitle 'User Session Statistics'

 rem

 col pid format 9999 heading 'PID'

 col spid format a6 heading 'SERVER|PID'

 col sid format 9999 heading 'SID'

 col serial# format 99999 heading 'SERIAL'

 col process format a6 heading 'CLIENT|PID'

 col osuser format a8 heading 'OS|USERNAME'

 col username format a10 heading 'ORACLE|USERNAME'

 col log_per_sec format 999999 heading 'LOG|PER|SEC'

 col logical format b9999999999 heading 'LOGICAL|READS'

 col phy_per_sec format b9999 heading 'PHY|PER|SEC'

 col physical_reads format b99999999 heading 'PHYSICAL|READS'

 col audsid format b9999999 heading 'AUDIT|SESSION'

 col program format a32 heading 'PROGRAM NAME'

 col module format a32 heading 'MODULE'

 col logon_time format a8 heading 'LOGON|TIME'

 col duration format a8 heading 'DURATION'

 col last_call_min format 9999 heading 'LAST|CALL|MIN'

 col status format a1 heading 'S'

 rem

 select s.process,

 p.spid,

 /*

 p.pid,

 */

 s.sid,

 s.serial#,

 s.osuser,

 s.username,

 ( i.block_gets + i.consistent_gets ) /

 ( ( sysdate - s.logon_time ) * 86400 ) log_per_sec,

 i.block_gets + i.consistent_gets logical,

 physical_reads /

 ( ( sysdate - s.logon_time ) * 86400 ) phy_per_sec,

 i.physical_reads,

 /*

 s.audsid,

 */

 to_char( trunc(sysdate) + ( sysdate - s.logon_time ), 'hh24:mi:ss' ) duration,

 s.last_call_et/60 last_call_min,

 decode( s.status, 'ACTIVE', '*', 'INACTIVE', null, 'KILLED', 'K', '?' ) status,

 decode( s.action, 'Concurrent Request', 'CM/' || s.module, s.module ) module

 from v$process p, v$session s, v$sess_io i

 where i.sid = s.sid

 and s.paddr = p.addr

 and s.sid = &sid;

 rem

 set linesize 80

 


–FIND DETAILS OF SQL OF A SID


rem vusersidsql.sql

 rem

 set linesize 132

 rem

 ttitle 'User Session Statistics'

 rem

 col pid format 9999 heading 'PID'

 col spid format a6 heading 'SERVER|PID'

 col sid format 9999 heading 'SID'

 col serial# format 99999 heading 'SERIAL'

 col process format a6 heading 'CLIENT|PID'

 col osuser format a8 heading 'OS|USERNAME'

 col username format a10 heading 'ORACLE|USERNAME'

 col log_per_sec format 999999 heading 'LOG|PER|SEC'

 col logical format b9999999999 heading 'LOGICAL|READS'

 col phy_per_sec format b9999 heading 'PHY|PER|SEC'

 col physical_reads format b99999999 heading 'PHYSICAL|READS'

 col audsid format b9999999 heading 'AUDIT|SESSION'

 col program format a32 heading 'PROGRAM NAME'

 col module format a32 heading 'MODULE'

 col logon_time format a8 heading 'LOGON|TIME'

 col duration format a8 heading 'DURATION'

 col last_call_min format 9999 heading 'LAST|CALL|MIN'

 col status format a1 heading 'S'

 col hide_sql_hash_value noprint new_value _sql_hash_value

 rem

 select s.process,

 p.spid,

 /*

 p.pid,

 */

 s.sid,

 s.serial#,

 s.osuser,

 s.username,

 ( i.block_gets + i.consistent_gets ) /

 ( ( sysdate - s.logon_time ) * 86400 ) log_per_sec,

 i.block_gets + i.consistent_gets logical,

 physical_reads /

 ( ( sysdate - s.logon_time ) * 86400 ) phy_per_sec,

 i.physical_reads,

 /*

 s.audsid,

 */

 to_char( trunc(sysdate) + ( sysdate - s.logon_time ), 'hh24:mi:ss' ) duration,

 s.last_call_et/60 last_call_min,

 decode( s.status, 'ACTIVE', '*', 'INACTIVE', null, 'KILLED', 'K', '?' ) status,

 decode( s.action, 'Concurrent Request', 'CM/' || s.module, s.module ) module,

 s.sql_hash_value hide_sql_hash_value

 from v$process p, v$session s, v$sess_io i

 where i.sid = s.sid

 and s.paddr = p.addr

 and s.sid = &sid;

 rem

 set linesize 80

 rem

 ttitle 'SQL Text'

 rem

 col sql_text format a64 heading 'SQL TEXT'

 rem

 select sql_text

 from v$sqltext

 where hash_value = &_sql_hash_value

 and &_sql_hash_value <> 0

 order by piece;

 


–SCRIPT TO CHECK WHEN EBS USER LOG IN AND THE RESPONSIBILITY ACCESSED BY THE USER


NOTE: ‘Sign-On:Audit Level’ profile must be enabled in the EBS instance for the data to be collected.

 Choose the scope of your audit and who to audit by setting the user profile level at the user, responsibility, application, or site profile levels. Also remember, you should consider the additional system overhead required to precisely monitor and audit your users as they access Oracle Applications. The more users you audit and the higher the level of auditing, the greater the likelihood of incurring additional system overhead.

SELECT UNIQUE fu.user_id,

 fu.user_name user_name,

 fr.responsibility_key responsibility,

 fg.START_DATE respo_start_date,

 flr.start_time respo_last_access_date

 FROM fnd_user fu,

 fnd_user_resp_groups_all fg,

 fnd_application_tl fa,

 fnd_responsibility fr,

 fnd_login_responsibilities flr,

 fnd_logins fl

 WHERE fg.user_id = fu.user_id

 AND fg.responsibility_application_id = fa.application_id

 AND fa.application_id = fr.application_id

 AND fg.responsibility_id = fr.responsibility_id

 AND fa.LANGUAGE='US'

 AND fl.login_id = flr.login_id

 AND fu.user_id = fl.user_id

 AND fg.responsibility_id = flr.responsibility_id

 AND fg.end_date is Null

 and flr.start_time in (select max(start_time) from fnd_login_responsibilities group by RESPONSIBILITY_ID)

 ORDER BY fu.user_id,

 fr.responsibility_key,

 flr.start_time desc;