/*+ bypass_ujvc*/
please can anybody help if I use hint r /*+ bypass_ujvc*/ in update statement , will it be benificial?
what is purpose ? is it relevent in oracle 10g.
Check this link for information about the mentioned hint.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1197999096334
Remember this is an undocumented hint. There is no guarantee it is going to work. It will work in this version but it may choose not to work in the future release. I wouldn't be using this hint in my production code. If you want to learn by all means play around but be wary about if you are thinking of implementing it in your production database.
Regards
Raj
Similar Messages
-
Hintless alternative around BYPASS_UJVC
Hi,
please consider folowing situation:
staging table, indexed on partition.
in partition 0, there are ONLY update records for big_table.
big table has an index on the main key but I know there will be no violations.
so as to work around ORA-01779, I have used the hint BYPASS_UJVC.
This has proven to work flawlessly in the past - HOWEVER...
I now use a different approach and the ETL tool does not allow to use hints :S
so the question is...
how do we do a bulk update on big_table using ALL records in partition 0 of small_table,
without hints?
and as alternative to:
update /*+ BYPASS_UJVC */
select
nw.code_imei as a_n,
nw.time_utc as b_n,
nw.code_imsi as c_n,
nw.id_source as d_n,
nw.id_service_provider as e_n,
nw.id_customer_segment as f_n,
ol.code_imei as a_o,
ol.time_utc as b_o,
ol.code_imsi as c_o,
ol.id_source as d_o,
ol.id_service_provider as e_o,
ol.id_customer_segment as f_o
from
SGM$TA_F_IMEI_CHANGE ol,
SGM$TA_P_IMEI_CHANGE_CMP nw
where nw.ID_PARTITION = 0
and nw.code_msisdn = ol.code_msisdn
set
a_o = a_n,
b_o = b_n,
c_o = c_n,
d_o = d_n,
e_o = e_n,
f_o = f_n
THANK YOU....
(ps sql only...)Arrggghhh, just lost the response I typed twice - edit window cleared when I hit an unspecified random hot key combination, and text vanished when I had to log in after clicking Post Message!
Are you on 10g? If so consider advanced query rewrite. Its dangerous if used improperly but could solve your problem by executing a different query when the query text you specify is encountered. It should work best with static query text, executing another query as a substition (sort of like DECODE using an entire query instead of a single value).
Aside from that I can't think of a way to avoid the bypass_ujvc hint except to find an entirely different way to perform the update. -
Use of Select stmts with Update stmts
Hi,
I want to execute the following update stmt...
UPDATE Test1_tab a
SET a.invpln_seq_no = (SELECT b.seq_no
FROM Test2_tab b
WHERE b.contract_id = a.contract_id
AND b.date_from = a.period_from_date)
WHERE a.invpln_seq_no != (SELECT b.seq_no
FROM Test2_tab b
WHERE b.contract_id = a.contract_id
AND b.date_from = a.period_from_date)
Here the problem is I have used 'SELECT b.seq_no FROM Test2_tab b WHERE b.contract_id = a.contract_id AND b.date_from = a.period_from_date' twice, one in the SET clause and the other one in WHERE clause...But it is the same SELECT stmt...So this same Select stmt runs twice when I run the whole update stmt I guess. Is there a way to do the above update, where it runs the SELECT stmt only once...
Any input is highly appreciated...
Thanks And Best Regards,
/Dinesh...Then you can use Merge statement instead.
try this
merge into test1_tab t1
using
(SELECT a.rowid,b.seq_no SEQ_DEST
FROM test1_tab a,test2_tab b
WHERE b.contract_id = a.contract_id
AND b.date_from = a.period_from_date
AND a.invpln_seq_no != b.seq_no) t2
ON (t1.rowid=t2.rowid)
WHEN MATCHED THEN
UPDATE SET t1.invpln_seq_no=t2.seq_destor if you are sure that sno is a unique key with out any duplicates and if you are going to perform one time manual update then you can use an undocumented hint /*+ bypass_ujvc */ to do this.
*DO NOT include this code if you are about to add it in a production procedure or a function
UPDATE /*+ bypass_ujvc */ (SELECT a.invpln_seq_no SEQ_SRC,b.seq_no SEQ_DEST FROM test1_tab a,test2_tab b
WHERE b.contract_id = a.contract_id
AND b.date_from = a.period_from_date
AND a.invpln_seq_no != b.seq_no)
SET SEQ_SRC = SEQ_DESTRegards,
Prazy -
Hi All
I have three setups on which i have to run same query which is mentioned below. The execution plan on all three setups is same for the mentioned query. Still in one of the setup the query is taking almost 8 Hrs to complete. while in rest 2 setups it takes 2 Hrs to complete. The Ram Available for the setup is Same(16 GB). I tried to increase yhe SGA size but not got the expected results. i do not have DBA support for the same. I have also analysed and changed the parameter Index_OPtimizer_cost and made sure vthat this parameter is same for all three setups.
The main problem is i can not modify the query as it is been generated during on the processes. But as mentioned earlier the query generated on all three setup is same. I also changed log_buffer_size. The query is :
UPDATE /*+ BYPASS_UJVC */ ( SELECT Main Table_name.n_exp_covered_amt_irb AS T0 , CASE WHEN COND0 = 0 THEN BP0 ELSE BP1 END AS T1 FROM Global temp table , Main Table Name WHERE Main Table Name.n_gaap_skey=Gloabl Temp table.n_gaap_skey AND Main Table Name.n_run_skey=Gloabl Temp table.n_run_skey AND Main Table Name.n_acct_skey=Gloabl Temp table.n_acct_skey AND Main Table Name.fic_mis_date=Gloabl Temp table.fic_mis_date) SET T0 = T1
Indexes are same on the All three setups also one index is present for the column name mentioned in the where clause of the query.
The oracle version used is 10.0.1.0 in first setup in second setup i am using 10.0.2.0 and in third setup it's 10.0.4.0. The query is taking time where 10.0.2.0 version is installed.
When i have looked in to the session while the query e=was executing SORT OUTPUT was taking most of the time.
Thanks in Advance. It's very critical for me to get it resolved.Any suggestions are extremely welcome.Hi,
please check the indexes on the colums of table where sort is happening. if indexes are not there then create it or rebuilt it. also the sql tuning advisor
recommendation in dbconsole.
thanks -
Hello everybody!
I don't know what does this DELETE instruction:
DELETE /*+ BYPASS_UJVC */FROM (SELECT a.ROWID
FROM TABLE1 a,
TABLE2 b,
TABLE3 c,
TABLE4 d
WHERE a.id_sipm = b.id_sipm
AND b.id_sitr_pefe = c.id_sitr_pefe
AND c.id_dece_400 = d.id_dece_400
AND d.cod_dece_tica = 'MI') e;
Delete rows ONLY from TABLE1?
Delete rows from all tables joined?
Wich is the use of this DELETE?
And the /*+ BYPASS_UJVC */ hint?
Thanks for advanced.Hoek:
Interesting demonstration, but the OP needs to check a couple of things first before deciding which table will be deleted.
Same setup as yours (thanks for the scripts) but I added:
SQL> alter table table2 add constraint t2_pk primary key (col);
Table altered.
SQL> alter table table3 add constraint t3_pk primary key (col);
Table altered.
SQL> delete
2 from (select z.rowid
3 from table1 z, table2 a, table3 b
4 where a.col = z.col and
5 a.col = b.col);
5 rows deleted.
SQL> select * from table1;
no rows selected
SQL> select * from table2;
COL
1
2
3
4
5
SQL> select * from table3;
COL
1
2
3
4
5So, it deletes the non-key preserved table. I get the same result with and without the hint.
When I add a PK to table1, so now all three have PKs I get:
SQL> delete
2 from (select z.rowid
3 from table1 z, table2 a, table3 b
4 where a.col = z.col and
5 a.col = b.col);
5 rows deleted.
SQL> select * from table1;
no rows selected
SQL> select * from table2;
COL
1
2
3
4
5
SQL> select * from table3;
COL
1
2
3
4
5Again, the hint does not change the result. If I then drop the PK on table2, I get table2 deleted both with and without the hint.
So, it appears that if the query would succeed without the hint, it will delete the non-key preserved table if there is one and if not it will delete the first one mentioned with ot without the hint. If the query requires the hint to succeed, it will delete the last table mentioned, even if that is key preserved. I ran this up to 5 tables and the pattern seemed to hold. I also played around with the join orders and got the same results.
In an attempt to influence the behaviour, I attempted to use the selected rowid as a predicate to influence the table deleted. In the key preserved case table1 and table2 had PKs table3 did not. Without a predicate, table3 was deleted when I tried this delete, I was surprised to see the result.
SQL> delete
2 from ( select z.rowid rd
3 from table1 z, table2 a, table3 b
4 where z.col = a.col and
5 z.col = b.col)
6 where rowid = rd;
0 rows deleted.I got the same result trying with a.rowid but using b.rowid in the select deleted 5 rows in table3
After dropping the PKs on table1 and table2 and trying the same thing with the hint I got:
SQL> delete /*+ bypass_ujvc */
2 from ( select z.rowid rd
3 from table1 z, table2 a, table3 b
4 where z.col = a.col and
5 z.col = b.col)
6 where rowid = rd;
from table1 z, table2 a, table3 b
ERROR at line 3:
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved tableattempting to select any of the rowid values.
John
Edited by: John Spencer on Oct 30, 2010 1:32 PM
That's what I get for testing additional things while in the middle of posting, Hoek beat me to the keyed version :-( -
How to update this data ... ?
Hi all,
I got the following query output :-
opn_____qty
1000____
1220____
1400____
1500____2100
1600____
1800____2300
2000____2600
2100____
2600____3000
now, I will write query to update those blank qty with the next opn with qty. which mean I will like the output of this :-
opn_____qty
1000____2100
1220____2100
1400____2100
1500____2100
1600____2300
1800____2300
2000____2600
2100____3000
2600____3000
How should I do this ?
Rgds
LimAgreed, as stated LAST_VALUE IGNORE NULLs plus optional INSERT and UPDATE WHERE clauses on MERGE are 10g features.
Nevertheless the fact remains that you are updating 9 rows when you should only be updating 5 which should be regarded as inefficient.
In 9i you could easily add a predicate to the USING clause to only return rows where original qty was NULL, e.g.
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
JServer Release 9.2.0.6.0 - Production
SQL> MERGE INTO t USING (
2 SELECT opn, new_qty
3 FROM (SELECT opn, qty, MAX (qty) OVER (
4 PARTITION BY grp) new_qty
5 FROM (SELECT t.*, SUM (qty / qty) OVER (
6 ORDER BY opn DESC) grp
7 FROM t))
8 WHERE qty IS NULL) s
9 ON (t.opn = s.opn)
10 WHEN MATCHED THEN
11 UPDATE
12 SET t.qty = s.new_qty
13 WHEN NOT MATCHED THEN
14 INSERT (opn) VALUES (0);
5 rows merged.
SQL> SELECT *
2 FROM t;
OPN QTY
1000 2100
1220 2100
1400 2100
1500 2100
1600 2300
1800 2300
2000 2600
2100 3000
2600 3000
9 rows selected.
SQL> Incidentally a relatively efficient straight SQL solution also exists for 8i by way of the semi-documented /*+ BYPASS_UJVC */ hint, e.g.
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
SQL> UPDATE /*+ BYPASS_UJVC */ (
2 SELECT t.qty, s.qty new_qty
3 FROM (SELECT opn, MAX (qty) OVER (
4 PARTITION BY grp) qty
5 FROM (SELECT t.*, SUM (qty / qty) OVER (
6 ORDER BY opn DESC) grp
7 FROM t)) s, t
8 WHERE s.opn = t.opn
9 AND t.qty IS NULL)
10 SET qty = new_qty;
5 rows updated.
SQL> SELECT *
2 FROM t;
OPN QTY
1000 2100
1220 2100
1400 2100
1500 2100
1600 2300
1800 2300
2000 2600
2100 3000
2600 3000
9 rows selected.
SQL> -
hI Everyone,
if we have round (10000000) records in a table and same number of records in another table and we want to update an attribute in this table. it takes sometime round 24 hours or even more, while both tables are indexed. Do anyone knows any magic to improve the efficiency. I have used these two queries as i have posted this query before as well but i want some magic more efficient, any help will be greatly appreciated.
Query 1
Update temp a set a.idx = (select b.idx from try b where a.headin=b.heading
and a.sub_heading = b.sub_heading and a.sid=b.sid)
where exists (select null from try c where a.headin=c.heading
and a.sub_heading = c.sub_heading and a.sid=c.sid)
Query 2
UPDATE /*+ BYPASS_UJVC*/
select a.idx old_idx, b.idx new_idx
from temp a, try b
where a.headin=b.heading
and a.sub_heading = b.sub_heading
and a.sid=b.sid
SET old_idx = new_idx
best regards,If you are updating every row (which means there is a match in the lookup table for every row in the table being updated), why do you have the EXISTS clause?
"approx all the columns are indexed" - this doesn't really tell us anything. It looks like you need one composite index based on all three of the columns.
Again, what are the exact indexes in place on the lookup table and what is the execution plan? These are the details you need to provide in order to receive any assistance with a question like this. -
Hi Masters,
What are the hints which are depreciated in oralce 11g e.g bypass_ujvc ?
Though I know this hint is undocumented, Is there any document/url in which I can get all these.
Any help will be highly appreciated.
RegardsIt exists in 11g onwards.
SQL> desc v$sql_hint
Name Null? Type
NAME VARCHAR2(64)
SQL_FEATURE VARCHAR2(64)
CLASS VARCHAR2(64)
INVERSE VARCHAR2(64)
TARGET_LEVEL NUMBER
PROPERTY NUMBER
VERSION VARCHAR2(25)
VERSION_OUTLINE VARCHAR2(25)
SQL> The view itself is not documented but nevertheless it is useful.
It doesn't tell you what is documented, what is undocumented, what is deprecated, not supported, etc.
It doesn't tell you the full syntax for a particular hint.
It does tell you what sql feature it relates to, gives a class and usefully the inverse of the hint.
It also tells you what version the hint was introduced in and version_outline is believed to indicate from which version the hint can be used in an outline.
There's no doubt that it's useful for the inquisitive.
You'll find that the hint PARALLEL is not listed but the hint SHARED is and SHARED is the inverse of NOPARALLEL/NO_PARALLEL, for example.
However SHARED is not documented, PARALLEL is.
The bottom line is that hints should be discouraged, particularly undocumented ones, the documented ones appearing in the documentation for the appropriate version, e.g. [url http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements006.htm#autoId3]11gR2 SQL Language Reference. -
Strange delete...
Hello everybody!
I don't know what does this DELETE instruction:
DELETE /*+ BYPASS_UJVC */FROM (SELECT a.ROWID
FROM TABLE1 a,
TABLE2 b,
TABLE3 c,
TABLE4 d
WHERE a.id_sipm = b.id_sipm
AND b.id_sitr_pefe = c.id_sitr_pefe
AND c.id_dece_400 = d.id_dece_400
AND d.cod_dece_tica = 'MI') e;
Delete rows ONLY from TABLE1?
Delete rows from all tables joined?
Wich is the use of this DELETE?
And the /*+ BYPASS_UJVC */ hint?
Thanks for advanced.
Edited by: pacoKAS on 29-oct-2010 11:35Sorry!!!
This is not the forum for this question!!!
I'm sorry again... -
Hi,
Please suggest the workarounds for replacing /*+ bypass_ujvc*/ hint in oracle 11g.
Thanks & Rgdsuser13325846 wrote:
Yes I understand this, I will not select the extra columns.
But is there any way to achieve this without creating primary key?Yes. The update simply needs to have a "proper" row to update - and can identify the row to update uniquely via the physical row identifier (address of row on disk).
For example - table dept2 is a copy of table dept, but does not contain any primary key or unique constraints.
SQL> create table dept2 nologging as select * from dept;
Table created.
SQL>
SQL> select * from dept2;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> update(
2 select
3 d.dname
4 from dept2 d
5 where d.deptno in(
6 select distinct
7 e.deptno
8 from emp e
9 where e.job = 'SALESMAN'
10 )
11 )
12 set dname = 'WEASELS';
1 row updated.
SQL>
SQL> select * from dept2;
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 WEASELS CHICAGO
40 OPERATIONS BOSTON
SQL> -
Update multiple rows involving spatial data
Hi,
i have 2 table, that are
temp
store_id
store_state
geom mdsys.sdo_geometry
us_states
state
geom mdsys.sdo_geometry
i have indexed both table with spatial index.
If i wanna find state that temp.geom is inside us_states.geom using
SQL> select state from us_states, temp
where sdo_inside(temp.geom, us_states.geom) = 'TRUE';
it's work
but if i wanna update temp.store_state using
SQL> update temp set store_state = (select state from us_states
where sdo_inside(temp.geom, us_states.geom) = 'TRUE');
it gives this error
update temp set store_state = (select state from us_states where sdo_inside(temp.geom, us_states.geom) = 'TRUE')
ERROR at line 1:
ORA-13226: interface not supported without a spatial index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 8
ORA-06512: at "MDSYS.SDO_3GL", line 62
ORA-06512: at "MDSYS.SDO_3GL", line 192
any idea how can i update multiple rows that involving spatial data?
Thanks
HadiHadi,
There are a number of things wrong with the second item. First up you most likely will return more than one row, which is not allowed as the = expects only one item.
Here is what I would use, which will update everything that meets the requirements, and ignore the rest:
UPDATE (
SELECT /*+ bypass_ujvc */
state, store_id, store_state
FROM temp, us_states
WHERE sdo_inside(temp.geom, us_states.geom) = 'TRUE')
SET store_state = state;
With the /*+ bypass_ujvc */ you're telling the db to not worry about requiring a "unique join view condition" -- which roughly mean "trust me, my rows are key preserved." This is important since there is really no "hard" key-based relationship to tie the two together.
However, unless you really think there are stores that border on two states, this will run much quicker with an anyinteract comparison.
Bryan -
Updating multiple fields using a single update statement.
Hi All,
I am a beginner to Oracle. I have used the following Hint in an update query that is executed in Oracle 10G. We recently updated the Oracle to version 11g and when executing the query getting the following Error: ORA-01779: cannot modify a column which maps to a non key-preserved table. PFB the query. Please suggest me some ways that I can do to avoid this error.
UPDATE /*+ bypass_ujvc */
(SELECT t1.STG_DEL_CONDITION, t2.condition
FROM stg_reports_membenft_latest T1 JOIN (select ods_ssn_grp,sys_id, first_value(STG_DEL_CONDITION) over(PARTITION BY ods_ssn_grp,sys_id
ORDER BY STG_DEL_CONDITION DESC) AS
condition from stg_reports_membenft_latest) T2
ON T1.ods_ssn_grp = T2.ods_ssn_grp AND T1.SYS_ID=T2.SYS_ID ) x
SET x.STG_DEL_CONDITION = x.condition;
Thanks and Regards,
Karthik Sivakumar.I used the below query and got the Result.
Thank You all
MERGE INTO stg_reports_membenft_latest x1
USING (SELECT distinct ods_ssn_grp,
sys_id,
First_value(STG_DEL_CONDITION) OVER(partition BY ods_ssn_grp,sys_id
ORDER BY STG_DEL_CONDITION DESC)
AS condition
FROM stg_reports_membenft_latest) x2
ON ( x1.ods_ssn_grp = x2.ods_ssn_grp
AND x1.SYS_ID = x2.sys_id )
WHEN matched THEN
UPDATE SET x1.STG_DEL_CONDITION=x2.condition;
Maybe you are looking for
-
SAP Report to find usage/transactions access per module
Hi, Is there any report/tool avialable in SAP to see how many transactions are being executed in a given period of time per MODULE. Actually management wants to see the details and asked me to provide the summarized report...(i believe they want to s
-
Never have i been this frustrated!!
hi everyone. i am new to iwork. i love it. until i get to the export phase. Now, i can use photoshop, ilife, final cut, but never have i been so confused as now using keynote! i made a short slideshow with music. i export to QT using sorenson3, audio
-
I try to load a show BLOB objects through a Servlet. When I retrieve a show the text objects it works fine but when I try to retrieve and show the image objects. The retrieved data is not valid. I've set the MIME header for: "response.setContentType(
-
Attempting to control Sony DFW-VL500 via IMAQ IEEE-1394 and LabView 7.0
I'm attempting to get images from a sony DFW-VL500 camera. I defined it as a device in MAX 3.0: the grab and snap functions seem to work. However, I cannot save video (only still images work). This is a non-issue since what I would like to program in
-
Installation LS failed. Corrupted Disk??
I tried to install Snow Leopard last week (upgrading), but with still 46 minutes to go.I got message to clean the disk and try again. Which I did several times. Same error. I tried via start holding "c" and starting up from installation disk, but aft