Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all 1640 articles
Browse latest View live

Query to find day by day redo generation

$
0
0
select trunc(completion_time) rundate ,count(*) logswitch ,round((sum(blocks*block_size)/1024/1024)) "REDO PER DAY (MB)" 
from v$archived_log 
group by trunc(completion_time) 
order by 1;

Script for moving sql profile

$
0
0
set sqlblanklines on

declare
ar_profile_hints sys.sqlprof_attr;
cl_sql_text clob;
version varchar2(3);
l_category varchar2(30);
l_force_matching varchar2(3);
b_force_matching boolean;
begin
 select regexp_replace(version,'\..*') into version from v$instance;

if version = '10' then

-- dbms_output.put_line('version: '||version);
   execute immediate -- to avoid 942 error
   'select attr_val as outline_hints '||
   'from dba_sql_profiles p, sqlprof$attr h '||
   'where p.signature = h.signature '||
   'and name like (''&&profile_name'') '||
   'order by attr#'
   bulk collect
   into ar_profile_hints;

elsif version = '11' then

-- dbms_output.put_line('version: '||version);
   execute immediate -- to avoid 942 error
   'select hint as outline_hints '||
   'from (select p.name, p.signature, p.category, row_number() '||
   '      over (partition by sd.signature, sd.category order by sd.signature) row_num, '||
   '      extractValue(value(t), ''/hint'') hint '||
   'from sqlobj$data sd, dba_sql_profiles p, '||
   '     table(xmlsequence(extract(xmltype(sd.comp_data), '||
   '                               ''/outline_data/hint''))) t '||
   'where sd.obj_type = 1 '||
   'and p.signature = sd.signature '||
   'and p.name like (''&&profile_name'')) '||
   'order by row_num'
   bulk collect
   into ar_profile_hints;

end if;


/*
declare
ar_profile_hints sys.sqlprof_attr;
cl_sql_text clob;
begin
select attr_val as outline_hints
bulk collect
into
ar_profile_hints
from dba_sql_profiles p, sqlprof$attr h
where p.signature = h.signature
and name like ('&&profile_name')
order by attr#;
*/

select
sql_fulltext
into
cl_sql_text
from
v$sqlarea
where
sql_id = '&&sql_id';

dbms_sqltune.import_sql_profile(
sql_text => cl_sql_text
, profile => ar_profile_hints
, category => '&&category'
, name => 'PROFILE_'||'&&sql_id'||'_moved'
-- use force_match => true
-- to use CURSOR_SHARING=SIMILAR
-- behaviour, i.e. match even with
-- differing literals
, force_match => &&force_matching
);
end;
/

undef profile_name
undef sql_id
undef category
undef force_matching

Script to find statements that have significantly different elapsed time than before

$
0
0
set lines 155
col execs for 999,999,999
col before_etime for 999,990.99
col after_etime for 999,990.99
col before_avg_etime for 999,990.99 head AVG_ETIME_BEFORE
col after_avg_etime for 999,990.99 head AVG_ETIME_AFTER
col min_etime for 999,990.99
col max_etime for 999,990.99
col avg_etime for 999,990.999
col avg_lio for 999,999,990.9
col norm_stddev for 999,990.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, execs, before_avg_etime, after_avg_etime, norm_stddev,
       case when to_number(before_avg_etime) < to_number(after_avg_etime) then 'Slower' else 'Faster' end result
-- select *
from (
select sql_id, sum(execs) execs, sum(before_execs) before_execs, sum(after_execs) after_execs,
       sum(before_avg_etime) before_avg_etime, sum(after_avg_etime) after_avg_etime,
       min(avg_etime) min_etime, max(avg_etime) max_etime, stddev_etime/min(avg_etime) norm_stddev,
       case when sum(before_avg_etime) > sum(after_avg_etime) then 'Slower' else 'Faster' end better_or_worse
from (
select sql_id,
       period_flag,
       execs,
       avg_etime,
       stddev_etime,
       case when period_flag = 'Before' then execs else 0 end before_execs,
       case when period_flag = 'Before' then avg_etime else 0 end before_avg_etime,
       case when period_flag = 'After' then execs else 0 end after_execs,
       case when period_flag = 'After' then avg_etime else 0 end after_avg_etime
from (
select sql_id, period_flag, execs, avg_etime,
stddev(avg_etime) over (partition by sql_id) stddev_etime
from (
select sql_id, period_flag, sum(execs) execs, sum(etime)/sum(decode(execs,0,1,execs)) avg_etime from (
select sql_id, 'Before' period_flag,
nvl(executions_delta,0) execs,
(elapsed_time_delta)/1000000 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 ss.begin_interval_time <= sysdate-&&days_ago
union
select sql_id, 'After' period_flag,
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
-- 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 ss.begin_interval_time > sysdate-&&days_ago
-- and s.snap_id >  7113
)
group by sql_id, period_flag
)
)
)
group by sql_id, stddev_etime
)
where norm_stddev > nvl(to_number('&min_stddev'),2)
and max_etime > nvl(to_number('&min_etime'),.1)
)
where result like nvl('&Faster_Slower',result)
order by norm_stddev
/

Script to Flush sql

$
0
0
set serveroutput on
set pagesize 9999
set linesize 155
var name varchar2(50)
accept sql_id -
       prompt 'Enter value for sql_id: '

BEGIN

select address||','||hash_value into :name
from v$sqlarea
where sql_id like '&&sql_id';

dbms_shared_pool.purge(:name,'C',1);

END;
/

undef sql_id
undef name

Script to find the child process and all details of an sql

$
0
0
col sql_text for a60 wrap
set verify off
set pagesize 999
set lines 155
col username format a13
col prog format a22
col sid format 999
col child_number format 99999 heading CHILD
col ocategory format a10
col avg_etime format 9,999,999.99
col avg_pio format 9,999,999.99
col avg_lio format 999,999,999
col etime format 9,999,999.99

select sql_id, child_number, plan_hash_value plan_hash, executions execs,
(elapsed_time/1000000)/decode(nvl(executions,0),0,1,executions) avg_etime,
buffer_gets/decode(nvl(executions,0),0,1,executions) avg_lio,
sql_text
from v$sql s
where upper(sql_text) like upper(nvl('&sql_text',sql_text))
and sql_text not like '%from v$sql where sql_text like nvl(%'
and sql_id like nvl('&sql_id',sql_id)
order by 1, 2, 3
/

Query to find the High CPU utilizing sessions

$
0
0
SET LINESIZE 145
SET PAGESIZE 9999
COLUMN sid               FORMAT 9999             HEADING 'SID'
COLUMN serial_id         FORMAT 999999           HEADING 'Serial#'
COLUMN session_status    FORMAT a9               HEADING 'Status'          JUSTIFY right
COLUMN oracle_username   FORMAT a12              HEADING 'Oracle User'     JUSTIFY right
COLUMN os_username       FORMAT a9               HEADING 'O/S User'        JUSTIFY right
COLUMN os_pid            FORMAT 9999999          HEADING 'O/S PID'         JUSTIFY right
COLUMN session_program   FORMAT a20              HEADING 'Session Program' TRUNC
COLUMN session_machine   FORMAT a14              HEADING 'Machine'         JUSTIFY right TRUNC
COLUMN cpu_value         FORMAT 999,999,999,999  HEADING 'CPU'
prompt
prompt +----------------------------------------------------+
prompt | User Sessions Ordered by CPU                       |
prompt +----------------------------------------------------+
SELECT
    s.sid                sid
  , s.serial#            serial_id
  , lpad(s.status,9)     session_status
  , lpad(s.username,12)  oracle_username
  , lpad(s.osuser,9)     os_username
  , lpad(p.spid,7)       os_pid
  , s.program            session_program
  , lpad(s.machine,14)   session_machine
  , sstat.value          cpu_value
FROM
    v$process  p
  , v$session  s
  , v$sesstat  sstat
  , v$statname statname
WHERE
      p.addr (+)          = s.paddr
  AND s.sid               = sstat.sid
  AND statname.statistic# = sstat.statistic#
  AND statname.name       = 'CPU used by this session'
ORDER BY cpu_value DESC

/

Query to find fast recovery area usage

$
0
0
SELECT (SPACE_LIMIT/1024/1024/1024)SPACE_LIMIT_gb,
(SPACE_USED/1024/1024/1024)SPACE_USED_gb,
(SPACE_RECLAIMABLE/1024/1024/1024)SPACE_RECLAIMABLE_gb,
((SPACE_LIMIT/1024/1024/1024)-(SPACE_USED/1024/1024/1024)+(SPACE_RECLAIMABLE/1024/1024/1024)) AVIALABLE_SPACE,
ROUND((SPACE_USED-SPACE_RECLAIMABLE)/SPACE_LIMIT*100,1)"PERCENT_FULL_OF_100%"
FROM V$RECOVERY_FILE_DEST;

Query to check when the profile was updated

$
0
0


select p.profile_option_name SHORT_NAME, n.user_profile_option_name "PROFILE 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, v.LAST_UPDATE_DATE 
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('BNE%')
--and trunc(v.LAST_UPDATE_DATE) > trunc(sysdate-170)
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
and v.LAST_UPDATE_DATE is not null
order by last_update_date desc, short_name, level_set;

Steps to create SSL for apex

$
0
0


Refer Doc id

How To Configure SSL For Oracle XML DB ( Doc ID 942976.1 )

How to Configure APEX to Use SSL ( Doc ID 740491.1 )


**********************************************************************

Step 1:

A wallet is required to be able to set up an SSL connection.

Ensure the files ewallet.p12 and cwallet.sso exist in the wallet directory.

Ensure these control parameters exist in the sqlnet configuration files (sqlnet.ora and listener.ora):
When setting these control parameters it is advised to make the edits using Oracle Net Manager

WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /ots0/app/oracle/product/11.1.0/network/admin))
)
 
SSL_CLIENT_AUTHENTICATION=FALSE

Verify a secure sqlplus connection succeeds:
 
In the listener.ora open a secure port:
  eg. add address:   (ADDRESS = (PROTOCOL = TCPS)(HOST = nlsu22)(PORT = 1966))
 
In the tnsnames.ora add:
 
v111_s =
(DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCPS) (Host = nlsu22) (Port = 1966) )
  (CONNECT_DATA = (SID = v111) )
)
 
Step 2:
=======

Set dispatcher for TCPS
 
Add the following entry in the database configuration file (init<SID>.ora:):
eg.
dispatchers='(PROTOCOL=TCP)(SERVICE=v111XDB)','(PROTOCOL=TCPS)(SERVICE=v111XDB)'
 
and restart the database instance. Alternatively make the change by means of the alter system command:
   
alter system set dispatchers = '(INDEX=0)(PROTOCOL=TCPS)(SERVICE=v111XDB)', '(INDEX=1)(PROTOCOL=TCP)(SERVICE=v111XDB)' scope=both;
 
You can set the dispatcher for TCPS only as well if desired.


Step 3:
=======

Set http2-port and http2-protocol in the XDB configuration:

See Note 942945.1

Check listener status to verify the ports are defined as endpoints.
This should look like:


STATUS of the LISTENER
------------------------
...
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nlsu22.nl.oracle.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nlsu22.nl.oracle.com)(PORT=8080))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=nlsu22.nl.oracle.com)(PORT=2100))(Presentation=FTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=nlsu22.nl.oracle.com)(PORT=1443))(Presentation=HTTP)(Session=RAW))
Services Summary...
...


Step 4:
======

In case of XDB Configuration

set serveroutput on

DECLARE
  l_cfgxml XMLTYPE;
  l_value VARCHAR2(5) := '&secure_port'; -- Secure port#
BEGIN
  l_cfgxml := DBMS_XDB.cfg_get();

  IF l_cfgxml.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/http2-port') = 0 THEN
  -- Add missing elements.

 SELECT insertChildXML
 (l_cfgxml, '/xdbconfig/sysconfig/protocolconfig/httpconfig', 'http2-port',
  XMLType('<http2-port xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">' ||
  l_value ||
  '</http2-port>'),
  'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
 )
 INTO l_cfgxml
 FROM dual;

 SELECT insertChildXML
 (l_cfgxml, '/xdbconfig/sysconfig/protocolconfig/httpconfig', 'http2-protocol',
  XMLType('<http2-protocol xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd">tcps</http2-protocol>'),
  'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
 )
 INTO l_cfgxml
 FROM dual;

  DBMS_OUTPUT.put_line('http2 port inserted.');
 ELSE
 -- Update existing element.
  SELECT updateXML
  (
  DBMS_XDB.cfg_get(),
  '/xdbconfig/sysconfig/protocolconfig/httpconfig/http2-port/text()',
   l_value,
   'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"'
  )
  INTO l_cfgxml
  FROM dual;

 DBMS_OUTPUT.put_line('http2 port updated.');
 DBMS_OUTPUT.put_line('Secure port changed into '||l_value);
END IF;

  DBMS_XDB.cfg_update(l_cfgxml);
  DBMS_XDB.cfg_refresh;
END;
/



Enter the port for the apex

************************************************************************************************

In 11g set port using below query

call dbms_xdb.setListenerEndPoint(2, null, 1443,2);


In 12c dbms_xdb.setListenerEndPoint is replaced by DBMS_XDB_CONFIG.SETLISTENERENDPOINT



Run this query to see the current secure settings in your XDB configuration:



col "Protocol" for a15
col "Port#" for a10

select extractValue(value(x),'/httpconfig/http2-protocol', 'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"') "Protocol"
,      extractValue(value(x),'/httpconfig/http2-port', 'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"') "Port#"
from   table(xmlsequence(extract(xdburitype('/xdbconfig.xml').getXML(),'/xdbconfig/sysconfig/protocolconfig/httpconfig'))) x
/

Create Self-signed certificate using orapki

$
0
0


orapki wallet create -wallet /ndevdb/oracle/TEST/self_signed


orapki wallet add -wallet /devdb/oracle/TEST/self_signed -dn 'CN=TEST,C=US' -keysize 2048 -self_signed -validity 3650


orapki wallet display -wallet /devdb/oracle/TEST/self_signed


orapki wallet export -wallet /devdb/oracle/TEST/self_signed -dn 'CN=TEST,C=US' -cert /devdb/oracle/TEST/self_signed/b64certificate.txt

Grant ACL to user for sending mail

$
0
0


Step – 1 :: create ACL scrip change “principal” name(Schema/User name).

begin
  dbms_network_acl_admin.create_acl(
    acl         => 'utl_smtp.xml',
    description => 'Allow mail to be send',
    principal   => 'USER',
    is_grant    => TRUE,
    privilege   => 'connect'
    );
    commit;
end;

Step – 2::
begin
  dbms_network_acl_admin.add_privilege (
  acl       => 'utl_smtp.xml',
  principal => 'USER',
  is_grant  => TRUE,
  privilege => 'connect'
  );
  commit;
end;

Step - 3 ::
begin
  dbms_network_acl_admin.assign_acl(
  acl  => 'utl_smtp.xml',
  host => '12.345.67.89',
  lower_port => 25,
  upper_port => 25
  );
  commit;
end;

TCPS Configuration for oracle database

$
0
0

Server side wallet
--------------------
======================================================
Server wallet location : /ndevdb/oracle/TEST/wallet
========================================================


orapki wallet create -wallet "/ndevdb/oracle/TEST/wallet" -pwd WalletPasswd123 -auto_login_local

orapki wallet add -wallet "/ndevdb/oracle/TEST/wallet" -pwd WalletPasswd123 \
  -dn "CN='DEVASCP.forbesmarshall.com'" -keysize 1024 -self_signed -validity 3650
 
 
  orapki wallet display -wallet "/ndevdb/oracle/TEST/wallet" -pwd WalletPasswd123
 
 
  orapki wallet export -wallet "/ndevdb/oracle/TEST/wallet" -pwd WalletPasswd123 \
   -dn "CN='DEVASCP.forbesmarshall.com'" -cert /tmp/'DEVASCP.forbesmarshall.com'-certificate.crt
 
 
   DEVASCP.forbesmarshall.com-certificate.crt
 
 
 Client Side Wallet
 --------------------
 ==========================================================
 Client Wallet location : /ndevdb/oracle/TEST/client_wallet
 ===========================================================

 orapki wallet create -wallet "/ndevdb/oracle/TEST/client_wallet" -pwd WalletPasswd123 -auto_login_local


 orapki wallet add -wallet "/ndevdb/oracle/TEST/client_wallet" -pwd WalletPasswd123 -dn "CN=DEVASCP" -keysize 1024 -self_signed -validity 3650


 orapki wallet display -wallet "/ndevdb/oracle/TEST/client_wallet" -pwd WalletPasswd123


 orapki wallet export -wallet "/ndevdb/oracle/TEST/client_wallet" -pwd WalletPasswd123 -dn "CN=DEVASCP" -cert /ndevdb/oracle/TEST/client_wallet/DEVASCP-certificate.crt



 Exchange Certificates
 ----------------------

 orapki wallet add -wallet "/ndevdb/oracle/TEST/client_wallet" -pwd WalletPasswd123 -trusted_cert -cert /tmp/DEVASCP.forbesmarshall.com-certificate.crt




 Load the client certificate into the server wallet.
 ---------------------------------------------------

 orapki wallet add -wallet "/ndevdb/oracle/TEST/wallet" -pwd WalletPasswd123 \
 -trusted_cert -cert /ndevdb/oracle/TEST/client_wallet/DEVASCP-certificate.crt





Opatch lsinventory or Apply Output Issue Because of Lock File

$
0
0
When performing command  "opatch lsinventory or opatch apply" in oracle RDBMS or FMW home you getting below errors like.,


OracleHomeInventory was not able to create a lock file, probably due to a failed OPatch Session. The loaded inventory might not show correctly what you have in the Oracle Home.
or
[ Error during Oracle Home discovery Phase]. Detail: OPatchSession cannot load inventory for the given Oracle Home /u01/appl/fs1/FMW_Home/oracle_common. Possible causes are:
   No read or write permission to ORACLE_HOME/.patch_storage
   Central Inventory is locked by another OUI instance
   No read permission to Central Inventory
   The lock file exists in ORACLE_HOME/.patch_storage

   The Oracle Home does not exist in Central Inventory

Follow below steps to Solve the issue:
Step 1: Checks all running sessions related to RDBMS & FMW home is killed properly.

Step 2:  Check the "patch_locked" file is exists in "$ORALCE_HOME/.patch_storage/"

Step 3: Remove or rename the "patch_locked" file.

rm $ORALCE_HOME/.patch_storage/patch_locked 
OR
mv $ORALCE_HOME/.patch_storage/patch_locked $ORALCE_HOME/.patch_storage/patch_locked_delete

Then rerun the opatch.

Weblogic Patching Error Using BSU - "java.lang.OutOfMemoryError: GC overhead limit exceeded"

$
0
0
While applying Weblogic bsu patch manually, we frequently get below error like.,

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.util.AbstractCollection.toArray(AbstractCollection.java:136)
        at java.util.ArrayList.addAll(ArrayList.java:559)
        at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.getProperties(SchemaTypeImpl.java:705)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.loadPropertyMap(XBeanDataHandler.java:775)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.<init>(XBeanDataHandler.java:99)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.createDataHandler(XBeanDataHandler.java:559)
        at com.bea.cie.common.dao.xbean.XBeanDataHandler.getComplexValue(XBeanDataHandler.java:455)
        at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getPatchDependencies(PatchCatalogHelper.java:442)
        at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getPatchDependencies(PatchCatalogHelper.java:464)
        at com.bea.plateng.patch.dao.cat.PatchCatalog.getPatchDependencies(PatchCatalog.java:56)
        at com.bea.plateng.patch.dao.cat.PatchCatalogHelper.getInvalidatedPatchMap(PatchCatalogHelper.java:1621)
        at com.bea.plateng.patch.PatchSystem.updatePatchCatalog(PatchSystem.java:436)
        at com.bea.plateng.patch.PatchSystem.refresh(PatchSystem.java:130)
        at com.bea.plateng.patch.PatchSystem.setCacheDir(PatchSystem.java:201)
        at com.bea.plateng.patch.Patch.main(Patch.java:281)

Solution:
Follow these steps to resolve the issue:

1. Go to $FMW_Home/utils/bsu.
2. Edit bsu.sh (for UNIX) or bsu.cmd (for Windows).
3. Here you will find the following: MEM_ARGS="-Xms256m -Xmx512m"
4. Increase these values as needed: for example, to "-Xms2048m -Xmx2048m".

rerun the patch using below command:

bsu.sh -patch_download_dir=$FMW_Home/utils/bsu/cache_dir -prod_dir=$FMW_Home/wlserver_10.3 -patchlist=<Patch name> -verbose -install


ADOP Fails With Error "PLS-00201: identifier 'AD_JAR.GET_JRIPASSWORDS' must be declared

$
0
0
When applying ADOP patch getting below error.,

AutoPatch error:
ORA-06550: line 3, column 1:
PLS-00201: identifier 'AD_JAR.GET_JRIPASSWORDS' must be declared
ORA-06550: line 3, column 1:
PL/SQL: Statement ignored

Solution:

Step 1:
Please login as applmgr.
Source the application RUN environment file.

Step 2:

 cd $AD_TOP/patch/115/sql/

check below files are present in the location.,
1.ADJRIS.pls

2. ADJRIB.pls

if these files are present in the above path , Login to database as apps database user and run below 2 SQL's

incase the files are not present in the location then apply patch 1702376 and then re execute the patch.

Article 4

$
0
0

Script to Enable Plan Baseline 



set long 32767
set pages 9999
set lines 200
set serveroutput on size 1000000


accept SQL_Handle prompt "Enter the SQL handle: ";

accept plan_name  prompt "Enter the SQL plan name : ";


DECLARE
    lv_plans       pls_integer;
    lv_sql_handle  VARCHAR2(30) := '&SQL_Handle';
    lv_plan_name   VARCHAR2(30) := '&plan_name';
BEGIN
    lv_plans := DBMS_SPM.alter_SQL_PLAN_BASELINE (
        sql_handle => lv_sql_handle,
        plan_name  => lv_plan_name,
        attribute_name  => 'enabled',
        attribute_value => 'YES'
    );
    DBMS_OUTPUT.PUT_LINE('Plans Altered: '||TO_CHAR(lv_plans));
    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(SQLERRM);

END;
/

Article 3

$
0
0

Script to Disable Plan Baseline 



set long 32767
set pages 9999
set lines 200
set serveroutput on size 1000000


accept SQL_Handle prompt "Enter the SQL handle: ";

accept plan_name  prompt "Enter the SQL plan name : ";


DECLARE
    lv_plans       pls_integer;
    lv_sql_handle  VARCHAR2(30) := '&SQL_Handle';
    lv_plan_name   VARCHAR2(30) := '&plan_name';
BEGIN
    lv_plans := DBMS_SPM.alter_SQL_PLAN_BASELINE (
        sql_handle => lv_sql_handle,
        plan_name  => lv_plan_name,
        attribute_name  => 'enabled',
        attribute_value => 'NO'
    );
    DBMS_OUTPUT.PUT_LINE('Plans Altered: '||TO_CHAR(lv_plans));
    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(SQLERRM);

END;
/

Article 2

$
0
0

Script to Drop Plan Baseline 



set long 32767
set pages 9999
set lines 200
set serveroutput on size 1000000


accept SQL_Handle prompt "Enter the SQL handle: ";

accept plan_name  prompt "Enter the SQL plan name : ";


DECLARE
    lv_plans       pls_integer;
    lv_sql_handle  VARCHAR2(30) := '&SQL_Handle';
    lv_plan_name   VARCHAR2(30) := '&plan_name';
BEGIN
    lv_plans := DBMS_SPM.drop_SQL_PLAN_BASELINE (
        sql_handle => lv_sql_handle,
        plan_name  => lv_plan_name
    );
    -- DBMS_OUTPUT.PUT_LINE(TO_CHAR(lv_plans));
    EXCEPTION
        WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(SQLERRM);

END;
/

Article 1

$
0
0

Script to Show Plan Baseline 



set long 32767
set pages 9999
set lines 140
set verify off

accept sql_id  prompt "Enter the SQL ID : ";
variable sql_id varchar2

COLUMN sql_id     FORMAT A13
COLUMN sql_handle FORMAT A21 newline
COLUMN plan_name  FORMAT A31
COLUMN origin     FORMAT A14
COLUMN enabled    FORMAT A7
COLUMN accepted   FORMAT A8
COLUMN fixed      FORMAT A5
COLUMN autopurge  FORMAT A9
COLUMN CREATED    FORMAT A19
COLUMN sql_text   FORMAT A130 word_wrapped newline heading sql_text
column signature  format 99999999999999999999
column sql_id     format a13

select -- sql_text sql_text,
       s.sql_id, signature, EXECUTIONS,
       round(ELAPSED_TIME/decode(EXECUTIONS, 0, 1, EXECUTIONS),2) ELAPSED_TIME,
       round(CPU_TIME/decode(EXECUTIONS, 0, 1, EXECUTIONS),2) CPU_TIME,
       round(BUFFER_GETS/decode(EXECUTIONS, 0, 1, EXECUTIONS),2) BUFFER_GETS,
       round(DISK_READS/decode(EXECUTIONS, 0, 1, EXECUTIONS),2) DISK_READS, OPTIMIZER_COST,
       sql_handle, plan_name, origin, enabled, accepted, fixed, autopurge,
       to_char(CREATED , 'mm/dd/yyyy hh24:mi:ss') CREATED
from dba_sql_plan_baselines spb,
    (select distinct exact_matching_signature, sql_id
     from v$sql) s
where s.exact_matching_signature (+) = spb.SIGNATURE
  and (s.sql_id like '%&SQL_ID%')
order by CREATED
/

Article 0

$
0
0

Script to check the Data Guard status



set feedb off
set pages 99

set lines 200

column dbid              format 9999999999 heading "DbId"
column name              format a9 heading "Name"
column open_mode         format a21 heading "Open Mode"
column protection_mode   format a20 heading "Protect Mode"
column protection_level  format a20 heading "Protect Level"
column switchover_status format a18 heading "SwitchOver | Status"
column remote_archive    format a8 heading "Remote|Archive"
column database_role     format a16 heading "Database Role"
column flashback_on      format a5  heading "Flash|Back"
column created           format a19 heading "Created "
column RESETLOGS_TIME    format a19 heading "Resetlogs "
column db_unique_name    format a24 heading "DB Unique Name"

select dbid, db_unique_name, open_mode, database_role,
       -- to_char(created, 'mm/dd/yyyy hh24:mi:ss') created,
       -- to_char(RESETLOGS_TIME, 'mm/dd/yyyy hh24:mi:ss') RESETLOGS_TIME,
       protection_mode, switchover_status,
       flashback_on  /* 10g only */
from v$database
;
set lines 200
col dest_id       format 99 heading "ID"
col archiver      format a6 heading "Archvr"
col transmit_mode format a12 heading "Transmit|Mode"
col affirm        format a3  heading "Aff"
col async_blocks  format 999999 heading "Async|Blocks"
col net_timeout   format 999999 heading "Network|Timeout"
col delay_mins    format 999999 heading "Delay|Minutes"
col reopen_secs   format 999999 heading "Reopen|Seconds"
col register      format a3     heading "Reg"
col binding       format a10    heading "Binding"
col dest_name     format a20    heading "Dest Name"
col destination   format a29    heading "Destination"
col error         format a20    heading "Error"

SELECT dest_id, dest_name, status, protection_mode, destination, srl, error
FROM v$archive_dest_status
WHERE destination is not null    -- and status = 'VALID'
ORDER BY dest_id;

set lines 200
col dest_id       format 99  heading "ID"
col archiver      format a10 heading "Archiver"
col transmit_mode format a12 heading "Transmit|Mode"
col affirm        format a3  heading "Aff"
col async_blocks  format 999999 heading "Async|Blocks"
col net_timeout   format 999999 heading "Network|Timeout"
col delay_mins    format 999999 heading "Delay|Minutes"
col reopen_secs   format 999999 heading "Reopen|Seconds"
col register      format a3     heading "Reg"
col binding       format a10    heading "Binding"
col valid_type    format a15    heading "Valid Type"
col valid_role    format a12    heading "Valid Role"
col valid_now     format a16     heading "Valid now?"

SELECT dest_id, archiver, transmit_mode, affirm, async_blocks,
       net_timeout, delay_mins, reopen_secs, register, binding,
       valid_type, valid_role, valid_now
FROM v$archive_dest
WHERE register = 'YES' OR valid_now = 'YES'
ORDER BY dest_id;

set lines 200

column status            format a12
column time              format a22
column SEVERITY          format a13
column DEST_ID           format 9999  heading "Dest|  ID"
column ERROR_CODE        format 99999 heading "Error| Code"
column TIMESTAMP         format a20
column MESSAGE           format a80 word_wrapped

select PROCESS, status, SEQUENCE#, THREAD#, BLOCK#, BLOCKS,
       TO_CHAR(SYSDATE, 'DD-MON-YYYY HH:MI:SS') TIME
from V$MANAGED_STANDBY;

column message format a93 word_wrapped
select message, timestamp
from v$dataguard_status
where severity in ('Error','Fatal')
  and timestamp between systimestamp -1 and systimestamp
order by timestamp;

set lines 200
col thrd        format 9999          heading "Thrd"
col almax       format 9999999       heading "Last Seq|Received"
col alscn1      format 9999999999999 heading "Received|First-SCN"
col alnscn      format 9999999999999 heading "Received|Next-SCN"
col lhmax       format 9999999       heading "Last Seq|Applied"
col lhscn1      format 9999999999999 heading "Applied|First-SCN"
col lhnscn      format 9999999999999 heading "Applied|Next-SCN"
col log1sttime  format a19           heading "Received 1st Time"
col hist1sttime format a19           heading "Applied 1st Time"
col diff        format 9999          heading "Diff"

select al.thrd, almax, log1sttime, alscn1, alnscn,
       lhmax, hist1sttime, lhscn1, lhnscn, almax-lhmax diff
from (select thread# thrd, max(sequence#) almax, max(FIRST_CHANGE#) alscn1,
      max(next_change#) alnscn, to_char(max(first_time),'yyyy/mm/dd hh24:mi:ss') log1sttime
      from v$archived_log
      where resetlogs_change#=(select resetlogs_change# from v$database)
      group by thread#) al,
     (select thread# thrd, max(sequence#) lhmax,  max(FIRST_CHANGE#) lhscn1,
        max(next_change#) lhnscn, to_char(max(first_time),'yyyy/mm/dd hh24:mi:ss') hist1sttime
      from v$log_history
      where first_time=(select max(first_time) from v$log_history)
      group by thread#) lh
where al.thrd(+) = lh.thrd;

col name format a24
col value format a90
select name, value from v$parameter
where name ='log_archive_config' or name like 'dg_broker_%'
   or name like 'fal_%'
order by name;

set feedb on

Viewing all 1640 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>