Sql hints in jpa
How can i pass in sql hints to oracle database using ebj3 jpa? Any examples would be great. I can't find any example searching the web or this forum. I guess, using native query, might solve this problem, but any facility in ejb query language?
TopLink Essentials will only support this through native queries.
In the Oracle TopLink 11g preview you can access the underlying Oracle specific hint functionality.
Doug
Similar Messages
-
How do I use Sql hints in PreparedStatement?
Hi,
I am trying to use a sql query which uses Oracle hints to optimize the query. I am using the ojdbc drivers from Oracle. I am using the PreparedStatement (Java 1.4) to execute this query, but it returns an empty resultset. If I remove the hint, then the query works fine using the PreparedStatement. Does anyone know how to make sql hints work using preparedstatement. I tried it with Statement object and that works (ie. the hint works and returns rows as expected).
The query is as follows:
select /*+ ordered
use_nl(ri ma)
count(*),
ma.columnName
from table1 ri,
table2 ma
where ma.columnName2 = ri.columnName2
and ma.column3 = 1
and ri.column4 = 66
group by ma.columnName
I tried escaping the /*+ but that also didn't work. Any help would be appreciated.
Thanks in advance,
ParagMust be an old database.
Presumably you tried it in sqlplus and it worked both ways. If not then nothing you do will make it work in java.
Other than that my quess would be that it has nothing to do with the select.
Some possibilities.
1. You are eating exceptions.
2. You are not running the code that you think you are. -
Migrating from Oracle to SQL Server - SQL HINTS
We are migrating an SAP landscape from HP-UX / Oracle to Windows / SQL Server. We have numerous custom programs with OPEN SQL Hint statements of the form:
select aqmnum akunum aobjnr azztaxtype a~zzservcenter
azzassmpriok azzaudittype a~zzdr840dt
into corresponding fields of table lt_qmel
from qmel as a
inner join ihpa as b
on aobjnr = bobjnr
where a~qmart IN ('Z7','Z8','Z9','ZU','ZD')
and b~parnr = sy-uname
*%_hints oracle*
*'INDEX("&TABLE&" "IHPAP" "IHPAP")'.*
Question: What is the best way to make these SQL statements compatible with SQL Server?
ThanksPaul Chafin wrote:>
> We are migrating an SAP landscape from HP-UX / Oracle to Windows / SQL Server. We have numerous custom programs with OPEN SQL Hint statements of the form:
> Question: What is the best way to make these SQL statements compatible with SQL Server?
Hi Paul,
as hints are highly database specific it may well be that you won't need them for your new DBMS anymore.
In any case you've to review them one-by-one to check the execution plan of the queries without a hint.
A general "migration of hints" is neither possible nor sensible.
regards,
Lars -
How to write SQL hints for this query?
The query is like:
select * from foo, t
where foo.name in
(select name from bar
where id in (
select id from car
where date < sysdate
and foo.a = t.b;
I want the innermostsubquery 'select id from car ...' to be executed first, and the subquery 'select name from bar ...' to be execute second, and the outermost query 'select * from foo,t ...' to be executed the last. How can I write the Oracle sql hints to force the order?
Thanks.user553560
You might be able to create a large set of hints to force the access path you want - but unless you really know what you are doing with hints, you may find that your solution is very unstable (it might be luck rather than correctness that let's it work to start with).
The difficulty in this query is the double layer of IN subqueries, so if you can rewrite the query, you might try manually unnesting as follows:
select
t1.*. t.*
from
select
distinct t2.name
from t2
where t2.id in (
select t3.id
from t3
where t3.dated < sysdate
) v,
t1,
t
where
t1.name = v.name
and t1.a = t.bDepending on your indexing and statistics, you may find that a simple /*+ unnest */ hint in the first subquery will be sufficient to do this for your. Again depending on the statistics you may find that you have to put extra hints into the above to make Oracle use the join method and indexes you think appropriate.
N.B. The first step (as others have noted) is to check that your statistics are good before you start manipulating the code or using hints.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk -
Using an Oracle SQL Function from JPA/TopLink
How do I get the return value from a simple (one string input parameter, returns a string) Oracle SQL Function?
Thanks!If you mean calling a stored function in Oracle, you might try something like:
ValueReadQuery vrq = new ValueReadQuery();
SQLCall call = new SQLCall("begin ###res := pkg.funcInp(#inp); end;");
vrq.setCall(call);
Query q = em.createNativeQuery(""); // we need a Query; any query would do; we replace its contents below
((EJBQuery)q).setDatabaseQuery(vrq);
q.setParameter("inp", "paramValue");
String result = (String)q.getSingleResult();
// #=input; ###=output; ####=input/output;
// if you want to explicitly specify the type of an output parameter, use #### instead of ###,
// because pure "output" parameters are always treated as java.lang.StringThis will only work in TopLink Essentials, though. I don't know how to do it in Hibernate. I have dealt mainly with TopLink, and just a little with Hibernate.
In my opinion, it's a HUGE omission not to have support for stored procedures in JPA. Virtually every project I have worked on (in two large companies) has consisted of a large portion of code in stored procedures (sometimes as much as 50% of the overall code). It's a pain to have to go through all that trouble to call the stored procedures.
Also, pay special attention to TopLink's shared L2 cache. If a stored procedure changes something in the database, TopLink won't know about it and chances are that you will end up with stale objects in the cache which you will either have to refresh, or you'd have to invalidate TopLink's cache for these objects.
Best regards,
Bisser -
How To Handle SQL Exceptions in JPA
Hi,
we are working on toplink JPA. My use case is I have an emp table with columns as "empid" , "emp name" , "job" with "empid" as primary Key. Here I'm creating a record in the Database by using a jspx page. Here My problem is when I'm entering a duplicate value for the empid I'm getting "ORA-00001: unique constraint (constraint_name) violated" . I'm able to catch the exception in the jspx backing bean where I'm calling the JPA insert method, But i could not catch the exception in the sessionEJB Bean. Is there any way to catch such exception in the sessionEJB.
could anyone help me out.
Thanks in Advance.
regards,
PrapanSolYou should be able to call flush on your EntityManager in your SessionBean to trigger the exception.
Note that the transaction will still be rolled back even if you catch this exception. -
Hi All,
I have a doubt. I need to write the following query and achieve good perfomance. The data in the table is 200Million records.
Select Add_Months(Max(day_dt),-10) From Table X Partition(Ptn_001);
Can anyone of you provide me help in improving the query perf.1. If day_dt column is NOT NULL and if other columns (if any) takes much more space than day_dt (which takes 8 bytes per row) then there is a sense co create an index on column day_dt. The query requires access to this column only, so it's possible to do [Fast Full Index Scan|http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i52044] instead of [Full Table Scan|http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#i44851]. Usually index segment size is less than table segment size, less disk I/O increases performance.
2. Both table and index full scans can be done in Parallel. Parallel execution increases performance substantially.
Regards,
Dima. -
hi,
can you plz provide any best sides for sql hints?Suri wrote:
You can learn basics from below site.
http://www.dbasupport.com/oracle/ora9i/index_hints.shtml
What an awful article...
>
Using Index Hints in SQL statements - Cause we know more about our application than Oracle does
Hints are used to give specific information that we know about our data and application, to Oracle. This further improves the performance of our system. There can be instances where the default optimizer may not be efficient for a certain SQL statements. We can specify HINTS with the SQL statements, to improve the efficiency of those SQL statements.
<cut>
By using Hints, you can improve certain SQL statements that might otherwise be inefficient.
>
That is just so wrong and completely misses the point.
If a query is inefficient, then it can be down to poor database design, lack of statistics, lack of correct indexes (sometimes too many indexes), or poorly written SQL statements. Hacking an SQL statement with Hints to try and make it work better because you believe you "know more about our application than Oracle does", shows a complete lack of understanding of the internals of Oracle. Oracle doesn't need to know about the application, but it certainly does need to know about how the data is stored and related on the underlying tables and in the tablespaces and datafiles etc. and it's sure as hell got a better idea about that than any programmer, especially as it can change and adapt in the future as the data changes, which a programmers SQL statements (with fixed hints) won't.
That article is a good example of the wrong attitude towards using hints. Thanks for posting that to demonstrate it. -
Performance issue with SQL with different input data
Hi Experts,
I have an SQL query that uses three tables imtermination, imconnection, imconnectiondesign. Each of these tables have around 23Lakh, 11Lakh, 11Lakh rows respectively. There are appropriate indexes on these tables.
Now there is a query:
SELECT
/*+ NO_MERGE(a) ORDERED USE_NL(c) */ c.objectid,
c.typeid,
c.transactionstatus,
c.usersessionid,
cd.objectid designid,
c.reservationid,
c.networkid,
c.networktype,
cd.inprojectid,
cd.inprojecttype,
cd.outprojectid,
cd.outprojecttype,
cd.asiteid,
cd.asitetype,
cd.anetworkelementid,
cd.anetworkelementtype,
cd.aportid,
cd.aporttype,
cd.achannelpath,
c.asignaltype,
cd.zsiteid,
cd.zsitetype,
cd.znetworkelementid,
cd.znetworkelementtype,
cd.zportid,
cd.zporttype,
cd.zchannelpath,
c.zsignaltype,
c.signaltype,
c.visualkey,
c.resourcestate,
cd.assignmentstate,
c.effectivefrom,
cd.effectiveto,
c.channelized,
c.circuitusage,
c.hardwired,
c.consumedsignaltype,
c.flowqualitycode,
c.capacityused,
c.percentused,
c.maxcapacity,
c.warningthreshold,
c.typecode,
cd.lastupdateddate,
c.lastreconcileddate,
c.bandwidth,
c.unit
FROM
(SELECT terminatedid
FROM imtermination t1
WHERE t1.networkelementid = 9200150)
a,
imconnectiondesign cd,
imconnection c
WHERE cd.objectid = a.terminatedid
AND c.objectid = cd.connectionid
AND(SUBSTR('10000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', c.consumedsignaltype + 1, 1) = '1' OR SUBSTR('10000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', c.signaltype + 1, 1) = '1')
AND c.typeid = '$131'
AND cd.assignmentstate IN(2, 3)
The above query takes around 70 secs to execute when input t1.networkelementid = 9200150. Moreover i have observed in the enterprise manager that this has very high i/o wait time.
Now the same query takes around 5 secs to execute when the input t1.networkelementid = 42407448. Both these obejcts with id 9200150 and 42407448 have almost same number of rows and output and without any condition each have 6500 rows in all the three tables.
The execution plan for both these queries with t1.networkelementid = 9200150 and t1.networkelementid = 42407448 is also coming same.
The rows that are corresponding to t1.networkelementid = 9200150 in these three tables are the result of the data created through the application over a period of time. While in case of rows corresponding to t1.networkelementid = 42407448 i have created manually and are contiguous in the three tables.
Does the above behavior is because in case of t1.networkelementid = 42407448 the rows that corresponds to it are not contiguous as they are created over a period of time ?
Execution Statistics
Total Per Execution Per Row
Executions 1 1 0.02
CPU Time (sec) 0.91 0.91 0.02
Buffer Gets 11943 11943.00 238.86
Disk Reads 4804 4804.00 96.08
Direct Writes 0 0.00 0.00
Rows 50 50.00 1
Fetches 5 5.00 0.10
User I/O Waits(98.7%)
CPU(1.3%)
Enterprise manager shows high db file scattered read in case of t1.networkelementid = 9200150, the input for which it is taking 70 secs.
Request experts to provide some pointers to fix this issue as i am not an expert in db tuning.
Thanks in advance for your help.
RegardsHi David,
Please find below the output:
SQL> SELECT table_name, num_rows, last_analyzed
2 FROM all_tables
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 /
TABLE_NAME NUM_ROWS LAST_ANAL
IMTERMINATION 2338746 19-SEP-11
IMCONNECTIONDESIGN 1129298 19-SEP-11
IMCONNECTION 1169373 19-SEP-11
IMTERMINATION 19852 13-SEP-11
IMCONNECTIONDESIGN 6820 13-SEP-11
IMCONNECTION 9926 13-SEP-11
6 rows selected.
SQL> SELECT table_name, index_name,num_rows, last_analyzed
2 FROM all_indexes
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 order by table_name,index_name
5 /
TABLE_NAME INDEX_NAME NUM_ROWS LAST_ANAL
IMCONNECTION IMCONNECTION_A_NE 9925 13-SEP-11
IMCONNECTION IMCONNECTION_A_NE 1169154 19-SEP-11
IMCONNECTION IMCONNECTION_A_PORT 84743 19-SEP-11
IMCONNECTION IMCONNECTION_A_PORT 3371 13-SEP-11
IMCONNECTION IMCONNECTION_A_SITE 1169373 19-SEP-11
IMCONNECTION IMCONNECTION_A_SITE 9926 13-SEP-11
IMCONNECTION IMCONNECTION_NET 0 19-SEP-11
IMCONNECTION IMCONNECTION_NET 12 13-SEP-11
IMCONNECTION IMCONNECTION_PK 9926 13-SEP-11
IMCONNECTION IMCONNECTION_PK 1169373 19-SEP-11
IMCONNECTION IMCONNECTION_RES 0 13-SEP-11
IMCONNECTION IMCONNECTION_RES 0 19-SEP-11
IMCONNECTION IMCONNECTION_ST 2 13-SEP-11
IMCONNECTION IMCONNECTION_ST 60 19-SEP-11
IMCONNECTION IMCONNECTION_TYPEID 4 13-SEP-11
IMCONNECTION IMCONNECTION_TYPEID 64 19-SEP-11
IMCONNECTION IMCONNECTION_UR 26880 19-SEP-11
IMCONNECTION IMCONNECTION_UR 3 13-SEP-11
IMCONNECTION IMCONNECTION_VK 9810 13-SEP-11
IMCONNECTION IMCONNECTION_VK 1191866 19-SEP-11
IMCONNECTION IMCONNECTION_Z_NE 1169173 19-SEP-11
IMCONNECTION IMCONNECTION_Z_NE 9925 13-SEP-11
IMCONNECTION IMCONNECTION_Z_PORT 84092 19-SEP-11
IMCONNECTION IMCONNECTION_Z_PORT 3370 13-SEP-11
IMCONNECTION IMCONNECTION_Z_SITE 9926 13-SEP-11
IMCONNECTION IMCONNECTION_Z_SITE 1169373 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON 1129298 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK 1129298 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST 1129298 19-SEP-11
IMTERMINATION IMTERMINATION_ID 19852 13-SEP-11
IMTERMINATION IMTERMINATION_ID 2279477 19-SEP-11
IMTERMINATION IMTERMINATION_NE 19850 13-SEP-11
IMTERMINATION IMTERMINATION_NE 2327175 19-SEP-11
IMTERMINATION IMTERMINATION_PORT 168835 19-SEP-11
IMTERMINATION IMTERMINATION_PORT 6741 13-SEP-11
IMTERMINATION IMTERMINATION_SITE 19852 13-SEP-11
IMTERMINATION IMTERMINATION_SITE 2391415 19-SEP-11
40 rows selected.
SQL> select table_name,index_name,column_name,column_position
2 FROM all_ind_columns
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 order by table_name,index_name, column_position
5 /
TABLE_NAME INDEX_NAME
COLUMN_NAME
COLUMN_POSITION
IMCONNECTION IMCONNECTION_A_NE
ANETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_A_NE
ANETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_A_PORT
APORTID
1
IMCONNECTION IMCONNECTION_A_PORT
APORTID
1
IMCONNECTION IMCONNECTION_A_SITE
ASITEID
1
IMCONNECTION IMCONNECTION_A_SITE
ASITEID
1
IMCONNECTION IMCONNECTION_NET
NETWORKID
1
IMCONNECTION IMCONNECTION_NET
NETWORKID
1
IMCONNECTION IMCONNECTION_PK
OBJECTID
1
IMCONNECTION IMCONNECTION_PK
OBJECTID
1
IMCONNECTION IMCONNECTION_RES
RESERVATIONID
1
IMCONNECTION IMCONNECTION_RES
RESERVATIONID
1
IMCONNECTION IMCONNECTION_ST
RESOURCESTATE
1
IMCONNECTION IMCONNECTION_ST
RESOURCESTATE
1
IMCONNECTION IMCONNECTION_TYPEID
TYPEID
1
IMCONNECTION IMCONNECTION_TYPEID
TYPEID
1
IMCONNECTION IMCONNECTION_UR
USERSESSIONID
1
IMCONNECTION IMCONNECTION_UR
USERSESSIONID
1
IMCONNECTION IMCONNECTION_VK
VISUALKEY
1
IMCONNECTION IMCONNECTION_VK
VISUALKEY
1
IMCONNECTION IMCONNECTION_Z_NE
ZNETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_Z_NE
ZNETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_Z_PORT
ZPORTID
1
IMCONNECTION IMCONNECTION_Z_PORT
ZPORTID
1
IMCONNECTION IMCONNECTION_Z_SITE
ZSITEID
1
IMCONNECTION IMCONNECTION_Z_SITE
ZSITEID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON
CONNECTIONID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON
CONNECTIONID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK
OBJECTID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK
OBJECTID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST
ASSIGNMENTSTATE
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST
ASSIGNMENTSTATE
1
IMTERMINATION IMTERMINATION_ID
TERMINATEDID
1
IMTERMINATION IMTERMINATION_ID
TERMINATEDID
1
IMTERMINATION IMTERMINATION_NE
NETWORKELEMENTID
1
IMTERMINATION IMTERMINATION_NE
NETWORKELEMENTID
1
IMTERMINATION IMTERMINATION_PORT
PORTID
1
IMTERMINATION IMTERMINATION_PORT
PORTID
1
IMTERMINATION IMTERMINATION_SITE
SITEID
1
IMTERMINATION IMTERMINATION_SITE
SITEID
1
40 rows selected.
Plan without sql hints:
SQL> select * from table(dbms_xplan.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2493901029
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 40 | 9960 | 6316 (1)| 00:01:16 |
| 1 | NESTED LOOPS | | 40 | 9960 | 6316 (1)| 00:01:16 |
| 2 | NESTED LOOPS | | 1359 | 160K| 3592 (1)| 00:00:44 |
| 3 | TABLE ACCESS BY INDEX ROWID| IMTERMINATION | 1359 | 16308 | 915 (1)| 00:00:11 |
|* 4 | INDEX RANGE SCAN | IMTERMINATION_NE | 1359 | | 6 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| IMCONNECTIONDESIGN | 1 | 109 | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | IMCONNECTIONDESIGN_PK | 1 | | 1 (0)| 00:00:01 |
|* 7 | TABLE ACCESS BY INDEX ROWID | IMCONNECTION | 1 | 128 | 2 (0)| 00:00:01 |
|* 8 | INDEX UNIQUE SCAN | IMCONNECTION_PK | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("T1"."NETWORKELEMENTID"=9200150)
5 - filter("CD"."ASSIGNMENTSTATE"=2 OR "CD"."ASSIGNMENTSTATE"=3)
6 - access("CD"."OBJECTID"="TERMINATEDID")
7 - filter((("C"."CONSUMEDSIGNALTYPE"=21 OR "C"."CONSUMEDSIGNALTYPE"=22 OR
"C"."CONSUMEDSIGNALTYPE"=23 OR "C"."CONSUMEDSIGNALTYPE"=24 OR "C"."CONSUMEDSIGNALTYPE"=25 OR
"C"."CONSUMEDSIGNALTYPE"=26 OR "C"."CONSUMEDSIGNALTYPE"=27 OR "C"."CONSUMEDSIGNALTYPE"=28 OR
"C"."CONSUMEDSIGNALTYPE"=29 OR "C"."CONSUMEDSIGNALTYPE"=30 OR "C"."CONSUMEDSIGNALTYPE"=31 OR
"C"."CONSUMEDSIGNALTYPE"=32 OR "C"."CONSUMEDSIGNALTYPE"=33) OR ("C"."SIGNALTYPE"=21 OR
"C"."SIGNALTYPE"=22 OR "C"."SIGNALTYPE"=23 OR "C"."SIGNALTYPE"=24 OR "C"."SIGNALTYPE"=25 OR
"C"."SIGNALTYPE"=26 OR "C"."SIGNALTYPE"=27 OR "C"."SIGNALTYPE"=28 OR "C"."SIGNALTYPE"=29 OR
"C"."SIGNALTYPE"=30 OR "C"."SIGNALTYPE"=31 OR "C"."SIGNALTYPE"=32 OR "C"."SIGNALTYPE"=33)) AND
"C"."TYPEID"='$131')
8 - access("C"."OBJECTID"="CD"."CONNECTIONID")
32 rows selected. -
Using Oracle Hints in Selects......
Hello,
Are there any after effects/side effects by using Oracle Hints in a SQL select ??? (hints such as Cache, NOCache, all_rows)
Can anyone let me know whether there are any good documentation or site on Oracel SQL hints..
thanks
KanchiHi!
There is an exception, that I think is a bug in Oracle, but I4m not sure. If you use the PARALLEL HINT in a select that will be use in a Cursor, in order to insert the results in other table, and the results come in groups built following a group by sentence, there are possibilities that two childs (a child is a parallel process) take portions of this whole group, and built each one one group.
If the new table use certain number of columns as a primary key, this may cause an duplicated primary key trigger.
I4m going to write and document this case, in order to show it to oracle support.
I hope this help. Bye.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by kanchana Hettiarachchi ([email protected]):
Hello,
Are there any after effects/side effects by using Oracle Hints in a SQL select ??? (hints such as Cache, NOCache, all_rows)
Can anyone let me know whether there are any good documentation or site on Oracel SQL hints..
thanks
Kanchi<HR></BLOCKQUOTE>
null -
While trying to connect to Oracle database 11g from SQL developer (Error)
Hi Guys,
Installed OIM in virtual machine with Windows 2008 and when trying to connect to Database after completing installation receiving with Error ' No more data to read from socket'
Vendor code : 17410. can anybody give suggestion on this.
thanks
sri485.yes i tried connecting DB directly its working fine and i tried select * from DUAL it displays 2 . VMware with OIM working fine in my system and when i copied the same VMWARE file to other system and i tried running OIM and connecting to DB it not working.
log trace:
<Aug 21, 2012 2:28:56 PM BST> <Warning> <DeploymentService> <BEA-290014> <Inval
d user name or password.>
<Aug 21, 2012 2:28:58 PM BST> <Error> <OIM Authenticator> <BEA-000000> <Error s
tting SQL Hint java.sql.SQLException: Unable to start the Universal Connection
ool: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in
Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPoolExce
tion: Error during pool creation in Universal Connection Pool Manager: oracle.u
p.UniversalConnectionPoolException: Universal Connection Pool already exists in
the Universal Connection Pool Manager. Universal Connection Pool cannot be adde
to the Universal Connection Pool Manager>
java.sql.SQLException: Unable to start the Universal Connection Pool: oracle.uc
.UniversalConnectionPoolException: Error during pool creation in Universal Conn
ction Pool Manager MBean: oracle.ucp.UniversalConnectionPoolException: Error du
ing pool creation in Universal Connection Pool Manager: oracle.ucp.UniversalCon
ectionPoolException: Universal Connection Pool already exists in the Universal
onnection Pool Manager. Universal Connection Pool cannot be added to the Univer
al Connection Pool Manager
at oracle.ucp.util.UCPErrorHandler.newSQLException(UCPErrorHandler.java
488)
at oracle.ucp.util.UCPErrorHandler.throwSQLException(UCPErrorHandler.ja
a:163)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java
651)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.
ava:890)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.
ava:857)
at oracle.ucp.jdbc.PoolDataSourceImpl.getConnection(PoolDataSourceImpl.
ava:851)
at oracle.iam.platform.auth.impl.DBStore.getConnection(DBStore.java:130
at oracle.iam.platform.auth.impl.DBStore.setSQLHint(DBStore.java:107)
at oracle.iam.platform.auth.impl.DBStore.<init>(DBStore.java:62)
at oracle.iam.platform.auth.impl.DBStore.getInstance(DBStore.java:83)
at oracle.iam.platform.auth.impl.Authenticator.<init>(Authenticator.jav
:87)
at oracle.iam.platform.auth.impl.Authenticator.getInstance(Authenticato
.java:71)
at oracle.iam.platform.auth.providers.wls.OIMAuthLoginModule.login(OIMA
thLoginModule.java:43)
at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(Lo
inModuleWrapper.java:110)
at java.security.AccessController.doPrivileged(Native Method)
at com.bea.common.security.internal.service.LoginModuleWrapper.login(Lo
inModuleWrapper.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:
86)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:
80)
at javax.security.auth.login.LoginContext.login(LoginContext.java:579)
at com.bea.common.security.internal.service.JAASLoginServiceImpl.login(
AASLoginServiceImpl.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHand
er.invoke(Delegator.java:57)
at $Proxy25.login(Unknown Source)
at weblogic.security.service.internal.WLSJAASLoginServiceImpl$ServiceIm
l.login(WLSJAASLoginServiceImpl.java:89)
at com.bea.common.security.internal.service.JAASAuthenticationServiceIm
l.authenticate(JAASAuthenticationServiceImpl.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.common.security.internal.utils.Delegator$ProxyInvocationHand
er.invoke(Delegator.java:57)
at $Proxy43.authenticate(Unknown Source)
at weblogic.security.service.WLSJAASAuthenticationServiceWrapper.authen
icate(WLSJAASAuthenticationServiceWrapper.java:40)
at weblogic.security.service.PrincipalAuthenticator.authenticate(Princi
alAuthenticator.java:348)
at weblogic.security.service.PrincipalAuthenticator.authenticate(Princi
alAuthenticator.java:355)
at weblogic.management.servlet.BootstrapServlet$1.run(BootstrapServlet.
ava:169)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticat
dSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java
146)
at weblogic.management.servlet.BootstrapServlet.processGet(BootstrapSer
let.java:119)
at weblogic.management.servlet.BootstrapServlet.doGet(BootstrapServlet.
ava:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.ru
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecur
tyHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.ja
a:300)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.ja
a:183)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
n.wrapRun(WebAppServletContext.java:3717)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
n.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticat
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java
120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebApp
ervletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServlet
ontext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.
ava:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: oracle.ucp.UniversalConnectionPoolException: Error during pool creat
on in Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPo
lException: Error during pool creation in Universal Connection Pool Manager: or
cle.ucp.UniversalConnectionPoolException: Universal Connection Pool already exi
ts in the Universal Connection Pool Manager. Universal Connection Pool cannot b
added to the Universal Connection Pool Manager
at oracle.ucp.util.UCPErrorHandler.newUniversalConnectionPoolException(
CPErrorHandler.java:368)
at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolExceptio
(UCPErrorHandler.java:49)
at oracle.ucp.util.UCPErrorHandler.throwUniversalConnectionPoolExceptio
(UCPErrorHandler.java:80)
at oracle.ucp.admin.UniversalConnectionPoolManagerMBeanImpl.createConne
tionPool(UniversalConnectionPoolManagerMBeanImpl.java:316)
at oracle.ucp.jdbc.PoolDataSourceImpl.startPool(PoolDataSourceImpl.java
625)
... 61 more
<Aug 21, 2012 2:28:58 PM BST> <Error> <Configuration Management> <BEA-150035> <
n attempt was made to download the configuration for the server oim_server1 by
he user iamamin with an invalid password.>
thanks
sri485 -
Is it possible to add an optimizer hint to a dimension or cube mapping?
OLAP Analytic Workspace 11.2.0.4.0
Oracle OLAP API 11.2.0.4.0
OLAP Catalog 11.2.0.4.0
AWM 11.2.0.4.0BI would like to better understand what you are trying to optimize with a hint on a dimension or cube mapping?
Could you provide a use-case of a specific hint that you think would help performance of a
dimension or cube load. The mapping of a dimension or cube is for loading data from a relational source
i.e. table or view into the OLAP dimension or cube. The OLAP option has highly optimized load SQL for
reading in the dimension or cube data. The SQL that is generated is done in such a way as to maximize the
overall efficiency of getting the OLAP dimension and cube completely built and solved. As you know, the
internal OLAP dimension and cube data structures are somewhat complex and need to be built in a
highly performant manner.
Again, I am curious on what your thoughts are about injecting a SQL hint on a mapping to improve the load
performance and solve performance of a build.
Here is an example of a dimension load SQL query. You can look at the build log information to get all this detail.
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T9."SHIP_TO_ID", TO_CHAR(('SHIP_TO_' || T9."SHIP_TO_ID") ) , NULL) ) ALIAS_1
FROM
GLOBAL."CUSTOMER_DIM" T9
WHERE
(T9."SHIP_TO_ID" IS NOT NULL)
UNION
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T10."WAREHOUSE_ID", TO_CHAR(('WAREHOUSE_' || T10."WAREHOUSE_ID") ) , NULL) ) ALIAS_2
FROM
GLOBAL."CUSTOMER_DIM" T10
WHERE
(T10."WAREHOUSE_ID" IS NOT NULL)
UNION
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T11."ACCOUNT_ID", TO_CHAR(('ACCOUNT_' || T11."ACCOUNT_ID") ) , NULL) ) ALIAS_3
FROM
GLOBAL."CUSTOMER_DIM" T11
WHERE
(T11."ACCOUNT_ID" IS NOT NULL)
UNION
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T12."REGION_ID", TO_CHAR(('REGION_' || T12."REGION_ID") ) , NULL) ) ALIAS_4
FROM
GLOBAL."CUSTOMER_DIM" T12
WHERE
(T12."REGION_ID" IS NOT NULL)
UNION
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T13."MARKET_SEGMENT_ID", TO_CHAR(('MARKET_SEGMENT_' || T13."MARKET_SEGMENT_ID") ) , NULL) ) ALIAS_5
FROM
GLOBAL."CUSTOMER_DIM" T13
WHERE
(T13."MARKET_SEGMENT_ID" IS NOT NULL)
UNION
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T14."TOTAL_CUSTOMER_ID", TO_CHAR(('TOTAL_CUSTOMER_' || T14."TOTAL_CUSTOMER_ID") ) , NULL) ) ALIAS_6
FROM
GLOBAL."CUSTOMER_DIM" T14
WHERE
(T14."TOTAL_CUSTOMER_ID" IS NOT NULL)
UNION
SELECT DISTINCT /*+ bypass_recursive_check */
RTRIM(NVL2(T15."TOTAL_MARKET_ID", TO_CHAR(('TOTAL_MARKET_' || T15."TOTAL_MARKET_ID") ) , NULL) ) ALIAS_7
FROM
GLOBAL."CUSTOMER_DIM" T15
WHERE
(T15."TOTAL_MARKET_ID" IS NOT NULL)
ORDER BY
1 ASC NULLS LAST -
Hello,
Can someone help me transform this SQL query into a TopLink Expression :
select attri1Tab1, attri2Tab1 from tab1
where attri1 like '45%'
and tab1Id1 in
(select tab2Id1 from tab2
where attri1Tab2 ='1');
--> where tab2Id1 is the foreign key to tab1Id1.
One of my problems is that I have two Java Client classes for the two tables, and in the :
vector objects = session.readAllObjects(jsftoplink.model.tab1.class, complex)
(in one Java Client class)
I can only call one class.
Thank you.
ChrisHi Dave,
The following is what you need to do to get the actual SQL that TopLink will send (regardless of query type, binding or no binding), and then modify it:
request.prepareCall((oracle.toplink.publicinterface.Session)session, request.rowFromArguments(vectorOfQueryArgs));
SQLCall call = request.getCall();
String sql = call.getSQLString();
call.setSQLString(sql + " " + HINT);
The vectorOfQueryArgs is the collection of arguments needed to execute the query - this can be an empty Vector if the query doesn't take any. Since the query has been prepared already, SQL string changes can be set on the SQLCall itself to save TopLink having to create a new SQLCall object and parse the string.
Best Regards,
Chris Delahunt -
List of Hints and there usage?????
Can anybody give me the link/doc having the sql hints in oracle 9i or 10g
and having a good description on there usage.
Regards
GaganAgree with you John - especially on the DRIVING_SITE hint.
But I still feel the message itself needs to be strong. Nothing as frustrating as having developers releasing code that for example forces a PQ degree of 20 simply because that was the first number that sprung to mind. Or forcing an global index (indexes is good) as they did not like the CBO doing a FTS on the partition (FTS is bad). Etc.
Sometimes I even get a mix of nonsense hints like forcing an index range scan and trying to force a PQ too - when asked the answer is along the lines of "oh, it is faster in parallel". Tuning by observation. "Oh, look, it is faster the 2nd time around! PQ works great!!" And not even considering that there are now less PIOs due to the db cache.
It becomes real messy trying to fix. What frustrates me is that such developers usually have Oracle in low regard and see hints as a necessity to force it to behave correctly. And they have the tendency to complain loudly very quickly when it does not work how they expect it to work and blame Oracle as a poor product. If they spend that energy and effort instead of learning Oracle concepts and fundamentals... sigh -
Migrating from MSAccess to SQL Server
I have a JSP web application with MS access as the backend . We are in the process of migrating it to a database server . The two options availabel are SQl server 2000 or Postgres SQL .I want to know which option will be the more suitable one . Also if SQL server is used , will the development effort required will be less or more and also wnat to know what could be the changes required in case SQL server is used.
I am a newbie to JSP world.Paul Chafin wrote:>
> We are migrating an SAP landscape from HP-UX / Oracle to Windows / SQL Server. We have numerous custom programs with OPEN SQL Hint statements of the form:
> Question: What is the best way to make these SQL statements compatible with SQL Server?
Hi Paul,
as hints are highly database specific it may well be that you won't need them for your new DBMS anymore.
In any case you've to review them one-by-one to check the execution plan of the queries without a hint.
A general "migration of hints" is neither possible nor sensible.
regards,
Lars
Maybe you are looking for
-
Please help me
-
Usertable error after adding a udf
I have a UI add-on that assigns values to a UDT by usertable object of the DI API, the problem is generated after adding a UDF from SAP menu and try to assign a value from the DI. The error is Invalida Field Name My question is, is necessary to wai
-
Apache+tomcat+env vars ..?
I know this should proabably be posted in a tomcat-related forum, but it's worth a shot. I'm using apache 2.0.43, and tomcat 4.1.12, linked togeather with mod_jk on a linux-machine (redhat 8.0), and everything works just fine .. except for one thing.
-
Hello, I am building a form with drop down boxes. These are ued to answer questions with Yes, No and N/A. I would like the end user to be able to tab to the next drop down and type either a number or a letter as a shortcut to fill out the boxes (vs.
-
About WLC 5508 version 6.0 upgrade to 7.0 issue
hi guys, I have tow WLC , version is 6.0 One of the WLC successful upgrade and after rebooting the normal the another WLC successful too , but after rebooting the system version or 6.0 Thanks in advance