I have multiple select queries which I want to execute asynchronously. How can I do this in oracle sql ?
我有多个选择查询,我想异步执行。我怎样才能在oracle sql中执行此操作?
I basically want to test something and so want to simulate workload so I don't really care about the result and I know I can do this in multiple threads but this is specific and so would prefer if I can do this entirely in sql. procedures are fine though. NOTE: there are no update queries only select.
我基本上想要测试一些东西,所以想要模拟工作负载,所以我并不真正关心结果,我知道我可以在多个线程中做到这一点,但这是特定的,所以如果我完全可以在sql中这样做,我宁愿这样做。程序很好但是。注意:没有更新查询仅选择。
I read about nowait but am not sure how to use it in oracle.
我读了关于nowait,但不知道如何在oracle中使用它。
I tried something like -
我试过像 -
select * from foo with(nowait) where col1="something";
This is the error I got -
这是我得到的错误 -
with(nowait)
*
ERROR at line 3:
ORA-00933: SQL command not properly ended
2 个解决方案
#1
4
The Oracle info on NOWAIT
says:
NOWAIT上的Oracle信息说:
Specify NOWAIT if you want the database to return control to you immediately if the specified table, partition, or table subpartition is already locked by another user. In this case, the database returns a message indicating that the table, partition, or subpartition is already locked by another user.
如果希望数据库在指定的表,分区或表子分区已被其他用户锁定的情况下立即将控制权返回给您,请指定NOWAIT。在这种情况下,数据库返回一条消息,指示表,分区或子分区已被其他用户锁定。
This will not do what you want.
这不会做你想要的。
Asynchronous queries are an application thing, not a SQL thing. For example I can open TOAD and open a dozen windows and run long queries in all of them and still open another window and run another query. I could open a dozen instances of SQLPLUS and do the same thing. Nothing in the query lets me do this, it's in the application.
异步查询是一个应用程序事物,而不是SQL事物。例如,我可以打开TOAD并打开十几个窗口并在所有窗口中运行长查询,然后仍然打开另一个窗口并运行另一个查询。我可以打开十几个SQLPLUS实例并做同样的事情。查询中没有任何内容可以让我这样做,它在应用程序中。
#2
0
I think you could use DBMS_SCHEDULER to schedule some sql or procs that execute SQL.
我认为你可以使用DBMS_SCHEDULER来安排一些执行SQL的sql或procs。
However this is probably not the best way to do this
然而,这可能不是最好的方法
There are tools for this. The best way maybe to write a procedure you can call from the web and then you can use any performance testing tool that can make a web call...its worked for me before.
有这方面的工具。最好的方法是编写一个可以从网上调用的程序,然后你可以使用任何可以进行网络呼叫的性能测试工具......它之前对我有用。
You may also consider:
您还可以考虑:
http://sqlmag.com/database-performance-tuning/testing-heavy-load-simulating-multiple-concurrent-operations
#1
4
The Oracle info on NOWAIT
says:
NOWAIT上的Oracle信息说:
Specify NOWAIT if you want the database to return control to you immediately if the specified table, partition, or table subpartition is already locked by another user. In this case, the database returns a message indicating that the table, partition, or subpartition is already locked by another user.
如果希望数据库在指定的表,分区或表子分区已被其他用户锁定的情况下立即将控制权返回给您,请指定NOWAIT。在这种情况下,数据库返回一条消息,指示表,分区或子分区已被其他用户锁定。
This will not do what you want.
这不会做你想要的。
Asynchronous queries are an application thing, not a SQL thing. For example I can open TOAD and open a dozen windows and run long queries in all of them and still open another window and run another query. I could open a dozen instances of SQLPLUS and do the same thing. Nothing in the query lets me do this, it's in the application.
异步查询是一个应用程序事物,而不是SQL事物。例如,我可以打开TOAD并打开十几个窗口并在所有窗口中运行长查询,然后仍然打开另一个窗口并运行另一个查询。我可以打开十几个SQLPLUS实例并做同样的事情。查询中没有任何内容可以让我这样做,它在应用程序中。
#2
0
I think you could use DBMS_SCHEDULER to schedule some sql or procs that execute SQL.
我认为你可以使用DBMS_SCHEDULER来安排一些执行SQL的sql或procs。
However this is probably not the best way to do this
然而,这可能不是最好的方法
There are tools for this. The best way maybe to write a procedure you can call from the web and then you can use any performance testing tool that can make a web call...its worked for me before.
有这方面的工具。最好的方法是编写一个可以从网上调用的程序,然后你可以使用任何可以进行网络呼叫的性能测试工具......它之前对我有用。
You may also consider:
您还可以考虑:
http://sqlmag.com/database-performance-tuning/testing-heavy-load-simulating-multiple-concurrent-operations