Tuesday, August 3, 2021

Oracle useful SQLs and command

EBS : How to get Vendor ID

select * from ap_invoices_all where invoice_id=

EBS : How to cross check applcation name

select * from FND_Application_tl where application_name like 'Payable%'

select * from FND_Application where application_id=200

EBS : Find code level

select * from fnd_product_installations where patch_level like '%AD%';

select abbreviation, codelevel from ad_trackable_entities where abbreviation in ('txk','ad','atg_pf');

Oracle : Identify lock objects and sessions select session_id sid ,SERIAL# Serial , substr(object_name,1,20) Object1, substr(os_user_name,1,10) Terminal1, substr(oracle_username,1,10) Locker1, nvl(lockwait,'active') Wait1, decode(locked_mode, 2, 'row share', 3, 'row exclusive', 4, 'share', 5, 'share row exclusive', 6, 'exclusive', 'unknown') Lockmode , OBJECT_TYPE Type1 FROM SYS.V_$LOCKED_OBJECT A, SYS.ALL_OBJECTS B, SYS.V_$SESSION c WHERE A.OBJECT_ID = B.OBJECT_ID AND C.SID = A.SESSION_ID ORDER BY 1 ASC, 5 Desc;

select 'alter system disconnect session ' || '''' || sid || ',' || serial# || ''' immediate;' from v$session s where s.event='SQL*Net message from dblink' ;

select * from v$session s where s.event='SQL*Net message from dblink' ;

select p.* from v$session s, v$process p where p.addr=s.paddr and s.sid=945 ;

select * from SYS.Dba_Jobs_Running ;
alter system disconnect session '8,57999' immediate ; alter system kill session 'SID,Serial#';

SELECT DECODE(v.request,0,'Holder: ','Waiter: ') || v.sid sess, v.inst_id, v.id1, v.id2, v.lmode, v.request, v.type, s.sid,s.serial#,s.last_call_et,s.action,s.event FROM gv$lock v, gv$session s WHERE (v.id1, v.id2, v.type) IN ( SELECT v1.id1, v1.id2, v1.type FROM gv$lock v1 WHERE v1.request>0) and s.inst_id=v.inst_id and s.sid=v.sid ORDER BY v.id1, v.request;

//message should not Streams AQ: waiting for messages in the queue

select SID,Serial#, client_identifier,action,event,user#,username,status from gv$session where client_identifier like '%41899%' and status='ACTIVE'

select c.owner, c.object_name, c.object_type,b.sid, b.serial#, b.status, b.osuser, b.machine from v$locked_object a , v$session b, dba_objects c where b.sid = a.session_id and a.object_id = c.object_id;

//machine wise

select sid,serial#,last_call_et,action,event,program,machine,osuser,username from v$session s where s.machine like 'SML%' ;

select sid,serial#,last_call_et,action,event,program,machine,osuser,username from v$session s where status='ACTIVE' and type='USER'

//deadlock

select sid, serial#, username, command, lockwait, osuser from v$session where lockwait is not null

SELECT DECODE(request,0,'Holder: ','Waiter: ') || sid sess, id1, id2, lmode, request, type FROM V$LOCK WHERE (id1, id2, type) IN ( SELECT id1, id2, type FROM V$LOCK WHERE request>0) ORDER BY id1, request;

select (select username || ' - ' || osuser from v$session where sid=a.sid) blocker, a.sid || ', ' || (select serial# from v$session where sid=a.sid) sid_serial, ' is blocking ', (select username || ' - ' || osuser from v$session where sid=b.sid) blockee, b.sid || ', ' || (select serial# from v$session where sid=b.sid) sid_serial from v$lock a, v$lock b where a.block = 1 and b.request > 0 and a.id1 = b.id1 and a.id2 = b.id2;

select event,count(1) from v$session check for 'sql netmessage for dblink'
//which user is running what sql declare x number; begin for x in ( select username||'('||sid||','||serial#|| ') ospid = ' || process || ' program = ' || program username, to_char(LOGON_TIME,' Day HH24:MI') logon_time, to_char(sysdate,' Day HH24:MI') current_time, sql_address, LAST_CALL_ET from v$session where status = 'ACTIVE' and rawtohex(sql_address) <> '00' and username is not null order by last_call_et ) loop for y in ( select max(decode(piece,0,sql_text,null)) || max(decode(piece,1,sql_text,null)) || max(decode(piece,2,sql_text,null)) || max(decode(piece,3,sql_text,null)) sql_text from v$sqltext_with_newlines where address = x.sql_address and piece < 4) loop if ( y.sql_text not like '%listener.get_cmd%' and y.sql_text not like '%RAWTOHEX(SQL_ADDRESS)%') then dbms_output.put_line( '--------------------' ); dbms_output.put_line( x.username ); dbms_output.put_line( x.logon_time || ' ' || x.current_time|| ' last et = ' || x.LAST_CALL_ET); dbms_output.put_line( substr( y.sql_text, 1, 250 ) ); end if; end loop; end loop; end; /

//FIND LOCKING SESSIONS FOR A TABLE:
select object_id from dba_objects where LOWER(owner)='sml' and LOWER(object_name)='emp_master_site'; SELECT c.owner, c.object_name, c.object_type, b.sid, b.serial#, b.status, b.osuser, b.machine FROM v$locked_object a, v$session b, dba_objects c WHERE b.sid = a.session_id AND a.object_id = c.object_id and a.object_id=91198;

//gET LOCKING OBJECT

SELECT vh.sid locking_sid, vs.status status, vs.program program_holding, vw.sid waiter_sid, vsw.program program_waiting FROM v$lock vh, v$lock vw, v$session vs, v$session vsw WHERE (vh.id1, vh.id2) IN (SELECT id1, id2 FROM v$lock WHERE request = 0 INTERSECT SELECT id1, id2 FROM v$lock WHERE lmode = 0) AND vh.id1 = vw.id1 AND vh.id2 = vw.id2 AND vh.request = 0 AND vw.lmode = 0 AND vh.sid = vs.sid AND vw.sid = vsw.sid;

//ref

https://oracleexamples.wordpress.com/2010/04/08/find-a-locking-session/

process wise session : ps aux --sort -rss | head -10

ps -ef | grep LOCAL

select a.sid,a.username,a.sql_id,a.last_call_et,a.action,a.event,a.program,a.machine,a.osuser,a.type,a.status from v$session a,v$process b where a.paddr=b.addr and b.spid like '%3716%'

select program,machine,osuser,username,s.module,to_char(logon_time,'DD-MON-YY HH24:MI:SS') || '|' || action || '|' || event || '|' || sid || '|' || serial#|| '|' || last_call_et from v$session s where status='ACTIVE' and type='USER' and (machine ) in (select machine from v$session s where status='ACTIVE' and type='USER' group by machine having count(1)>15) order by machine;

select a.sid||'|'|| a.serial#||'|'|| a.process from v$session a, v$locked_object b, dba_objects c where b.object_id = c.object_id and a.sid = b.session_id and OBJECT_NAME=upper('&TABLE_NAME');

//get object id

select object_id from all_objects where LOWER(object_name) like '%RG%'



Friday, December 30, 2016

Oracle database, Identify problem/issue from alert file

//find out ADR_HOME location
select * from V$DIAG_INFO;
//go in ADR Home
//run below command on command prompt
adrci
show home
show problem
//show problem list out all the incidents
*************************************************************************
PROBLEM_ID           PROBLEM_KEY                                                 LAST_INCIDENT        LASTINC_TIME
-------------------- ----------------------------------------------------------- -------------------- ----------------------------------------
3                    ORA 600 [17286]                                             144063               2016-09-02 15:51:41.613000 +05:30
4                    ORA 600 [16607]                                             134097               2016-09-03 15:44:39.985000 +05:30
5                    ORA 7445 [kkxcrc()+945]                                     134287               2016-09-15 21:32:25.985000 +05:30
2                    ORA 600 [kqldafl1]                                          170213               2016-10-20 12:12:21.930000 +05:30
1                    ORA 600 [17023]                                             170214               2016-10-20 12:12:23.936000 +05:30
6                    ORA 600 [kghfrf1]                                           230937               2016-12-07 17:12:48.040000 +05:30
6 rows fetched


//find out a particular incident
show incident -p "problem_key='ORA 1578'"
//pack incident detail so that these information can be sent to oracle support
ips pack incident 18147 in /tmp

Friday, December 4, 2015

Weblogic12c, Failed to start managed server, Showing java.sql.SQLException: ORA-28001: the password has expired

Scenerio: Our Admin Server and 1 Managed server has been perfectly running from last 1 month and now when I tried to start managed server 2 on another machine it shows below error

java.sql.SQLException: ORA-28001: the password has expired
 

I noticed that When I tried to connect agile user from sql developer it shows that user is expired.

Final I reached at conclusion that agile user default profile was configured with 180 days.

Solution : login in database using sys and update the same password again for user agile.

Preventive action :alter profile default limit PASSWORD_LIFE_TIME unlimited;

If we need to change the password then we need to configure new agile password in application again. There is a separate action plan for this.


Thursday, October 15, 2015

Weblogic 12.1,Managed server log showing "The transaction is no longer active - status: 'Marked rollback.[Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 902 seconds"

We have deployed oracle Agile 9.3.3 on Weblogic 12.1 now we are not able to export agile data in CSV format, While investing managed server log shows that "while exporting report data from agile "The transaction is no longer active - status: 'Marked rollback.[Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 902 seconds"

It means default timeout of JTA is 15 minutes by default

So Timeout of JTA increased using weblogic console.
domain->services->JTA
changed the timeout seconds =1800 (30 min)


ORACLE OHS 12 Timeout : HTTP/1.1 503 Service Temporarily Unavailable

Error found in Weblogic Log

HTTP/1.1 503 Service Temporarily Unavailable 
Date: Mon, 07 Sep 2015 08:47:13 GMT 
Server: Oracle-HTTP-Server-11g 
Content-Length: 250 
Connection: close 
Content-Type: text/html 
Content-Language: en 

Weblogic Bridge Message

Failure 


of Web Server bridge:

No backend server available for connection:

timed out after 10 seconds or idempotent set to OFF or method not 
idempotent.


----------------- 
This means,  <"Any ERROR">  is caused by connection timeout, the OHS(Oracle Http Server) will reset the connection if it doesn't receive the response from Weblogic server in certain time (By default, 5 minute). 
Many debug log enabled in your system seems to affect this problem. 

To avoid this problem, you can increase the connection timeout for OHS. 
Solution

Set OHS timeout default it is 5 min change it to 30 min by 

Timeout  1800  in below file

///instances/instance1/config/OHS/ohs1/httpd.conf

Weblogic 12.1, Managed server giving error "javax.naming.NoPermissionException: User does not have permission on javax to perform lookup operation."

After Applying debug log, Managed Server is giving error "javax.naming.NoPermissionException: User does not have permission on javax to perform lookup operation." whereas Admin Server is working fine.

Solution is Open weblogic Console
go in Domain->Security and checked the option "Anonymous Admin lookup enabled"

then save and activate the changes and restart managed server, It will run successfully.

Monday, July 1, 2013

Undelivered Mail, Error Code List

2xx Request ok. Go ahead.
220 Mail service is running (ESMTP ready).
221 2.0.0 Closing connection (Mail received successfully, Goodbye).
250 2.0.0 Message accepted for delivery
250 2.1.0 Sender e-mail address ok.
250 2.1.5 Recipient e-mail address ok.
3xx Request ok, but more input is needed to complete the action successfully.
354 Enter mail, end with CRLF.CRLF
4xx Temporary error, try again.
421 4.2.1 The service is not available and the connection will be closed.
441 4.4.1 Cannot connect to remote host (host has DNS entry, but can’t be connected to).
450 4.5.0 Mailbox temporarily unavailable.
451 4.1.8 Sender e-mail address domain does not resolve temporarily.
451 4.7.1 Greylisting in action, please come back later.
454 4.7.0 TLS not available due to local problem. Please try again later.
5xx Permanent error. Don’t try again.
500 5.5.1 Syntax error, command unrecognized.
503 5.5.0 Sender e-mail address already specified.
503 5.5.1 Need MAIL before RCPT.
544 5.4.4 Host not found (not in DNS).
550 5.1.1 Mailbox does not exist.
550 5.1.3 Bad e-mail address syntax.
550 5.7.0 Your IP address is in a blacklist.
553 5.1.8 Sender e-mail address domain does not exist.
554 5.7.1 Relaying denied