Tuesday, June 21, 2016


Configure UNIX server for oracle apps workflow mailer.


Edit the /etc/mail/sendmal.mc file
Look for this bellow line in this file
DAEMON_OPTIONS (`Port=smtp,Addr=127.0.0.1, Name=MTA')dn

sendmail configuration for workflow mail, setup test box
Add 1 line with SMTP port Number and Server IP to this above line
DAEMON_OPTIONS (`Port=25,Addr=192.168.1.61, Name=MTA')dnl
Here 25 is SMTP Port Number, 192.168.1.61 is Server IP
After adding his like file look like this
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
DAEMON_OPTIONS(`Port=25,Addr=192.168.1.61, Name=MTA')dnl


Rebuild /etc/sendmail.cf from the revised /etc/mail/sendmail.mc
$m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
**NOTE: yum install sendmail-cf ( if error encountered )

yum install dovecot* (this is for imap)
/etc/init.d/dovecot restart
telnet localhost 143
a login appuser apppassword
c list "" *
create folder PROCESS and DISCARD under ~/mail


regards
 

Thursday, January 7, 2016

RMAN backup scripts

RMAN cold backup
================
run{
allocate channel d1 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d2 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d3 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d4 type disk FORMAT   '/u01/xx/xxxxx//%d_db_%u_%s_%p' MAXPIECESIZE 10G;
shutdown immediate;
startup mount;
backup tag FYR_database_cold as compressed backupset database ;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
allocate channel ar1 type disk format '/u01/xxxxx/rman_cn_%T_%U.rman';
sql "alter database backup controlfile to ''/u01/xxxxx/rman_control.rman'' reuse";
release channel ar1 ;
alter database open;
}


RMAN Hot Backup
===============
run{
allocate channel d1 type disk FORMAT   '/u01/xxxxxx/%d_db_%u_%s_%p' MAXPIECESIZE 10G;
allocate channel d2 type disk FORMAT   '/u01/xxxxxx/%d_db_%u_%s_%p' MAXPIECESIZE 10G;
backup tag whole_database_cold as compressed backupset database ;
release channel d1;
release channel d2;
release channel d3;
release channel d4;
allocate channel ar1 type disk format '/u01/xxxx/rman_arc_%T_%U.rman';
BACKUP ARCHIVELOG from time 'sysdate - 2' ;
sql "alter database backup controlfile to ''/u01/xxxx/rman_control.rman'' reuse";
release channel ar1 ;
}

RESTORE (Duplicate)
===================
rman auxiliary /
RUN
{
ALLOCATE AUXILIARY CHANNEL c1 xxxICE TYPE disk ;
ALLOCATE AUXILIARY CHANNEL c2 xxxICE TYPE disk ;
ALLOCATE AUXILIARY CHANNEL c3 xxxICE TYPE disk ;
SET NEWNAME FOR DATABASE TO '/u01/xxx/oracle/data/%b';
duplicate database PROD to 'xxx' BACKUP LOCATION '/xxxxx/DB_Restore_xxx'
duplicate database PROD to 'xxx' BACKUP LOCATION '/xxxxx/DB_Restore_xxx'
LOGFILE GROUP 1 ('/u01/xxx/oracle/data/redo01.rdo') SIZE 1G REUSE, GROUP 2 ('/u01/xxx/oracle/data/redo02.rdo') SIZE 1G REUSE, GROUP 3 ('/u01/xxx/oracle/data/redo03.rdo') SIZE 1G REUSE;}


Use this in init file for RAC database "_no_recovery_through_resetlogs=TRUE"
Scripts for Apps DBA for daily operations.


--------------------------------------------------------
------OPERATION SCRIPTS TO HELP IN DAILY JOBS-----------
--------------------------------------------------------
1. Unlock application user
2. Currently Logged in users
3. Datafile shrink Report
4. Check DR Gap
5. Check DR current activity
6. Find SQL executed by a concurrent request
7. Unlock FNd user
8. Free Tablespace report
9. Get DDL of an object
10. List invalids with statement to compile them
11. Responsibilities assigned to a user.


--------------------------------------------------------
1. Unlock application user

BEGIN
FND_USER_PKG.EnableUser('A.STIGTER');
END;
/
--------------------------------------------------------
2. Currently Logged in users
SELECT
  fu.user_name User_Name,
  fu.email_address emailid,
  fu.description,
  TO_CHAR(IC.FIRST_CONNECT,'dd-Mon-rrrr HH24:mi:ss')"First Accessed",
  TO_CHAR(IC.LAST_CONNECT,'dd-Mon-rrrr HH24:mi:ss')"Last Accessed",
  ic.nls_territory,
  FVL.RESPONSIBILITY_NAME "RESPONSIBILITY NAME",
  fr.RESPONSIBILITY_KEY "Responsibility Key",
  ic.function_type,
  ic.time_out,
  fu.user_id,
  fu.employee_id,
  ic.responsibility_application_id,
  ic.responsibility_id,
  ic.org_id,
  ic.counter,
  fr.menu_id,
  ic.disabled_flag
FROM
  apps.fnd_user fu,
  apps.fnd_responsibility fr,
  apps.icx_sessions ic,
  apps.fnd_responsibility_VL FVL
WHERE
fu.user_id          = ic.user_id
AND FR.RESPONSIBILITY_KEY =FVL.RESPONSIBILITY_KEY
and fVl.responsibility_key != 'IRC_EXT_CANDIDATE'
AND fr.responsibility_id  = ic.responsibility_id
AND ic.disabled_flag      ='N'
AND ic.responsibility_id IS NOT NULL
AND (ic.last_connect + DECODE(apps.FND_PROFILE.VALUE('ICX_SESSION_TIMEOUT'), NULL,limit_time, 0,limit_time,apps.FND_PROFILE.VALUE('ICX_SESSION_TIMEOUT')/60)/24) > sysdate
and counter < ic.limit_connects
ORDER BY "Last Accessed" DESC;
--------------------------------------------------------
3. Datafile shrink Report

select /*+rule*/ 'alter database datafile '''||file_name||''' resize '||ceil( (nvl(hwm,1)*8192)/1024/1024)||'m autoextend on maxsize '||ceil( blocks*8192/1024/1024)||'m;' stat,
ceil( (nvl(hwm,1)*8192)/1024/1024 ) smallest,
ceil( blocks*8192/1024/1024) currsize,
ceil( blocks*8192/1024/1024) -
ceil( (nvl(hwm,1)*8192)/1024/1024 ) savings
from
   dba_data_files a,
   (select file_id, max(block_id+blocks-1) hwm
   from
      dba_extents
   group by file_id ) b
where a.file_id = b.file_id(+)
order by 4;
***NOTE: Autoexend on has to be enabled with relevant maxsize

--------------------------------------------------------
4. Check DR Gap

select a.*, b.*, (a."Archived" - b."Applied") "GAP"
from
(select thread#, max(sequence#) "Archived" from v$archived_log where archived='YES' group by thread# ) a,
(select thread#, max(sequence#) "Applied" from v$archived_log where applied='YES' group by thread# ) b where a.thread# = b.thread#
--------------------------------------------------------
5. Check DR current activity

SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY
--------------------------------------------------------
6. Find SQL executed by a concurrent request

SELECT
  B.sid,
  C.sql_text ,
  C.module
FROM APPS.fnd_concurrent_requests A ,
  gV$SESSION B ,
  gV$SQLAREA C
WHERE A.oracle_session_id = B.audsid
AND B.sql_hash_value      = C.hash_value
AND A.request_id          = 1451703
--------------------------------------------------------
7. Unlock FNd user

BEGIN
FND_USER_PKG.EnableUser('&username');
END;
/
--------------------------------------------------------
8. Free Tablespace report
select
  a.tablespace_name,
  round(sum(a.bytes/1024/1024),2) TOTAL_MB,  
  round(sum
  (
    ( case
    when autoextensible = 'YES' then
    (a.maxbytes - a.user_bytes) + nvl(b.bytes,0)
    when autoextensible = 'NO' then
    nvl(b.bytes,0)
    end
    )/1024/1024
  ),2) FREE_MB,
  (100 - round((round(sum(( case when autoextensible = 'YES' then (a.maxbytes - a.user_bytes) + nvl(b.bytes,0) when autoextensible = 'NO' then nvl(b.bytes,0) end)/1024/1024),2) *100) / round(sum(a.bytes/1024/1024),2))) "Percentage Used"
from
  dba_data_files a,
  (
    select file_id,
      sum(bytes) bytes
    from dba_free_space
    group by file_id
  ) b
where
  a.file_id = b.file_id(+)
group by a.tablespace_name
order by Total_mb desc
--------------------------------------------------------
9. Get DDL of an object

--select dbms_metadata.get_ddl( object_type=>'&OBJECT_TYPE',name=>'&OBJECT_NAME',schema=>'&SCHEMA_NAME') FROM DUAL ;

select dbms_metadata.get_ddl(object_type, object_name, owner)
from
(
    --Convert DBA_OBJECTS.OBJECT_TYPE to DBMS_METADATA object type:
    select
        owner,
        object_name,
        decode(object_type,
            'PACKAGE',      'PACKAGE_SPEC',
            'PACKAGE BODY', 'PACKAGE_BODY',
            'TYPE BODY', 'TYPE_BODY',
            object_type
        ) object_type
    from dba_objects
    where object_name = :object_name
        --These objects are included with other object types.
        and object_type not in ('INDEX PARTITION','LOB','LOB PARTITION','TABLE PARTITION')
        --Ignore system-generated types that support collection processing.
        and not (object_type like 'TYPE' and object_name like 'SYS_PLSQL_%')
)
order by owner, object_type, object_name;
--------------------------------------------------------
10. List invalids with statement to compile them

set linesize 200
set pagesize 200
col object_name for a40
col owner for a6
set echo off
set feedback off
set verify off
set heading off
SELECT '----------------' from dual;
SELECT 'List of Invalids' from dual;
SELECT '----------------' from dual;
set heading on
select owner, objecT_name, objecT_type, status from dba_objects where status!='VALID';
set heading off
SELECT '---------------------------------' from dual;
SELECT 'Execute Below to compile invalids' from dual;
SELECT '---------------------------------' from dual;
select 'alter ', object_type, owner, '.' ,object_name, 'compile ;' from dba_objects where status!='VALID' and object_type != 'PACKAGE BODY'
union ALL
select 'alter ', decode (OBJECT_TYPE, 'PACKAGE BODY', 'PACKAGE'), owner, '.' ,object_name, 'compile BODY ;' from dba_objects where status!='VALID' and object_type = 'PACKAGE BODY' ;
--------------------------------------------------------
11. Responsibilities assigned to a user.

Select b.user_name, c.responsibility_name, a.START_DATE, a.END_DATE
from fnd_user_resp_groups_direct a, fnd_user b, fnd_responsibility_tl c
where a.user_id = b.user_id
and a.responsibility_id = c.responsibility_id
and b.user_name='&username'



Tuesday, November 24, 2015

How to remove references of used features in oracle database
Oracle License register remove
remove used feature flag from oracle database

Shut down application
backup and restart database

@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql

Sunday, November 15, 2015

High Invalids in e-business suite ( oracle apps 12.2 )

manually granting privileges to object causes huge invalids in database, right way to grant privs to another user is to use "exec AD_ZD.GRANT_PRIVS"

Regards
Manoj

Sunday, November 1, 2015

How to find version for components in 12.2.x e-business suite

perl $FND_TOP/patch/115/bin/TXKScript.pl -script=$FND_TOP/patch/115/bin/txkInventory.pl -txktop=$APPLTMP -contextfile=$CONTEXT_FILE -appspass=apps -outfile=$APPLTMP/Report_inventory.html

NOTE: make sure there is no 'E' in $APPLTMP

Above will give oracle home version with applied patches, this can be run against Database well. 

you can query version keyword in context file as well just to get versions

grep -i version $CONTEXT_FILE

Regards
Manoj

Monday, October 26, 2015

Test your Storage I/O speed latency using oracle database

use below query to test you database server I/O

SET SERVEROUTPUT ON 
DECLARE 
lat INTEGER; 
iops INTEGER; 
mbps INTEGER; 
BEGIN 
-- DBMS_RESOURCE_MANAGER.CALIBRATE_IO (<NUM_PHYSICAL_DISKS>, <MAX_LATENCY>, iops, mbps, lat); 
DBMS_RESOURCE_MANAGER.CALIBRATE_IO (8, 10, iops, mbps, lat); 
DBMS_OUTPUT.PUT_LINE ('max_iops = ' || iops); 
DBMS_OUTPUT.PUT_LINE ('latency = ' || lat); 
dbms_output.put_line('max_mbps = ' || mbps); 
end; 
WebLogic Password Recovery


There are many blogs out there providing various methods to recover WebLogic password below method is the easiest of the all.

First we need to know DOMAIN_HOME directory. My OMS is located in “/u02/Middleware/oms”. You can find yours if you read “/etc/oragchomelist”. If the full path of OMS is “/u02/Middleware/oms”, my middleware home is “/u02/Middleware/”. Under my middleware home, I need to go GCDomains folder


2
oracle@db-cloud /$ cd /u02/Middleware
oracle@db-cloud Middleware$ cd gc_inst/user_projects/domains/GCDomain



First let’s get the encrypted information from boot.properties file:

oracle@db-cloud GCDomain$ cat servers/EMGC_ADMINSERVER/security/boot.properties
 
# Generated by Configuration Wizard on Wed Jun 04 10:22:47 EEST 2014
username={AES}nPuZvKIMjH4Ot2ZiiaSVT/RKbyBA6QITJE6ox56dHvk=
password={AES}krCf4h1du93tJOQcUg0QSoKamuNYYuGcAao1tFvHxzc=


The encrypted information starts with {AES} and ends with equal (=) sign. To decrypt the username and password, we will create a simple java application:


3
4
5
6
7
8
9
10
oracle@db-cloud GCDomain$ cat recoverpassword.java
public class recoverpassword {
public static void main(String[] args)
{
  System.out.println(
  new weblogic.security.internal.encryption.ClearOrEncryptedService(
  weblogic.security.internal.SerializedSystemIni.getEncryptionService(args[0]
   )).decrypt(args[1]));
  }
}
Save it as “recoverpassword.java”. To be able to compile (and run) it, we need to set environment variables (we’re still in GCDomain folder). We’ll give the encrypted part as the last parameter:

1
2
3
4
5
6
oracle@db-cloud GCDomain$ . bin/setDomainEnv.sh
oracle@db-cloud GCDomain$ javac recoverpassword.java
oracle@db-cloud GCDomain$ java -cp $CLASSPATH:. recoverpassword \
$DOMAIN_HOME {AES}nPuZvKIMjH4Ot2ZiiaSVT/RKbyBA6QITJE6ox56dHvk=
oracle@db-cloud GCDomain$ java -cp $CLASSPATH:. recoverpassword \
$DOMAIN_HOME {AES}krCf4h1du93tJOQcUg0QSoKamuNYYuGcAao1tFvHxzc=
When we run the last two commands, we should see the weblogic administrator username and password in plain text. By the way, even if you use the same password with me, you may see different encrypted text because when encrypting and decrypting, weblogic uses the cypher key stored in “security/SerializedSystemIni.dat” file. So as long as the cypher key is different, you get different encrypted text for even same input.


Thanks to :http://www.gokhanatil.com/2015/03/how-to-recover-weblogic-administration-password-of-enterprise-manager.html


Oracle E-business suite logs clean up

 Oracle E-business suite logs clean up #!/bin/bash cd $EBS_DOMAIN_HOME find $EBS_DOMAIN_HOME -type f -path "*/logs/*.log?*" -mtime...