Monday, July 11, 2016

Finding Archivelog Names using the SCN

How to find the Archivelog names using the SCN

During database recovery,we may have a SCN number and need to know the archivelog names.

set pages 300 lines 300
col first_change# for 9,999,999,999
col next_change# for 9,999,999,999

alter session set nls_date_format='DD-MON-RRRR HH24:MI:SS';

select name, thread#, sequence#, status, first_time, next_time, first_change#, next_change# from v$archived_log
where between first_change# and next_change#;

SEQUENCE# number usually shows up on the archivelog name.

If you see 'D' in the STATUS column, the archive log has been deleted from the disk. You may need to restore it from the tape.

rman target /

list backup of archivelog from logseq= until logseq=

restore archivelog from logseq= until logseq=;

Tuesday, July 5, 2016

Troubleshooting Workflow Notification Mailer Issues

Find Workflow Notification Mailer is up and Running?

SELECT component_name, component_status
FROM fnd_svc_components
WHERE component_type = ‘WF_MAILER’;

Workflow log’s: FNDCPGSC*.txt under $APPLCSF/$APPLOG directory

Find the Failed One’s?

Select NOTIFICATION_ID, MESSAGE_TYPE, MESSAGE_NAME, STATUS, MAIL_STATUS, FROM_USER, TO_USER from wf_notifications where MAIL_STATUS=’FAILED’;

Check pending e-mail notification that was pending for process.

Sql> SELECT COUNT(*), message_name FROM wf_notifications
WHERE STATUS=’OPEN’
AND mail_status = ‘MAIL’
GROUP BY message_name;

Sql> SELECT * FROM wf_notifications
WHERE STATUS=’OPEN’
AND mail_status = ‘SENT’
ORDER BY begin_date DESC

Check the Workflow notification has been sent or not?

select mail_status, status from wf_notifications where notification_id=

–If mail_status is MAIL, it means the email delivery is pending for workflow mailer to send the notification
–If mail_status is SENT, its means mailer has sent email
–If mail_status is Null & status is OPEN, its means that no need to send email as notification preference of user is “Don’t send email”
–Notification preference of user can be set by user by logging in application + click on preference + the notification preference

1. Verify whether the message is processed in WF_DEFERRED queue

select * from applsys.aq$wf_deferred a where a.user_data.getEventKey()= ”
– notification id

2. If the message is processed successfully message will be enqueued to WF_NOTIFICATION_OUT queue, if it errored out it will be enqueued to WF_ERROR queue

select wf.user_data.event_name Event_Name, wf.user_data.event_key Event_Key,
wf.user_data.error_stack Error_Stack, wf.user_data.error_message Error_Msg
from wf_error wf where wf.user_data.event_key = ‘
To check what all mails have went and which all failed ?

Select from_user,to_user,notification_id, status, mail_status, begin_date
from WF_NOTIFICATIONS where status = ‘OPEN’;

Select from_user, to_user, notification_id, status, mail_status,begin_date,USER_KEY,ITEM_KEY,MESSAGE_TYPE,MESSAGE_NAME begin_date
from WF_NOTIFICATIONS where status = ‘OPEN’;

Users complain that notifications are stuck ?

Use the following query to check to see whatever the users are saying is correct

SQL> select message_type, count(1) from wf_notifications
where status=’OPEN’ and mail_status=’MAIL’ group by message_type;

E.g o/p of query –

MESSAGE_Type COUNT(1)
——– ———-
POAPPRV 11 — 11 mails of Po Approval not sent —
INVTROAP 12
REQAPPRV 9
WFERROR 45 — 45 mails have error

If Mail not received by User ?

select Name,DISPLAY_NAME,EMAIL_ADDRESS,NOTIFICATION_PREFERENCE,STATUS
from wf_users where DISPLAY_NAME=’xxx,yyy’ ;

Status – Active
Notification_preference-> Mailtext
Email Address should not be null

Notification not sent waiting to be mailed ?

SQL> select notification_id, status, mail_status, begin_date from WF_NOTIFICATIONS
where status = ‘OPEN’ and mail_status = ‘MAIL’;
To debug the notification id ?

$FND_TOP/sql
run wfmlrdbg.sql
******************************

Note: 1054215.1 – How to Check if the Workflow Mailer is Running
Note: 415516.1 – How to Check Whether Notification Mailer is Working or Not
Note: 831982.1 – 11i/R12 – A guide for troubleshoting Workflow Notification Emails – Inbound and Outbound
Note: 1012344.7 – Notifications Not Being Sent In Workflow
Note: 560472.1 – Workflow Mailers Not Sending Notifications
Please see (Note: 753845.1 – How to Perform a Meaningful SMTP Telnet Test to Troubleshoot Java Mailer Issues), the same error is reported in this doc.

Friday, June 17, 2016

Oracle Apps R12.2 Log Files Location

1. R12.2 Start/Stop Log Files:

a) Startup/Shutdown error message text files like adstrtal.txt, adstpall, adapcctl.txt, adcmctl.txt…for services like oacore, forms, apache, opmn, weblogic admin server/node manager etc
$INST_TOP/logs/appl/admin/log
Log files for start/stop of services from $ADMIN_SCRIPTS_HOME
Here is an image representing EBS R12.2 Service control (start/stop) logs:
Green colour boxes indicates location of log files 

 2. Patching Log files:
a) The Online Patching (ADOP) log files are located on the non-editioned file system (fs_ne), under :
$NE_BASE/ EBSapps/ log/adop//__
Notefs1 and fs2 are dual file system for software where as fs_ne contains non editioned objects 
This log directory will contain patch logspatch worker logs and other patch related log files created for specific purposes.
Also, some patch tasks may create separate log files in the same directory from where patch executable is started
3. Log files for concurrent programs/managers
$NE_BASE/ inst//logs/appl/conc/log
 Output files for concurrent programs/managers
$NE_BASE/inst//logs/appl/conc/out
Here is an image representing EBS R12.2 Non-Editioned file system Logs:
Patching Log file Location:
4. Cloning related Log Files:
a) Pre-clone log files in source instance
     I. Database Tier
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/(StageDBTier_MMDDHHMM.log)
    II. Application Tier
$INST_TOP/admin/log/ (StageAppsTier_MMDDHHMM.log)
b) Clone log files in target instance
    I. Database Tier
$ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDBTier_
    II. Apps Tier
$INST_TOP/admin/log/ApplyAppsTier_

5. AutoConfig log file:
Autoconfig can be run on Application Tier or Database Tier
a) Autoconfig Log Location on Application tier :
$INST_TOP/admin/log/$MMDDHHMM/adconfig.log
b) Autoconfig Log Location on Database tier:
$ORACLE_HOME/ appsutil/ log/ $CONTEXT_NAME/ /  *.log

6.  Installation Related Logs:
There are four main phases (in context of logs) during R12.2 installation, here is log location of all four phases .
a) The Rapidwiz Configuration File is saved in below locations:
$TMP//conf_.txt
$INST_TOP/conf_.txt
/ appsutil/ conf_.txt
b) Pre-install system check logs:
$TMP//.log
$TMP/dbPreInstCheck.xxxxx.log
$TMP/wtprechk.xxxx/wtprechk.xxxx.log
/logs/installActions.log
c) Database tier
I. Main Installation log:
RDBMS $ORACLE_HOME/ appsutil/ log/ $CONTEXT_NAME/ .log
II. ORACLE HOME installation logs:
RDBMS $ORACLE_HOME/ temp/ $CONTEXT_NAME/ logs/ *.log
/logs/*.log
d) Application tier
Both primary(Run) and Secondary Edition (Patch) file systems will each contain these logs:
    I. Main Installation Log:
$INST_TOP/logs/.log
    II. FMW and OHS TechStack Installation/Patching logs:
$APPL_TOP/admin/$CONTEXT_NAME/log/*
/logs/*.log
    III. Forms Oracle Home installation logs:
$APPL_TOP/admin/$CONTEXT_NAME/log/*.log
Here is an image representing the R12.2 Installation logs

6. Fusion Middleware (FMW_HOME) Log Files:
a) Log files for OPMN and OHS processes: Below directory contains log files related OPMN process(opmn.log), OPMN Debug logs(debug.log), HTTP Transaction logs (access.log), security settings related logs.
$IAS_ORACLE_HOME/ instances/ /diagnostics/logs
b) Log files for weblogic node manager: Log file is generated by Node Manager and contains data for all domains that are controlled by Node Manager on a given physical machine.
$FMW_HOME/ wlserver_10.3/ common/ nodemanager/ nmHome1/ nodemanager.log
c) Log files for weblogic Oracle Management Service log file: Initial settings AdminServer and Domain level information is written in this log file.
$EBS_DOMAIN_HOME/sysman/log
d) Log files for server processes initiated through weblogic: Stdout and stderr messages generated by the server instance (server instances like forms, oafm, oacore etc) at NOTICE severity level or higher are written by Weblogic Node Manager to below directory.
$EBS_DOMAIN_HOME/ servers/ / logs/ .out
Here is an image representing EBS R12.2 Fusion Middleware Log files:

Wednesday, June 15, 2016

ERROR 1033 RECEIVED LOGGING ON TO THE STANDBY

Archive shipping from Primary to DR was not working.

Checked alert log on DR site and it was waiting for an archive from Primary.

On Primary following error was there in alert log :

Error 1033 received logging on to the standby

Re-created password file on Primary and copied it over to DR site to fix the issue.

Tuesday, June 7, 2016

Calculate ArchiveLog Size

Archivelog size each day

SQL> select trunc(COMPLETION_TIME) TIME, SUM(BLOCKS * BLOCK_SIZE)/1024/1024 SIZE_MB from V$ARCHIVED_LOG group by trunc (COMPLETION_TIME) order by 1;

TIME SIZE_MB
---------- ----------
2011-02-12 71797.87
2011-02-13 75880.52
2011-02-14 73569.37
2011-02-15 76776.81
2011-02-16 73959.86
2011-02-17 69969.71
2011-02-18 74677.10
2011-02-19 75474.95
2011-02-20 77967.07
2011-02-21 67802.70

Archivelog size each hour

SQL> alter session set nls_date_format = 'YYYY-MM-DD HH24';

Session altered.

SQL> select trunc(COMPLETION_TIME,'HH24') TIME, SUM(BLOCKS * BLOCK_SIZE)/1024/1024 SIZE_MB from V$ARCHIVED_LOG group by trunc (COMPLETION_TIME,'HH24') order by 1;

TIME SIZE_MB
------------- ----------
2011-02-21 00 6396.65
2011-02-21 01 2797.31
2011-02-21 02 2010.45
2011-02-21 03 1871.77
2011-02-21 04 1481.5
2011-02-21 05 2868.20
2011-02-21 06 2363.89
2011-02-21 07 4269.26
2011-02-21 08 2469.08
2011-02-21 09 3007.06
2011-02-21 10 3561.97
2011-02-21 11 2530.57
2011-02-21 12 3509.08
2011-02-21 13 3022.5
2011-02-21 14 3514.97
2011-02-21 15 4057.45
2011-02-21 16 3021.27
2011-02-21 17 4014.31
2011-02-21 18 4011.66
2011-02-21 19 4008.10
2011-02-21 20 3015.46

Thursday, June 2, 2016

Apply Phase Options ABANDON and RESTART

adop phase=apply patches=10721639 abandon=yes


Used to specify whether to restart the previous run of adop. May be useful if the previous action had an error. Note: If there was an error in the previous run, and 'abandon' is not set to 'yes', the same parameters will be re-used that were used in the failed run.


If you give a value for the 'restart' parameter, it cannot be the same as the value given for this parameter.


adop phase=apply patches=10721639 restart=yes


Used to specify whether to restart the previous run of ADOP. May be useful if the previous action had an error.


If you give a value for the 'abandon' parameter, it cannot be the same as the value given for this parameter.



The below option is not going to work


adop phase=apply patches=10721639 restart=yes abandon=yes

Tuesday, May 17, 2016

Transporting a SQL Profile

To transport a SQL profile:
  1. Connect SQL*Plus to the database with the appropriate privileges, and then use the CREATE_STGTAB_SQLPROF procedure to create a staging table to hold the SQL profiles.
    The following example creates my_staging_table in the dba1 schema:
    BEGIN
      DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF ( 
        table_name  => 'my_staging_table'
    ,   schema_name => 'dba1' 
    );
    END;
    /
    
  2. Use the PACK_STGTAB_SQLPROF procedure to export SQL profiles into the staging table.
    The following example populates dba1.my_staging_table with the SQL profile my_profile:
    BEGIN
      DBMS_SQLTUNE.PACK_STGTAB_SQLPROF (  
        profile_name         => 'my_profile'
    ,   staging_table_name   => 'my_staging_table'
    ,   staging_schema_owner => 'dba1' 
    );
    END;
    / 
    
  3. Move the staging table to the database where you plan to unpack the SQL profiles.
    Move the table using your utility of choice. For example, use Oracle Data Pump or a database link.
  4. On the database where you plan to import the SQL profiles, use UNPACK_STGTAB_SQLPROF to unpack SQL profiles from the staging table.
    The following example shows how to unpack SQL profiles in the staging table:
    BEGIN
      DBMS_SQLTUNE.UNPACK_STGTAB_SQLPROF(
         replace            => true
    ,    staging_table_name => 'my_staging_table'
    );
    END;
    /