Ask the Community
Groups
The Oscar Procedure 'dbo.ProcedureName' reached its batch duration limit with additional records remaining to be removed - Connect IT Community | Kaseya
<main> <article class="userContent"> <h3 data-id="question">Question</h3> <p>I am getting these Oscar alerts, how do I re-mediate this?</p> <p><img src="https://us.v-cdn.net/6032361/uploads/migrated/I5BB9TI3Z9EW/mceclip0.png" alt="image" class="embedImage-img importedEmbed-img"></img></p> <h3 data-id="answer">Answer</h3> <p>If during our nightly database cleanup, the cleanup is not finished because of excessive records, an email will be sent to master admins.</p> <h3 data-id="resolution">Resolution</h3> <p>Execute the procedure manually by following these steps: </p> <p><strong>1. </strong>To check the batch size use the below query - this will show the cleanup set up for this procedure and also show the last run count, i.e. procedure 'dbCleanupEventInstanceHistEventOrphans':</p> <pre class="code codeBlock" spellcheck="false" tabindex="0">SELECT * FROM dbo.dbCleanupProcSettings<br>WHERE ProcName LIKE '%dbCleanupEventInstanceHistEventOrphans%'</pre> <p><strong>2. </strong>To find out how many pending records need to be cleared, use the query below - this has to be customized based on the alert you are getting: </p> <pre class="code codeBlock" spellcheck="false" tabindex="0">SELECT COUNT(*) T1<br>FROM hermes.EventInstanceHistory T1<br>LEFT JOIN hermes.EventInstance T2 ON T2.EventID = T1.EventID<br>WHERE T2.EventID IS NULL</pre> <p><strong>Example:</strong></p> <pre class="code codeBlock" spellcheck="false" tabindex="0">SELECT COUNT(*) T1<br>FROM wslogdetail T1<br>WHERE NOT EXISTS (SELECT 1 FROM wslogBase WHERE TransactionId = T1.TransactionId) </pre> <p><strong>3. </strong>Count the pending rows to be deleted by each cleanup routine and execute the procedure manually:</p> <pre class="code codeBlock" spellcheck="false" tabindex="0">EXEC dbCleanupEventInstanceHistEventOrphans<br><a href="https://kaseya.vanillacommunities.com/profile/Batchsize" rel="nofollow">@Batchsize</a> = 1000</pre> <p><strong>Note: </strong>Set a batch size based on the number of records to be cleaned up and once the rows are cleaned up, you should no longer get these emails. Now, if this query takes more than 10 seconds to execute, please reduce the batch size and run this in multiple intervals.</p> </article> </main>