Discussions
Categories
- 197.1K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.7K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 555 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.3K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
Query gets hanged during first of month

Hello, I have a oracle query (merge statement) that runs every day. But during the first few days of the month , it gets hanged whereas other days it is fine.
I tried running manually and the execution time is done but this screen stay for a long time (more than an hour)
Can some one assist me on how do I find what's running on the background and how do I troubleshoot ?
Thanks in advance.
Answers
-
You don't give much to go on. Please copy and paste the text of the entire statement/procedure/script. Please explain in detail how it is being submitted.
-
Due to security issues, I may not be able to copy the entire scripts here. But I'm trying to run a merge statement which is something like below. Usually this statement takes a minute to run and merge the data into the dimension table, but every first of month it runs forever and hangs there.
merge into table d using
( select * from (
select key , id , id1 , sysdate , row_number() over (partition by key order by v.id) as row_num
from f_transaction f,
(select ID from f_import v where date = 'Today'sDate' ) v
where f.id = v.id
and f.date = 'today's date' )
where row_num = 1 ) x
on (d_key = x.key
when matched then update set
d.id = x.id
, d.dw_update_date = x.dw_update_date
when not matched then
insert ( id , Key, Date)
values ( x.id , x.key , x.date);
When running this merge statement in toad, it executes till 23 seconds, then it stays there and stops counting. Toad then get hanged. I checked in the session monitor for any locks and made sure no other jobs are running parallelly.
So need some help here to know how to troubleshoot this.
-
And if you run the statement from SQL*Plus?
-
And are the numbers of rows in
f_transaction
andf_import
more or less the same throughout the month? -
@JohnWatson2 , The same issue with SQL plus as well.
@tsangsir , the rows gets added each day , so these two tables keeps growing. These two tables already have millions of records, we do have index on these tables as well.
-
@JohnWatson2 , The same issue with SQL plus as well.
Do you mean that it runs to completion in 23 seconds? Or do you mean that it hangs forever?
A simple way to gather a bit more information, in SQL*Plus, would be to
set timing on set autotrace on merge into......
and copy/paste it all here.
-
and copy/paste it all here.
And please be sure to post it as code-formatted
-
@JohnWatson2 , @EdStevens Thanks , when I run the same query in SQL plus, it hangs there as well.
the thing is, I ran it today, the same merge statement and I got the result in 23 seconds. But I'm facing this issue only during the first of month (Every time).