Total Pageviews

Sunday, 15 May 2016

Script – Check RMAN Backup Status

Script – Check RMAN Backup Status
===============================
Scripts to check backup status and timings of database backups –

This script will be run in the database, not the catalog database.

Login as sysdba –

This script will report on all backups – full, incremental and archivelog backups –
=============================================================

col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
order by session_key;


This script will report all on full and incremental backups, not archivelog backups –
==============================================================
col STATUS format a9
col hrs format 999.99
select
SESSION_KEY, INPUT_TYPE, STATUS,
to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,
to_char(END_TIME,'mm/dd/yy hh24:mi')   end_time,
elapsed_seconds/3600                   hrs
from V$RMAN_BACKUP_JOB_DETAILS
where input_type='DB INCR'
order by session_key;

Friday, 6 May 2016

Compile Jsp’s in R12 & 11i

Compile Jsp’s in R12 & 11i
=====================

$cd $ADMIN_SCRIPTS_HOME

$adopmnctl.sh stopall — to shutdown opmn managed services viz., opmn, forms, oacore & oc4j

 $ cd $COMMON_TOP/_pages

$ mv _pages _pages_old

$mkdir _pages

 $ cd $FND_TOP/patch/115/bin or export PATH=$FND_TOP/patch/115/bin:$PATH

Compile all jsps.
$perl ojspCompile.pl –compile –flush -p 2 (or) ojspCompile.pl --compile --fast --quiet
(-p represents parallel threads, if you have enough horse power on your server, you can increase it to 8 or 10)

$cd $ADMIN_SCRIPTS_HOME

Another Option
==============
STEP1.

Login as applmgr user and source the environment by running the script:


/oracle/apps/apps_st/appl/APPS[SID]_[host].env

STEP2:  Run the commands

In Linux/Unix

cd $FND_TOP/patch/115/bin
perl ojspCompile.pl --compile --flush -p 2

In Windows

cd %FND_TOP%\patch\115\bin
perl -x ojspCompile.pl –compile –flush

STEP3:

Restart the Apache services or Middleware services.
How to compile individual JSP manually in R12:

STEP1:

cd $COMMON_TOP/_pages

STEP2:

Delete the class files (abcdef.class) for the JSP that you want to compile manually.

Eg. JSP File abcdef_12.jsp
Class File: abcdef_12.class ------------- Delete this file.

STEP3:

Navigate to the OA_HTML (Location for all the Jsp pages). if the JSP pages do not exist, copy the JSP to the location & run the below command.

$FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'abcdef_12.jsp' --flush

STEP4:

Restart the Apache services or Middle-ware services.

STEP5:

Check whether the respective class files have been created under

cd $COMMON_TOP/_pages

To Compile JSP’s at runtime in Oracle Apps R12
===============================================
To compile the jsp as soon as you access jsp page :

1. Change s_jsp_main_mode in R12 context file (XML file)

  <jsp_debug_parameters oa_var=”s_jsp_main_mode”>justrun</jsp_debug_parameters>

change it to

  <jsp_debug_parameters oa_var=”s_jsp_main_mode”>recompile</jsp_debug_parameters>

2.Run Autoconfig (adautocfg.sh)

Autoconfig will update file
$INST_TOP/ora/10.1.3/j2ee/oacore/application-deployments/oacore/html/orion-web.xml

        <param-name>main_mode</param-name>
         <param-value>justrun</param-value>

.

How to compile JSP manually

perl ojspCompile.pl –compile –flush  (Unix)
or
perl ojspCompile.pl –compile –flush -p 2 (Unix where -p means parallel execution)

perl -x ojspCompile.pl –compile –flush (Windows)

ojspCompile.pl is under $FND_TOP/patch/115/bin/

Note* JSP’s are compiled automatically after patching (whenever patch updates one or more jsp it calls ojspCompile.pl to compile JSP)

.

JSP Compilation logs

In 11i, all jsp compilation errors are logged in $IAS_ORACLE_HOME/ Apache/ Jserv/ logs/ mod_jserv.log

In R12, all jsp compilation errors are logged in $LOG_HOME/ ora/ 10.1.3/ j2ee/ oacore/ oacore_default_group_1/ application.log

458338.1  How to Enable Automatic Compilation of JSP pages in R12 Environment

433386.1  JSP Pages Hanging in R12 After Removing Cached Class Files in _pages

783094.1  Compile jsp files at Application R12 at Windows

Node ID does Not Exist for the Current Application Server ID Errors

Node ID  does not exist for the current application server id.
 The URL on which the above error occurs is as follows:

http://myhost.domain:port/dev60cgi/f60cgi

This error also occurs at the time of starting / stopping Apache.

adapcctl.sh start

adapcctl.sh stop

$INST_TOP/admin/install/adgendbc.sh

SOLUTION

1. Do a select on the server_id in the fnd_nodes table.  Here is an example of what it could look like:
server_id=EA99227ED75CFE4EE030149077C4515496138833635529486962342698410274
2. Do a search on APPL_SERVER_ID in the .dbc file.  It could show something like:
APPL_SERVER_ID=EA99220924EF823FE030149077C450C096138833635529486962342698410274
Please manually comment out the APPL_SERVER_ID in the .dbc file.
3. Then re-run adgendbc.sh and it will  seed the node and get a good  application id.
NOTE: If the server_id is missing from the FND_NODES table, ie. if the above SQL does not return anything
To get the FND_NODES table populated with the correct server ID, one may have to use:
Note 260887.1 ->Steps to Clean Nonexistent Nodes or IP Addresses from   FND_NODES

Please refer the Note 274476.1 and Note 363609.1 to have a detailed view to change the IP Address of the Database Server.
5) As the change is made at the OS (Operating System) level.Please ensure that the IP address gets reflected in the DNS server and also in the local host file.

REFERENCES



Correct Method of Changing the IP Address in 11i & R12 (Doc ID 751328.1)
pool fnd_nodes 
set pagesize 50 
col node_name format a15 
col server_id format a8 
col server_address format a15 
col platform_code format a4 
col webhost format a12 
col domain format a20 
col virtual_ip format a12 
set linesize 132 
select node_id, platform_code, support_db D, support_cp C, support_admin A, support_forms F, 
support_web W, node_name, server_id, server_address, domain, webhost, virtual_ip 
from fnd_nodes 
order by node_id;

Thursday, 28 April 2016

Script to Move Datafiles

Move datafile script (unix or windows)




ARCHIVE LOGGING (UNIX):

set linesize 150
column file_name format a60
set pagesize 200
set head off

select file_id, file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database datafile '||file_id||' offline;'
from dba_data_files
where file_name like '%disk8%'
/
select '!mv '||file_name||' '||file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database rename file "'||file_name||"' to "'||file_name||"';'
from dba_data_files
where file_name like '%disk8%'
/
select 'recover datafile '||file_id||';'
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database datafile '||file_id||' online;'
from dba_data_files
where file_name like '%disk8%'
/
select 'select status from dba_data_files;' from dual;

NO ARCHIVE LOGGING (UNIX):

set linesize 150
column file_name format a60
set pagesize 200
set head off

select 'shutdown immediate' from dual;
select file_id, file_name
from dba_data_files
where file_name like '%disk8%'
/
select '!mv '||file_name||' '||file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'startup mount' from dual;
select 'alter database rename file "'||file_name||"' to "'||file_name||"';'
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database open;' from dual;
select 'select status from dba_data_files;' from dual;

ARCHIVE LOGGING (WINDOWS):

set linesize 150
column file_name format a60
set pagesize 200
set head off

select file_id, file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database datafile '||file_id||' offline;'
from dba_data_files
where file_name like '%disk8%'
/
select 'host move '||file_name||' '||file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database rename file "'||file_name||"' to "'||file_name||"';'
from dba_data_files
where file_name like '%disk8%'
/
select 'recover datafile '||file_id||';'
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database datafile '||file_id||' online;'
from dba_data_files
where file_name like '%disk8%'
/
select 'select status from dba_data_files;' from dual;

NO ARCHIVE LOGGING (WINDOWS):

set linesize 150
column file_name format a60
set pagesize 200
set head off

select 'shutdown immediate' from dual;
select file_id, file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'host move '||file_name||' '||file_name
from dba_data_files
where file_name like '%disk8%'
/
select 'startup mount' from dual;
select 'alter database rename file "'||file_name||"' to "'||file_name||"';'
from dba_data_files
where file_name like '%disk8%'
/
select 'alter database open;' from dual;
select 'select status from dba_data_files;' from dual;


Another Script
============

select 'alter database rename file '''|| file_name ||''' to '''/u0/' || 
substr(file_name, 5) ||''';' from dba_data_files;

to:

select 'alter database rename file '''|| file_name ||''' to '||'''/u0/' || 
substr(file_name, 5) ||''';' from dba_data_files;


Another
=======
SQL>spool rename_datafile.sql
set line 140
set pagesize 2000
set heading off
select ‘alter database rename file ‘ ||””|| file_name || ”” || ‘ to ‘|| ””||
‘/oracle/IMPRD/data’ || substr(file_name, instr(file_name, ‘/’, -1)) ||”” || ‘;’
from dba_data_files
/
SQL>spool off
Spool to a file and then:
1- Shutdown immediate;
2- OS copy the files to the new location
3- Startup Mount;
4- Execute the spooled file ( SQL>@rename_datafile.sql )
5- Alter database open;

Another
=======
select 'alter database rename file '||chr(39)||name||chr(39)||' to
'||chr(39)||'F'||substr(name,2)||chr(39)||';'
from v$datafile;


Wednesday, 27 April 2016

APPS/SYSADMIN password in Oracle Apps R12

Step to Find APPS PASSWORD :

Step #1


sqlplus> sqlplus system/system_password
sqlplus / as sysdba

Step#2:  Create Function to decrypt the encrypted password

SQL> create FUNCTION apps.decrypt_pin_func(in_chr_key IN VARCHAR2,in_chr_encrypted_pin IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
/
Function created.

Step#3: Query for password

set linesize 200 long 300

SQL> select ENCRYPTED_FOUNDATION_PASSWORD from apps.fnd_user where USER_NAME='GUEST';

ENCRYPTED_FOUNDATION_PASSWORD
--------------------------------------------------------------------------------
ZG379C5C883FF56235BE975D075A6FD2E7A749279B7BFCE331530B443E86F41A1966E3E4B1864519DB88BC07D58666AD837B

Step#4:  Get the Apps password using encrypted guest password

SQL> SELECT apps.decrypt_pin_func('GUEST/ORACLE','ZG379C5C883FF56235BE975D075A6FD2E7A749279B7BFCE331530B443E86F41A1966E3E4B1864519DB88BC07D58666AD837B') from dual;

APPS.DECRYPT_PIN_FUNC('GUEST/ORACLE','ZG379C5C883FF56235BE975D075A6FD2E7A749279B
--------------------------------------------------------------------------------
APPS123

Step#5: Test apps password

SQL> conn apps/APPS123;
Connected.

Step to Find SYSADMIN PASSWORD :

Step# 1:

SQL> conn apps/APPS123;
Connected.

Step#2:

SQL> CREATE OR REPLACE PACKAGE get_pwd AS
FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
RETURN VARCHAR2;
END get_pwd;
Package created.

Step# 3:

SQL>
 CREATE OR REPLACE PACKAGE BODY get_pwd  AS
 FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
 RETURN VARCHAR2
 AS  LANGUAGE JAVA NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String'; END get_pwd;
 /
Package body created.

Step# 4:

SQL> SELECT usr.user_name,
       get_pwd.decrypt
  2    3            ((SELECT (SELECT get_pwd.decrypt
  4                                (fnd_web_sec.get_guest_username_pwd,
  5                                 usertable.encrypted_foundation_password
  6                                )
  7                        FROM DUAL) AS apps_password
  8                FROM fnd_user usertable
  9               WHERE usertable.user_name =
 10                        (SELECT SUBSTR
 11                                    (fnd_web_sec.get_guest_username_pwd,
 12                                     1,
 13                                       INSTR
 14                                            (fnd_web_sec.get_guest_username_p
 15                                             '/'
 16                                            )
 17                                     - 1
 18                                    )
 19                           FROM DUAL)),
 20             usr.encrypted_user_password) PASSWORD
  FROM fnd_user usr
 WHERE usr.user_name = '&USER_NAME';
Enter value for user_name: SYSADMIN
old  23:  WHERE usr.user_name = '&USER_NAME'
new  23:  WHERE usr.user_name = 'SYSADMIN'


USER_NAME                                     PASSWORD
------------------------                        -----------------
SYSADMIN                                        SYSADMIN123

Step#5 :  Bellow sql will help you to validate SYSADMIN Password

SQL> select fnd_web_sec.validate_login('SYSADMIN','SYSADMIN123) from dual;

FND_WEB_SEC.VALIDATE_LOGIN('SYSADMIN','SYSADMIN123')
--------------------------------------------------------------------------------
Y


Ref:
http://dbafix.blogspot.com/2014/04/find-out-appssysadmin-password-in.html

Monday, 25 April 2016

FRM-92050 Failed to Connect to Server


In our case the below actions fixed the issue.


Please execute following actions:
a. Copy fndfmxit.so from a backup.
b. Place it in $FND_TOP/bin.
c. Instead bounce services 

adapcctl.sh: exiting with status 150



adapcctl.sh: exiting with status 150
On E-Business Suite Release 12 environment, while starting midtier services using adstrtal.sh, below error occurs:

Executing service control script:
/oracle/apps/VIS/inst/apps/<CONTEXT>/admin/scripts/adapcctl.sh start
Timeout specified in context file: 100 second(s)
Script returned:
****************************************************
You are running adapcctl.sh version 120.7.12010000.2
Starting OPMN managed Oracle HTTP Server (OHS) instance ...
adapcctl.sh: exiting with status 150
adapcctl.sh: check the logfile /oracle/apps/VIS/inst/apps/<CONTEXT>/logs/appl/admin/log/adapcctl.txt for more information ...
.end std out.
.end err out.
****************************************************
Same error for adoacorectl.sh, adoafmctl.sh, adformsctl.sh.

CAUSE:
There is a states file called .opmndat at /oracle/apps/VIS/inst/apps/<CONTEXT>/ora/10.1.3/opmn/logs/states which gets created when services are started.
Whenever services are started this file gets created or updated.
Unfortunately for some reason this file is not updated when services are started.

SOLUTION:
1. Shutdown all Middle tier services and ensure no defunct processes exist running the following from the operating system:

# ps -ef | grep <applmgr>

If one finds any, kill these processes.
2. Navigate to $INST_TOP/ora/10.1.3/opmn/logs/states directory. It contains hidden file .opmndat:

# ls -lrt .opmndat
3. Delete this file .opmndat after making a backup of it:

# rm .opmndat
4. Restart the services.

5. Re-test the issue.
- See more at: http://oracledbajourney.blogspot.com/2013/01/adapcctlsh-exiting-with-status-150.html#sthash.jGeENkex.dpuf

Ref:
http://oracledbajourney.blogspot.com/2013/01/adapcctlsh-exiting-with-status-150.html