Wait/Sleep in PLSQL - asynchronous

I want to test sync/async call to a procedure named pro1. For that purpose, I want to put lock call in pro1.
DECLARE
t INTEGER;
BEGIN
t := 60;
DBMS_LOCK.sleep(t);
END;
/
Just want to make sure, would that wait/lock a sync call? i.e. my proc1 wouldn't exit untill that lock is finished?
P.S:
While the Proc1 is being run, there is another procedure. I want to test its execution while there is a lock on connection by Pro1

DBMS_LOCK.sleep will put the session process to sleep, i-e: this session will do nothing for 60 seconds.
I'm not sure what you mean by a "lock on connection". If the session that runs the sleep procedure has any lock pending, they will be kept during the sleep and other sessions that might be blocked by it will have to wait for the first session to either commit or rollback as usual.

Related

How To Roll Back Accidental Direct Unit Test Proc Call?

I am starting to dabble in tSQLt and a few times have accidentally hit F5 and executed my test proc directly instead of through tSQLt.RunAll, which hoses my entire database. Is there any simple way to roll back that accidental execution instead of restoring my entire database from backup?
The full error is [myDClass].[test myTest] failed: (Error) There is already an object named 'pMyProc_SpyProcedureLog' in the database.[16,6]{,1} (There was also a ROLLBACK ERROR --> The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.{tSQLt.Private_RunTest,162})
I checked DBCC OPENTRAN but there aren't actually any transactions listed.

How can I check the status of a stored proc invoked by user in oracle?

I want to know whether a particular stored proc invoked by a user in oracle has succeeded or failed?
In other words, if there is something like session or task log table which could come handy in some edge cases?
Edge cases being:
proc has executed successfully
or has not
the proc gets hung
the proc is being abruptly terminated
or could be anything which I cannot really handle.

Session error in Teradata Fastload Script

My Fastload script is scheduled to run every week and when it starts the script failed because of the insufficient number of sessions every week. but, when I restart the script manually then it executed with no session error.
I don't what causes it to fail every week with the same reason of insufficient session. Can anyone let me know what all may be the reason for the same.
Check for:
1. Schedule job connection string, if it point to one Teradata Node (I.P) address. Sometimes based on the concurrent session you exceed PE session limit (120 session). Try using DNS/VIP to achive better load balancing
2. Number of Unilities running on system during schedule time. If your exceed the limit of threshold use SLEEP and TANACITY to plance your job in queue instead it fails
3. Limit the Fastload session limit using SESSIONS
Thanks!!

c# timed out exception for simple query.

Im getting a time out expired.
The timeout period elapsed prior to completion of the operation.
If I execute the same query in SQL server management its getting executed but trying to execute the query through the program does not succeed.
Where could I have gone wrong?
The query is very simple and its throwing exception.
The time out set is 90 sec.
Select isnull(max(voucherid),0)+1 from XXX
dbmanager.executequery(con,"uspXXX",parameter);
Rebuild your statistics and/or indexes on that table.
See this answer.

Error handling and RollBack Transaction in SQLITE from SQL Statement

I'm Altering multiple sqlite tables with SQL script by calling ExecuteNonQuery. I want to do this operation in transaction and want to roll it back when anything fails.
I looked at BEGIN TRANSACTION and its clear that I have to call ROLLBACK TRANSACTION when anything goes wrong. But I don't know how could TRY...CATCH (Transact-SQL) kind of thing here.
NOTE: Whole of Sql Script file (which contains many other statements apart from these few statements which needs to be fired in one transaction) is read by .ReadToEnd() and then executed in one go as of now. I want to handle this in sql script file itself and don't want to change the code.
Please take a look at SQLite on conflict clause
Start with BEGIN TRANSACTION
You have to add ON CONFLICT ROLLBACK on your actions
And COMMIT TRANSACTION at the end ;-)

Resources