Thursday, February 11, 2010

Block Corruption and Recovery

Step 1: Identify the corrupt blocks
-----------------------------------
1. Run below command to populate v$database_block_corruption view with information of all the corrupted blocks.

RMAN> backup validate check logical database;

“CHECK LOGICAL" option is used to identify both Physical and Logical Block Corruptions.

Select the view to identify the corrupted blocks detected by RMAN.
SQL> select * from v$database_block_corruption;

Please note, After a corrupt block is repaired, the row identifying the block is deleted from the view.

2. Check alert. log file for corrupted blocks, data file list.
For ex:- ORA-01578: ORACLE data block corrupted (file # 5, block # 15)
ORA-01110: data file 5: '/oracle/oradata/trgt/users01.dbf'

3. You can also use dbverify utility to identify Physical and Logical Intra Block Corruptions.
dbv file=datafile_name blocksize=datafile_block_size

Step 2: Recovering Data blocks
-------------------------------
1. Recovering Data blocks By Using All Available Backups

Run the BLOCKRECOVER command at the RMAN prompt, specifying the file and block numbers for the corrupted blocks

RMAN>BLOCKRECOVER DATAFILE 5 BLOCK 15;

Recover multiple blocks in single command
RMAN>BLOCKRECOVER DATAFILE 5 BLOCK 15 DATAFILE 2 BLOCK 10;

2. Recovering Data blocks Using Selected Backups

Run the BLOCKRECOVER command at the RMAN prompt, Specifying the data file and block numbers for the corrupted blocks and limiting the backup candidates by means of the available options. For example, specify what type of backup should be used to restore the blocks.

# restore from backupset
RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 15 FROM BACKUPSET;

# restore from datafile image copy
RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 15 FROM DATAFILECOPY;

# restore from backup set with tag "Sunday"
RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 15 FROM TAG = Sunday;

# restore using backups created before log sequence 100
RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 15 RESTORE UNTIL SEQUENCE 100;

# restore using one week ago backups
RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 15 RESTORE UNTIL 'SYSDATE-7';

# restore using backups until SCN 100
RMAN> BLOCKRECOVER DATAFILE 5 BLOCK 15 RESTORE UNTIL SCN 100;

3 . Recovering blocks listed in V$DATABASE_BLOCK_CORRUPTION view

Run the below command to recover all blocks marked corrupt in V$DATABASE_BLOCK_CORRUPTION
RMAN> BLOCKRECOVER CORRUPTION LIST;

Restores blocks from backup sets created more than 7 days ago
RMAN> BLOCKRECOVER CORRUPTION LIST FROM BACKUPSET RESTORE UNTIL TIME 'SYSDATE-7';

Note:-Block corruptions in RMAN backups and copies is kept in V$BACKUP_CORRUPTION and V$COPY_CORRUPTION

Step 3: Allow Recovery to corrupt blocks
-----------------------------------------
During recovery database finds corrupt blocks then recovery stops. Run the below command in order to skip the corrupt blocks and proceed with recovery.

SQL>RECOVER DATABASE ALLOW n CORRUPTION;

Where n is the number of allowable corrupt blocks

Friday, January 15, 2010

Oracle EBS-Demantra Integration Patch

Install Oracle EBS-Demantra Integration Patch

Download Oracle EBS-Demantra Integration Patch(6606568)

1. Apply this patch in Your Oracle R12 EBS

2. If Demantra is installed after this patch has been applied, please run msddemcrsyn.sql from $MSD_TOP/patch/115/sql.

After Apply Patch
1. Login System Administrator Responsibility
2. Nav: Profile -> System
3. Query profile MSD_DEM: Host URL.
4. Change value to http://hostname:port/demantra e.g (http://sys50.doyen.in:8080/demantra)
5. Save.
6. Run the following script on the ASCP/MSC instance which also contains the Demantra Schema to determine the actual schema name for Demantra:

select owner
from all_tables
where table_name = 'SALES_DATA';

7. Set profile option MSD_DEM: Schema = to the value returned from the script in step 1 at the site level and save. System Administrator/Profiles/System - query for MSD_DEM:% - select the Find button - Find/scroll to the profile option MSD_DEM: Schema - set the correct value at the site level - save

8.SQL>select fnd_profile.value('MSD_DEM_SCHEMA') from dual;

9.SQL>select fnd_profile.value('MSD_DEM_HOST_URL') from dual;

10.Login Demand Management System Administrator

Collaborator Workbench
http://sys50.doyen.in:8080/demantra/portal/loginpage.jsp

Web client
http://sys50.doyen.in:8080/demantra/portal/partnerLogin.jsp

Oracle Demantra Anywhere version of Collaborator Workbench
http://sys50.doyen.in:8080/demantra/portal/remoteloginpage.jsp

Oracle Demantra Anywhere version of Web client alone
http://sys50.doyen.in:8080/demantra/portal/anywhereLogin.jsp

Offline access to Oracle Demantra worksheets
http://sys50.doyen.in:8080/demantra/portal/launchDPWeb.jnlp

Dynamic Open Link (DOL) access for third-party reporting tools
http://sys50.doyen.in:8080/demantra/portal/DOL_HTML.htm

User Management
http://sys50.doyen.in:8080/demantra/portal/userManagement.jsp

Collaborator Workbench Administration
http://sys50.doyen.in:8080/demantra/portal/adminLogin.jsp

Workflow Manager
http://sys50.doyen.in:8080/demantra/workflow/login.jsp

Technical Administration
http://sys50.doyen.in:8080/demantra/admin

Metalink ID: 434991.1 - EBS-Demantra Integration Installation Overview and Diagram

How this Rapid Wizard installation works are

The basics of how this Rapid Wizard installation works are:-

1.RapidWizard collects user information required for configuration of system, and creates a configuration file
2.RapidWizard checks Port availability and file space required
3.Zip files from the "oraDB and oraAppDB" DVD stage area are then uncompressed onto the file system
4.Each Disk directory contains a driver which is read to control the unzip phase
5.The DB Techstack is relinked and reconfigured using an install driver, templates and the configuration file
6.Control files are created
7.The RDBMS ORACLE_HOME is registered into the Global Inventory
8.The DB is started, and further configuration is performed
9.Zip files from the "oraAS" (Developer Tools and As10g" DVD stage area are then uncompressed onto the file system
10.The Apps Techstack is relinked and reconfigured using the install driver, templates and the configuration file
11.The Developer Tools and As10g ORACLE_HOMEs are registered into the Global Inventory
12.Zip files from the "oraApps" (APPL_TOP, COMMON_TOP etc) stage are uncompressed onto the file system
13.APPL_TOP is reconfigured with system using values in the configuration file and services are started
14.Post install checks are performed to check success of the installation

Oracle Apps EBS R12 Installing Log Files

Where are the log files?

The following are referenced in this document

{MMDDHHMM} : MM (Month) DD (Day) HH (Hour) MM (Minute)
{Timestamp} : {This may include Year, Month, Day, and Time}
{Base Install} : Location chosen during the RapidWiz configuration phase
$CONTEXT_NAME : {SID}_{hostname}
RDBMS $ORACLE_HOME} : {Base Install}/db/tech_st/10.2.0
$IAS_ORACLE_HOME : {Base Install}/apps/tech_st/10.1.3
Tools $ORACLE_HOME : {Base Install}/apps/tech_st/10.1.2
$INST_TOP : {Base Install}/inst/apps/$CONTEXT_NAME
$APPL_TOP : {Base Install}/apps/apps_st/appl

Before the installation starts:

$TMP/{MMDDHHMM}/{MMDDHHMM}.log$TMP/{MMDDHHMM}/{hostname}_{SID}.xml
$TMP/{MMDDHHMM}/{hostname}_{SID}_apps.xml

The Rapidwiz Configuration File is saved in 3 locations:-

$TMP/{MMDDHHMM}/conf_{SID}.txt$INST_TOP/conf_{SID}.txt{RDBMS ORACLE_HOME}/appsutil/conf_{SID}.txt

Database Tier:

RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/{MMDDHHMM}.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDBTechStack_{MMDDHHMM}.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ohclone.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/make_{MMDDHHMM}.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/installdbf.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/adcrdb_{SID}.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/ApplyDatabase_{MMDDHHMM}.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/{MMDDHHMM}/adconfig.log
RDBMS $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/{MMDDHHMM}/NetServiceHandler.log

Applications Tier(s):

$INST_TOP/logs/{MMDDHHMM}.log
$APPL_TOP/admin/$CONTEXT_NAME/log/ApplyAppsTechStack.log
$INST_TOP/logs/ora/10.1.2/install/make_{MMDDHHMM}.log
$INST_TOP/logs/ora/10.1.3/install/make_{MMDDHHMM}.log
$INST_TOP/admin/log/ApplyAppsTechStack.log
$INST_TOP/admin/log/ohclone.log
$APPL_TOP/admin/$CONTEXT_NAME/log/installAppl.log
$APPL_TOP/admin/$CONTEXT_NAME/log/ApplyAppltop_{MMDDHHMM}.log
$APPL_TOP/admin/$CONTEXT_NAME/log/{MMDDHHMM}/adconfig.log
$APPL_TOP/admin/$CONTEXT_NAME/log/{MMDDHHMM}/NetServiceHandler.log

Inventory Registration:

{GlobalInventory}/logs/cloneActions{timestamp}.log{GlobalInventory}/logs/oraInstall{timestamp}.log{Global Inventory} /logs/silentInstall{timestamp}.log

Wednesday, December 9, 2009

Killiing the Standard Manger when one or instances running on the same server

Standard Manger Killing:-

set linesize 120
set head off
set pages 0
select 'kill -9 '||' '|| substr(b.os_process_id,0,10) "OS Proc"
from fnd_concurrent_queues a
, fnd_concurrent_processes b
where a.concurrent_queue_id=b.concurrent_queue_id
and a.concurrent_queue_name='STANDARD'
and b.process_status_code='A'
order by b.process_status_code;
Debug or Trace Option Enabled in Profiles

SELECT A.CONCURRENT_PROGRAM_NAME "Program Name",
SUBSTR(A.USER_CONCURRENT_PROGRAM_NAME,1,40) "User Program Name",
SUBSTR(B.USER_NAME,1,15) "Last Updated By",
SUBSTR(B.DESCRIPTION,1,25) DESCRIPTION
FROM APPS.FND_CONCURRENT_PROGRAMS_VL A, APPLSYS.FND_USER B
WHERE A.ENABLE_TRACE='Y'
AND A.LAST_UPDATED_BY=B.USER_ID;

Run this script to see if any Debug or Trace profile options have been set to Y, meaning that they are enabled. Some profile options may be required to be set to Y, but others should be N.

select distinct
a.application_short_name app_short,
user_profile_option_name optname,
decode(level_id,
10001,'SITE',
10002,'APP : '||a2.application_short_name,
10003,'RESP: '||r.responsibility_key,
10004,'USER: '||u.user_name,
'Unknown') d_level,
profile_option_value optval,
v.last_update_date updated
from fnd_profile_options_vl o,
fnd_profile_option_values v,
fnd_application a,
fnd_application a2,
fnd_responsibility r,
fnd_user u
where (
o.user_profile_option_name like '%Debug%' or
o.user_profile_option_name like '%DEBUG%' or
o.user_profile_option_name like '%Trace%' or
o.user_profile_option_name like '%TRACE%'
)
and a.application_id = v.application_id
and o.application_id = v.application_id
and o.profile_option_id = v.profile_option_id
-- Find the associate level for profile
and r.application_id (+) = v.level_value_application_id
and r.responsibility_id (+) = v.level_value
and a2.application_id (+) = v.level_value
and u.user_id (+) = v.level_value
and profile_option_value = 'Y'
order by 2,1,3,4;

http://oracle-apps-dba.blogspot.com/2007/07/apps-user-connection-details.html

And here is Modified version that shows and requests as well others session details.
Remark:
it use input parameter to reduce result on only named apps user
2) It should be run as apps user or use "set current_schema" part in front.
set show off
SET VER OFF
set head on;
set timing on;


undefine apps_user;
accept apps_user char prompt 'Input starting letters of APPS username (Enter for all...): ';

set linesize 300;
set pagesize 200;

col sid_serial for a13;
col user_name for A10;
col module for a22;
col Responsibility for a29;
col function for a30;
col F_Type for a10;
col ap_pid for a6;
col db_pid for a6;

break on USER_NAME on db_pid on ap_pid on sid_serial

select * from (
select
usr.user_name user_name
,v.spid db_pid
,ses.process ap_pid
,ses.sid||','||ses.serial# sid_serial
,ses.module
,rsp.responsibility_name Responsibility
,fuc.function_name Function
,i.function_type F_Type
,to_char(i.last_connect,'dd.mm hh24:mi') F_Start
from
apps.icx_sessions i
,apps.fnd_logins l
,apps.fnd_appl_sessions a
,apps.fnd_user usr
,apps.fnd_responsibility_tl rsp
,apps.fnd_form_functions fuc
,gv$process v
,gv$session ses
where i.disabled_flag = 'N'
and i.login_id = l.login_id
and l.end_time is null
and i.user_id = usr.user_id
and l.login_id = a.login_id
and a.audsid = ses.audsid
and l.pid = v.pid
and l.serial# = v.serial#
and i.responsibility_application_id = rsp.application_id(+)
and i.responsibility_id = rsp.responsibility_id(+)
and i.function_id = fuc.function_id(+)
and i.responsibility_id not in (select t1.responsibility_id
from apps.fnd_login_responsibilities t1
where t1.login_id = l.login_id
)
and usr.user_name like '&apps_user%'
union
select
usr.user_name
,v.spid
,ses.process
,ses.sid||','||ses.serial# sid_serial
,ses.module
,rsp.responsibility_name
,null
,null
,null form_start_time
from
apps.fnd_logins l
,apps.fnd_login_responsibilities r
,apps.fnd_user usr
,apps.fnd_responsibility_tl rsp
,gv$process v
,gv$session ses
where l.end_time is null
and l.user_id = usr.user_id
and l.pid = v.pid
and l.serial# = v.serial#
and v.addr = ses.paddr
and l.login_id = r.login_id(+)
and r.end_time is null
and r.responsibility_id = rsp.responsibility_id(+)
and r.resp_appl_id = rsp.application_id(+)
and r.audsid = ses.audsid
and usr.user_name like '&apps_user%'
union
select
usr.user_name
,v.spid
,ses.process
,ses.sid||','||ses.serial# sid_serial
,ses.module
,null
,frm.user_form_name
,ff.type
,to_char(f.start_time,'dd.mm hh24:mi')
from
apps.fnd_logins l
,apps.fnd_login_resp_forms f
,apps.fnd_user usr
,apps.fnd_form_tl frm
,apps.fnd_form_functions ff
,gv$process v
,gv$session ses
where l.end_time is null
and l.user_id = usr.user_id
and l.pid = v.pid
and l.serial# = v.serial#
and v.addr = ses.paddr
and l.login_id = f.login_id(+)
and f.end_time is null
and f.form_id = frm.form_id(+)
and f.form_appl_id = frm.application_id(+)
and f.audsid = ses.audsid
and ff.form_id = frm.form_id
and usr.user_name like '&apps_user%'
union
select
fu.user_name
,cr.oracle_process_id
,cr.OS_PROCESS_ID
,vs.SID || ',' || vs.serial# sid_serial
,(SELECT cp.concurrent_program_name
FROM APPS.fnd_concurrent_programs cp
WHERE cp.application_id = cr.program_application_id
AND cp.concurrent_program_id = cr.concurrent_program_id
)
,(select responsibility_name
from apps.fnd_responsibility_vl
where responsibility_id = cr.responsibility_id
and application_id = cr.responsibility_application_id
)
,(select execution_file_name
from apps.fnd_executables fe, apps.fnd_concurrent_programs fcp
where fcp.concurrent_program_id = cr.concurrent_program_id
and fcp.application_id = cr.program_application_id
and fe.executable_id = fcp.executable_id
and fe.application_id = fcp.executable_application_id
)
,'REQUEST'
,TO_CHAR(NVL(cr.actual_start_date, cr.requested_start_date), 'DD.MM HH24:MI') start_time
FROM
APPS.fnd_concurrent_requests cr,
v$process vp,
v$session vs,
apps.fnd_user fu
WHERE
cr.phase_code <> 'I'
AND (cr.phase_code < 'C' OR cr.phase_code > 'C')
/*
(cr.phase_code < 'I' OR cr.phase_code > 'I')
AND (cr.phase_code < 'C' OR cr.phase_code > 'C')
*/
AND cr.status_code NOT IN ('U', 'X', 'D', 'E', 'I', 'C')
AND cr.oracle_process_id = vp.spid (+)
AND cr.oracle_session_id = vs.audsid (+)
AND fu.user_id = cr.requested_by
AND vs.sid is not null
and fu.user_name like '&apps_user%'
)
order by user_name, db_pid, ap_pid, sid_serial
;

Saturday, October 17, 2009

Using Big IP hardware load balancers with 11i and R12

All our Production instances are load balanced on web tier. We have multiple app tiers for each instance on which Apache and forms is running. The user point of entry is the load balancer URL which further redirects the traffic to the individual app servers. Oracle uses BigIP load balancer on their internal Global Single Instance also. Here are some very good metalink notes which give you a good overview:


380489.1 Using Load-Balancers with Oracle E-Business Suite Release 12 (Relevant for 11i too)
217368.1 Advanced Configurations and Topologies for Enterprise Deployments of E-Biz Suite 11i
601694.1 How To Check Session Persistence On a BigIP F5 Load Balancer
456906.1 11i/R12 How to Debug "Transaction Context Is Lost"
387306.1 Random error Your login session has expired when using Load Balancing

When a hardware load balancer is used, the context file variables which need to be changed are:

s_webentryurlprotocol http or https
s_webentryhost load balancer hostname
s_webentrydomain load balancer domain name
s_active_webport load balancer port
s_login_page load balancer url
s_external_url load balancer url

Load balancer settings:

persistence timeout = 1 day
persistence type = cookie based persistence

Sunday, October 4, 2009

FND_STATS vs DBMS_STATS

FND_STATS vs DBMS_STATS

I have been asked this questions many times. Shoud we use fnd_stats or should we use dbms_stats in 11i (or release 12). Most of the Apps DBAs you will face will say use fnd_stats. In fact Oracle also recommends to use fnd_stats in 11i E-Business Environments. But do you know what are the basic difference or you can say advantages or using FND_STATS over DBMS_STATS.
Here I have tried to compare the two…