HOW TO FIND SYSADMIN PASSWORD – R12

Simple way to find out SYSADMIN password in R12, Please review below for the same

1) Connect to APPS USER
2) Create PACKAGE and PACKEGE BODY.
3) Query for PASSWORD by providing USERNAME

STEP 1:

$SQL> conn apps/welcome
Connected.

STEP 2:

CREATE OR REPLACE PACKAGE XXX_GET_PWD AS
FUNCTION decrypt (KEY IN VARCHAR2, VALUE IN VARCHAR2)
RETURN VARCHAR2;
END XXX_GET_PWD;
/

Package created.

CREATE OR REPLACE PACKAGE BODY XXX_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 XXX_GET_PWD;

Package body created.

STEP 3:

SELECT Usr.User_Name,
Usr.Description,
XXX_GET_PWD.Decrypt (
(SELECT (SELECT XXX_GET_PWD.Decrypt (
Fnd_Web_Sec.Get_Guest_Username_Pwd,
Usertable.Encrypted_Foundation_Password)
FROM DUAL)
AS Apps_Password
FROM applsys.Fnd_User Usertable
WHERE Usertable.User_Name =
(SELECT SUBSTR (
Fnd_Web_Sec.Get_Guest_Username_Pwd,
1,
INSTR (Fnd_Web_Sec.Get_Guest_Username_Pwd,
‘/’)
– 1)
FROM DUAL)),
Usr.Encrypted_User_Password)
Password
FROM applsys.Fnd_User Usr
WHERE Usr.User_Name = ‘&User_Name’;
Enter value for user_name: SYSADMIN
old  21:  WHERE Usr.User_Name = ‘&User_Name’
new  21:  WHERE Usr.User_Name = ‘SYSADMIN’
USER_NAME     DESCRIPTION                   PASSWORD
————-         ——————–                 ——————–
SYSADMIN      System Administrator            sysadmin

TO FIND APPS PASSWORD, Check this…  https://oracledbamasters.wordpress.com/2013/11/11/how-to-find-apps-password-r12/

HOW TO FIND APPS PASSWORD – R12

Simple way to find out apps password in R12, Please review below for the same

1) Connect to SYSTEM or SYS USER
2) Create Function for to decrypt the encrypted password
3) Query for PASSWORD
4) Query for decrypt the password
5) Test the apps user connection

STEP 1:

[oracle@localhost]$sqlplus system/system_password
[oracle@localhost]$sqlplus / as sysdba

STEP 2:

$SQL>create FUNCTION apps.decrypt_get_pwd(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:

$SQL>select ENCRYPTED_FOUNDATION_PASSWORD from apps.fnd_user where USER_NAME=’GUEST’;
ENCRYPTED_FOUNDATION_PASSWORD
——————————————————————————–
ZG342073DB4A6F66E5ABB79D0E8BD64A5D4830ED4BB250407DF1DB9EEE786F895B78FB6F260E0101
85B830B8F49C6ECC2FAF

STEP 4:

$SQL>SELECT apps.decrypt_get_pwd(‘GUEST/ORACLE’,’ZG342073DB4A6F66E5ABB79D0E8BD64A5D4830ED4BB250407DF1DB9EEE786F895B78FB6F260E010185B830B8F49C6ECC2FAF
‘) from dual;
APPS.DECRYPT_PIN_FUNC(‘GUEST/ORACLE’,’ZG342073DB4A6F66E5ABB79D0E8BD64A5D4830ED4B
——————————————————————————–
welcome

STEP 5:

$SQL> conn apps/welcome
Connected.

TO FIND SYSADMIN PASSWORD, Check this … https://oracledbamasters.wordpress.com/2013/11/11/how-to-find-sysadmin-password-r12/

cmclean.sql : Cleaning the Concurrent Manager tables

To cleanup running and pending requests we use cmclean.sql, If we stop concurrent managers using abort options then concurrent requests will be in running state ,Next when we start concurrent manager the processes will not start properly.

CMCLEAN will update below tables:
1) FND_CONCURRENT_QUEUES
2) FND_CONCURRENT_PROCESSES
3) FND_CONCURRENT_REQUESTS
4) FND_CONFLICTS_DOMAIN
5) FND_CONCURRENT_CONFLICT_SETS

GET CMCLEAN SCRIPT FROM ORACLE NOTEID:
Concurrent Processing – cmclean.sql – Non Destructive Script to Clean Concurrent Manager Tables [ID 134007.1]

—- SCRIPT —-
****************

REM
REM FILENAME
REM cmclean.sql
REM DESCRIPTION
REM Clean out the concurrent manager tables
REM NOTES
REM Usage: sqlplus @cmclean
REM
REM
REM $Id: cmclean.sql,v 1.4 2001/04/07 15:55:07 pferguso Exp $
REM
REM
REM +======================================================================+
set verify off;
set head off;
set timing off
set pagesize 1000
column manager format a20 heading ‘Manager short name’
column pid heading ‘Process id’
column pscode format a12 heading ‘Status code’
column ccode format a12 heading ‘Control code’
column request heading ‘Request ID’
column pcode format a6 heading ‘Phase’
column scode format a6 heading ‘Status’
WHENEVER SQLERROR EXIT ROLLBACK;
DOCUMENT
WARNING : Do not run this script without explicit instructions
from Oracle Support
*** Make sure that the managers are shut down ***
*** before running this script ***
*** If the concurrent managers are NOT shut down, ***
*** exit this script now !! ***
#
accept answer prompt ‘If you wish to continue type the word ”dual”: ‘
set feed off
select null from &answer;
set feed on
REM Update process status codes to TERMINATED
prompt
prompt ————————————————————————
prompt — Updating invalid process status codes in FND_CONCURRENT_PROCESSES
set feedback off
set head on
break on manager
SELECT concurrent_queue_name manager,
concurrent_process_id pid,
process_status_code pscode
FROM fnd_concurrent_queues fcq, fnd_concurrent_processes fcp
WHERE process_status_code not in (‘K’, ‘S’)
AND fcq.concurrent_queue_id = fcp.concurrent_queue_id
AND fcq.application_id = fcp.queue_application_id;
set head off
set feedback on
UPDATE fnd_concurrent_processes
SET process_status_code = ‘K’
WHERE process_status_code not in (‘K’, ‘S’);
REM Set all managers to 0 processes
prompt
prompt ————————————————————————
prompt — Updating running processes in FND_CONCURRENT_QUEUES
prompt — Setting running_processes = 0 and max_processes = 0 for all managers
UPDATE fnd_concurrent_queues
SET running_processes = 0, max_processes = 0;
REM Reset control codes
prompt
prompt ————————————————————————
prompt — Updating invalid control_codes in FND_CONCURRENT_QUEUES
set feedback off
set head on
SELECT concurrent_queue_name manager,
control_code ccode
FROM fnd_concurrent_queues
WHERE control_code not in (‘E’, ‘R’, ‘X’)
AND control_code IS NOT NULL;
set feedback on
set head off
UPDATE fnd_concurrent_queues
SET control_code = NULL
WHERE control_code not in (‘E’, ‘R’, ‘X’)
AND control_code IS NOT NULL;
REM Also null out target_node for all managers
UPDATE fnd_concurrent_queues
SET target_node = null;
REM Set all ‘Terminating’ requests to Completed/Error
REM Also set Running requests to completed, since the managers are down
prompt
prompt ————————————————————————
prompt — Updating any Running or Terminating requests to Completed/Error canceled by CMCLEAN
set feedback off
set head on
SELECT request_id request,
phase_code pcode,
status_code scode
FROM fnd_concurrent_requests
WHERE status_code = ‘T’ OR phase_code = ‘R’
ORDER BY request_id;
set feedback on
set head off
UPDATE fnd_concurrent_requests
SET phase_code = ‘C’, status_code = ‘E’
WHERE status_code =’T’ OR phase_code = ‘R’;
REM Set all Runalone flags to ‘N’
REM This has to be done differently for Release 10
prompt
prompt ————————————————————————
prompt — Updating any Runalone flags to ‘N’
prompt
set serveroutput on
set feedback off
declare
c pls_integer := dbms_sql.open_cursor;
upd_rows pls_integer;
vers varchar2(50);
tbl varchar2(50);
col varchar2(50);
statement varchar2(255);
begin
select substr(release_name, 1, 2)
into vers
from fnd_product_groups;
if vers >= 11 then
tbl := ‘fnd_conflicts_domain’;
col := ‘runalone_flag’;
else
tbl := ‘fnd_concurrent_conflict_sets’;
col := ‘run_alone_flag’;
end if;
statement := ‘update ‘ || tbl || ‘ set ‘ || col || ‘=”N” where ‘ || col || ‘ = ”Y”’;
dbms_sql.parse(c, statement, dbms_sql.native);
upd_rows := dbms_sql.execute(c);
dbms_sql.close_cursor(c);
dbms_output.put_line(‘Updated ‘ || upd_rows || ‘ rows of ‘ || col || ‘ in ‘ || tbl || ‘ to ”N”’);
end;
/
prompt
prompt ————————————————————————
prompt Updates complete.
prompt Type commit now to commit these updates, or rollback to cancel.
prompt ————————————————————————
prompt
set feedback on
REM <= Last REM statment —————————————————–
Disclaimer
EXCEPT WHERE EXPRESSLY PROVIDED OTHERWISE, THE INFORMATION, SOFTWARE,
PROVIDED ON AN “AS IS” AND “AS AVAILABLE” BASIS. ORACLE EXPRESSLY DISCLAIMS
ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NON-INFRINGEMENT. ORACLE MAKES NO WARRANTY THAT: (A) THE RESULTS
THAT MAY BE OBTAINED FROM THE USE OF THE SOFTWARE WILL BE ACCURATE OR
RELIABLE; OR (B) THE INFORMATION, OR OTHER MATERIAL OBTAINED WILL MEET YOUR
EXPECTATIONS. ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE DOWNLOADED OR
OTHERWISE OBTAINED IS DONE AT YOUR OWN DISCRETION AND RISK. ORACLE SHALL HAVE
NO RESPONSIBILITY FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT
RESULTS FROM THE DOWNLOAD OF ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE.
ORACLE RESERVES THE RIGHT TO MAKE CHANGES OR UPDATES TO THE SOFTWARE AT ANY
TIME WITHOUT NOTICE.
Limitation of Liability
IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE,
DATA OR USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN
CONTRACT OR TORT, ARISING FROM YOUR ACCESS TO, OR USE OF, THE SOFTWARE.
SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY.
ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.

 

TRACE IN ORACLE DATABASE

Current session trace:

NORMAL TRACE:

alter session set tracefile_identifer=’XXX’;   — trace identifier
alter session set sql_trace = true;

FULL LEVEL TARCE with WAIT and BIND :

alter session set tracefile_identifer=’XXX’;   — trace identifier
alter session set events = ‘10046 trace name context forever, level 12’;

Other running session trace:

NORMAL TRACE:

execute dbms_system.set_sql_trace_in_session ($sid,$serial,true);

FULL LEVEL TARCE with WAIT and BIND :

execute dbms_system.set_ev($sid,$serial,10046,12,’’);

TRACE FILE LOCATION:

<DIAGNOSTIC_DEST>/diag/rdbms/<SID>/trace

TKPROF :
tkprof utility can translate the trace file into a more human readable format

tkprof <tracefile> <outfile> explain=username/password sort ='(prsela,exeela,fchela)’

explain=user/password    Connect to ORACLE and issue EXPLAIN PLAN.
prsela  elapsed time parsing
exeela  elapsed time executing
fchela  elapsed time fetching

RMAN : Perform Block Recovery

We can perform BLOCK RECOVERY with or without RMAN BACKUP, Here is the demonstration of block media recovery with HOT BACKUP and RMAN BACKUP as well.

1)  Create tablespace, user and table in same schema.
2)  Take the backup of datafile.
a) HOT BACKUP.
b) RMAN BACKUP.
3)  Corrupt the data in datafile.
4)  Connect with RMAN and try to use BLOCKRECOVER command.
a) Perform Block Recovery with HOTBACKUP.
b) Perform Block Recovery with RMAN BACKUP.

Here you go…

Create tablespace, user and table in same schema:

$sql> create tablespace TS1 datafile ‘/d01/oradata/ts1.dbf’ size 100m;
$Create user U1 identified by U1 default tablespace TS1;
$sql> grant connect,resource to U1;
$sql> conn U1/U1
$sql> create table TEST_CORRUPT (no number);
$sql> insert into TEST_CORRUPT values(1);
$sql> coomit;
$sql> SELECT segment_name, a.tablespace_name, b.name FROM dba_segments a, v$datafile b WHERE a.header_file=b.file# AND a.segment_name=’TEST_CORRUPT’;
SEGMENT_NAME     TABLESPACE_NAME    NAME
—————                      —————                           ————–
TEST_CORRUPT         TS1                                     /d01/oradata/ts1.dbf

HOTBACKUP of datafile:

$sql> ALTER TABLESPACE TS1 BEGIN BACKUP;
[oracle@localhost]$cp /d01/oradata/ts1.dbf /d01/oradata/ts1_bkp.dbf
$sql> ALTER TABLESPACE TS1 END BACKUP;

RMAN BACKUP of datafile 4:

[oracle@localhost]$rman target /
RMAN> backup datafile 4;

Corrupt the data in datafile with dd command:

Make sure that dd command given below is just for learning purposes and should only be used on testing systems

$sql>select segment_name , header_file , header_block  from dba_segments where segment_name = ‘TEST_CORRUPT’
and owner = ‘U1’;
SEGMENT_NAME         HEADER_FILE   HEADER_BLOCK
—————————- ———–                ————
TEST_CORRUPT                      4                         16

[oracle@localhost]$cd /d01/oradata
[oracle@localhost]$dd of=ts1.dbf bs=8192 conv=notrunc seek=17 << EOF
> Bingo! Corrupted.
> EOF
0+1 records in
0+1 records out
18 bytes (18 B) copied, 0.000684 seconds, 27.0 kB/s

This command successfully executed block 17 in the data file “/d01/oradata/ts1.dbf” is corrupt

Check the data block curroption:

$sql> sqlplus / as sysdba
$sql> alter system flush buffer_cache;
$sql> conn u1/u1
$sql> select count(*) from TEST_CORRUPT;
select count(*) from test_corrupt
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 17)
ORA-01110: data file 4: ‘/d01/oradata/ts1.dbf’

Please perform below any one of the method, Here I am showing two methods with or without RMAN Backup.

Performing Block Recovery without having RMAN BACKUP:

As we have HOTBACKUP for datafile ts1.dbf, Catalog the “hot backup” to the RMAN repository

[oracle@localhost]$rman target /
RMAN> CATALOG DATAFILECOPY ‘/d01/oradata/ts1_bkp.dbf’;
RMAN> BLOCKRECOVER DATAFILE 4 BLOCK 17;

Performing Block Recovery with RMAN BACKUP:

As we have datafile 4 RMAN BACKUP, Perform recovey…

[oracle@localhost]$rman target /
RMAN> BLOCKRECOVER DATAFILE 4 BLOCK 17;

BLOCK MEDIA RECOVERY Complete we should now get the block 17 recovered back:

[oracle@localhost]$ sqlplus U1/U1
$sql> select count(*) from TEST_CORRUPT;
COUNT(*)
———-
1
$SQL> exit

HAPPY LEARNING !!

Enable/Disable Maintenanace Mode from SQLPLUS Session (Without adadmin)

We can enable or disable maintenance mode without using adutility (adadmin), Perform the same from SQLPLUS session.

Check the current status of Maintenance Mode:

select fnd_profile.value(‘APPS_MAINTENANCE_MODE’) from dual;

MAINT     =  MAINTENANCE MODE is ENABLED
NORMAL =  MAINTENANCE MODE is DISABLED

ENABLE maintenance mode:
sqlplus -s apps/apps @$AD_TOP/patch/115/sql/adsetmmd.sql ENABLE

DISABLE maintenance mode:
sqlplus -s apps/apps @$AD_TOP/patch/115/sql/adsetmmd.sql DISABLE

The system has not been taken off maintenance mode completely.Please contact your system adminstration.

The system has not been taken off maintenance mode completely.Please contact your system adminstration.

Maintenance_mode

Cause: After patch application, Maintenance mode is not disabled.

Solution :

1) login to applmgr user

2) run adadmin

3) use option 5 to disable maintenance mode

AD Administration Main Menu
————————————————–
1.    Generate Applications Files menu
2.    Maintain Applications Files menu
3.    Compile/Reload Applications Database Entities menu
4.    Maintain Applications Database Entities menu
5.    Change Maintenance Mode
6.    Exit AD Administration

Enter your choice [6] : 5
Please select an option:
1.    Enable Maintenance Mode
2.    Disable Maintenance Mode
3.    Return to Main Menu

Enter your choice [3] : 2

sqlplus -s &un_apps/***** @/apps/vision/apps/apps_st/appl/ad/12.0.0/patch/115/sql/adsetmmd.sql DISABLE
Successfully disabled Maintenance Mode.

Concurrent Manager Issue : FND_DCP.REQUEST_SESSION_LOCK / DBMS_LOCK.Request

Error in Concurrent manager logfile :
=========================

Routine FND_DCP.REQUEST_SESSION_LOCK received a result code of 1 from the call to DBMS_LOCK.Request.
Possible DBMS_LOCK.Request resultCall to establish_icm failed
The Internal Concurrent Manager has encountered an error.

Resolve the issue in two ways:

Solution 1 (Bounce database):
1. Stop all the services and make sure that all the concurrent managers completely down.
2. Stop and restart the database
3. Restart all the services and concurrent managers

Solution 2 (Without database bounce):

1. Stop the concurrent managers cleanly.
2. Check for the database locks and kill the locks related to CM.
3. Run cmlean.sql with apps user.
4. Start the concurrent managers.

Check for CM Locks:

SQL> SELECT v$access.sid, v$session.serial#
FROM v$session,v$access
WHERE v$access.sid = v$session.sid and v$access.object = ‘FND_CP_FNDSM’
GROUP BY v$access.sid, v$session.serial#;

SID          SERIAL#
———- ———-
2000         1000

sql> alter system kill session ‘2000,1000’;

DBMS_LOCK.Request

FNDFS Error- unable to view Concurrent program LOG and OUT files

An error occurred while attempting to establish an Applications File Server connection with the node FNDFS_APPLTOP_ . There may be a network configuration problem, or the TNS listener on node FNDFS_APPLTOP_ may not be running.Please contact your system administrator.

Problem : In R12, After running a Concurrent request, Unable to view LOG and OUT files of the Concurrent request and returns above error message.

Cause : The RRA is Not Enabled in the Profile Option.

Solution :
In the Profile Option –>system –> RRA ->RRA: Enabled is set as No in Site Level. Make it to Yes.
Save and Logout and Retest the Issue.