Parallel query in Oracle 11g
We use Oracle 11g DB on windows2008R2.
We wrote very long and heavy SELECT SQL query usign several table join and sub-queries and it take very long time to get result.
We did SQL statement tuning as much as we can do so far. ( I will get the Execution Plan and ADDM, etc access right)
I today notice about Parallel query function.
Where could I write parallel hint phrases in very long SELECT SQL query ?
In each selected tables like below ?
/sample in Oracle Doc/
SELECT /*+ PARALLEL(employees 4) PARALLEL(departments 4)
USE_HASH(employees) ORDERED */ MAX(salary), AVG(salary)
FROM employees, departments
WHERE employees.department_id = departments.department_id
GROUP BY employees.department_id;
You need to be careful with some of the examples in the docs. The example you quote includes an unnecessary join. Before considering parallel query, it should have been re-written to this:
SELECT MAX(salary), AVG(salary)
FROM employees
WHERE department_id is not null
GROUP BYdepartment_id;
Later versions of the CBO may do this re-write for you, but it is important to understand why the SQL is inefficient before throwing parallel servers at it. Are you sure that all your joins are actually necessary? (I know you are just going to say "yes", but you might want to think about it first.)
Similar Messages
-
Hi all,
Query executes for more 1.5 hours. fetches the data from a remote database. more than million records.
any suggestions to tune the query?
Explain Plan
CREATE TABLE STATEMENT ALL_ROWSCost: 3,777 Bytes: 1,161,660 Cardinality: 15,285
5 LOAD AS SELECT hcl_delta_TMP_2
4 NESTED LOOPS Cost: 3,768 Bytes: 1,161,660 Cardinality: 15,285
2 SORT UNIQUE Cost: 1 Bytes: 693 Cardinality: 99
1 INDEX FULL SCAN INDEX (UNIQUE) DELTA_REASON_CODES_PK Cost: 1 Bytes: 693 Cardinality: 99
3 REMOTE REMOTE SERIAL_FROM_REMOTE PSM_LIB_LOG_R RMDB Cost: 74 Bytes: 10,626 Cardinality: 154
Query:
CREATE TABLE hcl_delta_tmp_2 AS
SELECT
'hcl' AS heritage,
load_dt,
process_dt,
update_status_cd,
loan_number,
lib_date,
lib_time,
lib_code,
lib_user_id,
lib_log_key_date_time
FROM psm_lib_log_r@RMDB a
WHERE a.process_dt >= TO_DATE('01/01/2010','MM/DD/YYYY') AND
a.update_status_cd NOT IN( 'P' ) AND
a.lib_code IN
SELECT TRIM(delta_code) AS delta_code
FROM delta_reason_codes
Delta code column is a primary key in table delta_reason_codes: DELTA_REASON_CODES_PKVersion : Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
thanks.I think I am getting conflicting information about how many rows are in the remote table.
First we read that the remote table has more than 10 million records and then we read that applying this where clause WHERE a.process_dt >= TO_DATE('01/01/2010','MM/DD/YYYY')
AND a.update_status_cd NOT IN ('P') Results in that will be too many records, more than 10 millions.What are the total number of rows in the remote table?
How many rows match the date condition by itself?
How many match the status code condition by itself?
How many match the lib_code condition by itself?
How many rows match all conditions (the number returned by the query)?
Sorry, but I am just trying clear up any confusion here. -
Dear All,
i have a below create statement query in my Oracle Database - sql developer, when i tried this getting with the exception " 00907. 00000 - "missing right parenthesis"
CREATE TABLE FQ01_AA_FUTURE_INSTALLMENTS_M1 ( RECORD_ID VARCHAR (35),
mv_seq INT (4),
sv_seq INT (4),
PAY_TYPE VARCHAR (30),
PAY_PROP VARCHAR (30),
PAY_PROP_AMT FLOAT (30),
PAY_METHOD VARCHAR (30),
PAY_AMT FLOAT (30),
JB_DATE_IMPORT TIMESTAMP)
Is there any mistake on the above query, please update me....
Thanks
karthihi,
you can't determine digit for int
and I think you should replace float with number and varchar with varchar2
CREATE TABLE FQ01_AA_FUTURE_INSTALLMENTS_M1 ( RECORD_ID VARCHAR (35),
mv_seq number (4),
sv_seq number (4),
PAY_TYPE VARCHAR (30),
PAY_PROP VARCHAR (30),
PAY_PROP_AMT FLOAT (30),
PAY_METHOD VARCHAR (30),
PAY_AMT FLOAT (30),
JB_DATE_IMPORT TIMESTAMP)
Regards -
How to tune self join query in Oracle 11g
Oracle & SQL new to me,and I'm still in learning phase.
Could you please help me to tune below oracle query?? This table contains ~95 lac records and it takes 1 hour to retrieve data using this query.
Your suggestions/comments/help will be appreciated.
Thanks in advance.
SELECT A.CNO AS CNO, A.FNO AS FNO, A.CID AS CID, A.IID AS IID
FROM CAC_LKP A, (SELECT C_DATE, CNO, FNO
FROM (SELECT MAX(CAC_LKP.C_DATE) AS C_DATE, CAC_LKP.CNO AS CNO, CAC_LKP.FNO AS FNO
FROM CAC_LKP
WHERE ACTIVE = 'Y' GROUP BY CNO, FNO)) B
WHERE A.C_DATE = B.C_DATE
AND A.CNO = B.CNO
AND A.FNO = B.FNO
AND A.ACTIVE = 'Y'
Primary key is defied over combination of c_date,iid,active.
Edited by: 1009236 on Jun 1, 2013 12:52 AM>
SELECT A.CNO AS CNO,
A.FNO AS FNO,
A.CID AS CID,
A.IID AS IID
FROM CAC_LKP A,
SELECT C_DATE,
CNO,
FNO
FROM
SELECT MAX(CAC_LKP.C_DATE) AS C_DATE,
CAC_LKP.CNO AS CNO,
CAC_LKP.FNO AS FNO
FROM CAC_LKP
WHERE ACTIVE = 'Y'
GROUP BY CNO, FNO
) B
WHERE A.C_DATE = B.C_DATE AND
A.CNO = B.CNO AND
A.FNO = B.FNO AND
A.ACTIVE = 'Y';Hi,
Before even starting to see why there is a performance problem, I think you should consider the fact that there is logical problem in your WHERE clause. According to what you mentioned the primary key is composed of *(c_date, iid, active)* yet iid is absent in both the global query's WHERE clause and also that of the subquery.
Consequently the (aggregate) rows in the subquery will not be linked based on a correct logic to the external query.
Regards,
Dariyoosh -
Tune this "contains" query in Oracle 11g EE 11.2.0.3.0
I have a query like below. It runs for ever. The size of this table is not very big, it has around 30 millions rows. The owner column is very selective, and I've added "owner' column in the "filter by" clause of the domain index against description. Do you have any recommendation how I can tune this query? Any help would be greatly appreciated.
select count(*) from items s where contains(s.description, '%111%' ) > 0 and s.owner = 1234;
Thanks.You need to use SDATA to access the owner column through the index. You may also get better performance on your wildcard searches by using a wordlist with attributes as shown below. Please see the demonstration below.
SCOTT@orcl_11gR2> create table items as
2 select object_id as owner, object_name as description
3 from all_objects
4 /
Table created.
SCOTT@orcl_11gR2> insert into items values (1234, 'A111B')
2 /
1 row created.
SCOTT@orcl_11gR2> select count(*) from items
2 /
COUNT(*)
75048
1 row selected.
SCOTT@orcl_11gR2> begin
2 ctx_ddl.create_preference('mywordlist', 'BASIC_WORDLIST');
3 ctx_ddl.set_attribute('mywordlist','PREFIX_INDEX','TRUE');
4 ctx_ddl.set_attribute('mywordlist','PREFIX_MIN_LENGTH', 1);
5 ctx_ddl.set_attribute('mywordlist','SUBSTRING_INDEX', 'YES');
6 ctx_ddl.set_attribute('mywordlist', 'wildcard_maxterms', 50000) ;
7 end;
8 /
PL/SQL procedure successfully completed.
SCOTT@orcl_11gR2> create index items_idx
2 on items (description)
3 indextype is ctxsys.context
4 filter by owner
5 parameters ('wordlist mywordlist')
6 /
Index created.
SCOTT@orcl_11gR2> set autotrace on explain
SCOTT@orcl_11gR2> select count(*) from items
2 where contains (description, '%111% and (sdata (owner = 1234))') > 0
3 /
COUNT(*)
1
1 row selected.
Execution Plan
Plan hash value: 1238254566
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 29 | 12 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 29 | | |
|* 2 | DOMAIN INDEX | ITEMS_IDX | 39 | 1131 | 4 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("CTXSYS"."CONTAINS"("DESCRIPTION",'%111% and (sdata
(owner = 1234))')>0)
Note
- dynamic sampling used for this statement (level=2)
SCOTT@orcl_11gR2> -
Oracle 10g vs Oracle 11g query performance
Hi everyone,
We are moving from Oracle 10g to Oracle 11g database.
I have a query which in Oracle 1g takes 85 seconds to run, but when I run the same query in Oracle 11g database, it takes 635 seconds.
I have confirmed that all indexes on tables involved are enabled.
Does anyone have any pointers, what should I look into. I have compared explain plans and clearly they are different. Oracle 11g is taking a different approach than Oracle 1g.
ThanksPl post details of OS versions, exact database versions (to 4 digits) and init.ora parameters of the 10g and 11g databases. Have statistics been gathered after the upgrade ?
For posting tuning requests, pl see these threads
HOW TO: Post a SQL statement tuning request - template posting
When your query takes too long ...
Pl see if the SQL Performance Analyzer can help - MOS Doc 562899.1 (TESTING SQL PERFORMANCE IMPACT OF AN ORACLE 9i TO ORACLE DATABASE 10g RELEASE 2 UPGRADE WITH SQL PERFORMANCE ANALYZER)
HTH
Srini -
Oracle 11g bug for column ambigously defined error
I have below format query running on Oracle 10g without any issues
select col1
from (select col1
from (select 'A' col1
from dual)
) v1
inner join (select col1 as col2
from (select 'A' col1
from dual)
) v2
on (v1.col1=v2.col2);
When I run the exact same query on Oracle 11g I get column ambiguously defined error. But when I change the query to as below it works fine on 11g
select v1.col1
from (select col1
from (select 'A' col1
from dual)
) v1
inner join (select col1 as col2
from (select 'A' col1
from dual)
) v2
on (v1.col1=v2.col2);
Is it because 11g ignores column alias in my inner queries.I'd tend to agree that this seems to be a bug in 11.1.0.7 (at least, that's the version I'm running it in)
It's not even that Oracle doesn't know about the column aliases, you can remove the aliases in the ON without a problem, i.e.
SELECT v1.col1
FROM
(SELECT col1 FROM
(SELECT 'A' col1 FROM dual
) v1
INNER JOIN
(SELECT col1 AS col2 FROM
(SELECT 'A' col1 FROM dual
) v2
ON (col1=col2);works fine. Using the old join syntax also seems to work fine
SELECT col1
FROM
(SELECT col1 FROM
(SELECT 'A' col1 FROM dual
) v1,
(SELECT col1 AS col2 FROM
(SELECT 'A' col1 FROM dual
) v2
WHERE (col1=col2);So it appears that something in the SQL 99 parser is broken. Have you logged a bug in Metalink?
Justin -
Oracle 11G - Update is very slow on View
I have big trouble with some Update query on Oracle 11G.
I have a set of tables (5) of identical structures and a view that consists in an UNION ALL of the 5 tables.
None of this table contains more than 20 000 rows.
Let's call the view V_INTE_NE. Each of the basic table has a PRIMARY KEY defined on 3 NUMBERS(10,0) -> INTE_REF / NE_REF / INSTANCE.
Now, I get 6 rows in another table and I want to update my view from the data of this small table (let's call it SMALL). This table has the 3 columns INTE_REF / NE_REF / INSTANCE.
When I try to join the two tables :
SELECT * FROM T_INTE_NE T2
WHERE EXISTS ( SELECT 1 FROM SMALL T1 WHERE T2.INTE_REF = T1.INTEREF AND T2.NE_REF = T1.NEREF AND T2.INTE_INST = T1.INSTANCE )
I get the 6 lines in 0.037 seconds
When I try to update the view (I have an INSTEAD OF trigger that does nothing (just return for testing even without modifying anything), I execute the following query :
UPDATE T_INTE_NE T2
SET INTE_STATE = -11 WHERE
EXISTS ( SELECT 1 FROM SMALL T1 WHERE T2.INTE_REF = T1.INTEREF AND T2.NE_REF = T1.NEREF AND T2.INTE_INST = T1.INSTANCE )
The 6 rows are updated (at least TRIGGER is called) in 20 seconds.
However, in the execution plan, I can't see where Oracle takes time to achieve the query :
Plan hash value: 907176690
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 6 | 36870 | 153 (1)| 00:00:02 |
| 1 | UPDATE | T_INTE_NE | | | | |
|* 2 | HASH JOIN RIGHT SEMI | | 6 | 36870 | 153 (1)| 00:00:02 |
| 3 | TABLE ACCESS FULL | SMALL | 6 | 234 | 9 (0)| 00:00:01 |
| 4 | VIEW | T_INTE_NE | 6 | 36636 | 143 (0)| 00:00:02 |
| 5 | VIEW | X_V_T_INTE_NE | 6 | 18636 | 143 (0)| 00:00:02 |
| 6 | UNION-ALL | | | | | |
| 7 | TABLE ACCESS FULL| SECNODE1_T_INTE_NE | 1 | 3106 | 60 (0)| 00:00:01 |
| 8 | TABLE ACCESS FULL| SECNODE2_T_INTE_NE | 1 | 3106 | 60 (0)| 00:00:01 |
| 9 | TABLE ACCESS FULL| SECNODE3_T_INTE_NE | 1 | 3106 | 2 (0)| 00:00:01 |
| 10 | TABLE ACCESS FULL| SECNODE4_T_INTE_NE | 1 | 3106 | 2 (0)| 00:00:01 |
| 11 | TABLE ACCESS FULL| SECNODE5_T_INTE_NE | 1 | 3106 | 2 (0)| 00:00:01 |
| 12 | TABLE ACCESS FULL| SYS_T_INTE_NE | 1 | 3106 | 17 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("T2"."INTE_REF"="T1"."INTEREF" AND "T2"."NE_REF"="T1"."NEREF" AND
"T2"."INTE_INST"="T1"."INSTANCE")
Note
- dynamic sampling used for this statement (level=2)
Statistics
3 user calls
0 physical read total bytes
0 physical write total bytes
0 spare statistic 3
0 commit cleanout failures: cannot pin
0 TBS Extension: bytes extended
0 total number of times SMON posted
0 SMON posted for undo segment recovery
0 SMON posted for dropping temp segment
0 segment prealloc tasks
What could explain the difference ?
I get exactly the same execution plan (when autotrace is ON).
Furthermore, if I try to do the same update on each of the basic tables, I get the rows updated instantaneously.
Is there any reason for avoiding this kind of query ?
Any help would be greatly appreciated :-)
Regards,
PatrickSorry for this, I lost myself in conjonctures and I didn't think I would have to explain the whole case.
So, I wrote a small piece of PL/SQL that reproduces the same issue.
It seems that my issue is not due to the UPDATE but to the use of the IN predicate.
As you can see at the end of the script, I try to join the 2 tables using different technics.
The first query is very fast, the second is very slow.
I need the second one if I want to do any update.
DROP TABLE Part1;
DROP TABLE Part2;
DROP TABLE Part3;
DROP TABLE Part4;
CREATE TABLE Part1 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 1 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part1 PRIMARY KEY( Key1, Key2, Key3 ) );
CREATE TABLE Part2 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 2 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part2 PRIMARY KEY( Key1, Key2, Key3 ) );
CREATE TABLE Part3 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 3 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part3 PRIMARY KEY( Key1, Key2, Key3 ) );
CREATE TABLE Part4 ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), PartId NUMBER(10, 0) DEFAULT( 4 ) NOT NULL, Data1 VARCHAR2(1000), X_Data2 VARCHAR2(2000) NULL, X_Data3 VARCHAR2(2000) NULL, CONSTRAINT PK_Part4 PRIMARY KEY( Key1, Key2, Key3 ) );
CREATE OR REPLACE FUNCTION Decrypt
x_in IN VARCHAR2
) RETURN VARCHAR2
AS
x_out VARCHAR2(2000);
BEGIN
SELECT REVERSE( x_in ) INTO x_out FROM DUAL;
RETURN ( x_out );
END;
CREATE OR REPLACE VIEW AllParts AS
SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part1
UNION ALL
SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part2
UNION ALL
SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part3
UNION ALL
SELECT Key1, Key2, Key3, PartId, Data1, Decrypt( X_Data2 ) AS Data2, Decrypt( X_Data3 ) AS Data3 FROM Part4;
DROP TABLE Small;
CREATE TABLE Small ( Key1 NUMBER(10, 0), Key2 NUMBER(10, 0), Key3 NUMBER(10, 0), Data1 VARCHAR2(1000) );
BEGIN
DECLARE
n_Key NUMBER(10, 0 ) := 0;
BEGIN
WHILE ( n_Key < 50000 )
LOOP
INSERT INTO Part1( Key1, Key2, Key3 )
VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
INSERT INTO Part2( Key1, Key2, Key3 )
VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
INSERT INTO Part3( Key1, Key2, Key3 )
VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
INSERT INTO Part4( Key1, Key2, Key3 )
VALUES( n_Key, FLOOR( n_Key / 10 ), FLOOR( n_Key / 100 ) );
n_Key := n_Key + 1;
END LOOP;
INSERT INTO Small( Key1, Key2, Key3, Data1 ) VALUES ( 1000, 100, 10, 'Test 1000' );
INSERT INTO Small( Key1, Key2, Key3, Data1 ) VALUES ( 3000, 300, 30, 'Test 3000' );
INSERT INTO Small( Key1, Key2, Key3, Data1 ) VALUES ( 5000, 500, 50, 'Test 5000' );
COMMIT;
END;
END;
SELECT T2.*
FROM Small T1, AllParts T2
WHERE T2.Key1 = T1.Key1 AND T2.Key2 = T1.Key2 AND T2.Key3 = T1.Key3;
SELECT T1.*
FROM AllParts T1
WHERE ( T1.Key1, T1.Key2, T1.Key3 ) IN ( SELECT T2.Key1, T2.Key2, T2.Key3 FROM Small T2 ); -
Oracle 11g Active Data Guard and SAP R3
Hi All,
I have a query regarding Oracle 11g Active Data Guard and SAP R3.
Does the Oracle 11g R1/R2 Active Data guard feature supported with SAP R3?
I appreciate your help to provide any link or document for the same.
Thanks,
VihangI have a query regarding Oracle 11g Active Data Guard and SAP R3.
Does the Oracle 11g R1/R2 Active Data guard feature supported with SAP R3?
I appreciate your help to provide any link or document for the same.
Oracle database 11g functionality certified by SAP, check below link
http://www.oracle.com/us/solutions/sap/oradb11g-article-upd-1-323074.pdf
http://www.oracle.com/technetwork/middleware/ias/downloads/osb-11gr1certmatrix.xls -
SQL performance slow -- oracle 10g to oracle 11g
Hi,
We are have two development server, here we can call server10 and server11.
Server’s having same hardware and OS, but different oracle version, server 10 and server 11 having oracle 10g and oracle 11g respectively.
Problem, when you run sql query in oracle 11g it’s very slow compare to oracle 10g server.
Here I have checked
1) sga size – comparatively 11g size is big
2) no full table scan
OS – SUN
DB: 11.1.0.7.0, 10.2.0.4.0mmee wrote:
Hi,
We are have two development server, here we can call server10 and server11.
Server’s having same hardware and OS, but different oracle version, server 10 and server 11 having oracle 10g and oracle 11g respectively.
Problem, when you run sql query in oracle 11g it’s very slow compare to oracle 10g server.
Here I have checked
1) sga size – comparatively 11g size is big
2) no full table scan
OS – SUN
DB: 11.1.0.7.0, 10.2.0.4.0If the query is running slow, the sga size should not be the first thing to check. PLease post the execution plans of the queries from both the servers. Please try to post the tkprof output of the trace of both. The reason for this that explain plan may lie to us about what has happened but trace would be the real picture only.
HTH
Aman....
PS: Don't forget to use the code tag and using the Preview tab to see how the code looks. A better formatted post would most likely get better attention and response. -
Can we do oracle 11g software installation in parallel to SAP upgrade
Hi Basis Expert,
I need your inputs for one of this query
The query is. Can we do oracle 11g software installation in parallel to SAP upgrade when the system is in Downtime phase.
The idea is running SAP upgrade and in parallel running oracle 11g software installation. So that we can reduced the time.
Please share your valuable inputs.
Regards,
Anil Shenoy.yes, of course.
using different environment during the installation of the new engine, you could install the new oracle home 11 also tomorrow (including the SBP).
infact, before the ./RUNINSTALLER you have to set the environment
setenv ORACLE_HOME /oracle/SID/112_64
setenv ORACLE_HOME_SRC /oracle/SID/102_64
setenv ORACLE_HOME_TGT /oracle/SID/11202
setenv LIBPATH $ORACLE_HOME/lib:$LIBPATH
setenv PATH /oracle/SID/112_64/bin: $PATH -
Query not considering function based index in oracle 11g
I have a query which used Function Based Index when run in oracle 9i but when I run the same query
without any changes, it does not consider index. Below is the query:
SELECT distinct patient_role.domain_key, patient_role.patient_role_key,
patient_role.emergency_contact_name,
patient_role.emergency_contact_phone, patient_role.emergency_contact_note,
patient_role.emergency_contact_relation_id,
patient_role.financial_class_desc_id, no_known_allergies, patient_role.CREATED_BY,
patient_role.CREATED_TIMESTAMP,
patient_role.CREATED_TIMESTAMP_TZ, patient_role.UPDATED_BY, patient_role.UPDATED_TIMESTAMP,
patient_role.UPDATED_TIMESTAMP_TZ,
patient_role.discontinued_date
FROM encounter, patient_role
WHERE patient_role.patient_role_key = encounter.patient_role_key
AND UPPER(TRIM(leading :SYS_B_0 from encounter.account_number)) = UPPER(TRIM(leading :SYS_B_1 from
:SYS_B_2))
AND patient_role.discontinued_date IS null
AND encounter.discontinued_date IS null ;
Index definition:
CREATE INDEX "user1"."IX_TRIM_ACCOUNT_NUMBER" ON "user1."ENCOUNTER" (UPPER(TRIM(LEADING
'0' FROM "ACCOUNT_NUMBER")), "PATIENT_ROLE_KEY", "DOMAIN_KEY", "DISCONTINUED_DATE")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT)
TABLESPACE "user1"
Database : Oracle 11g (11.2.0.3)
O/S : Linux 64 bit (the query does not consider index even on windows os)
Any suggestions?
-Onkar
Edited by: onkar.nath on Jul 2, 2012 3:32 PMOnkar,
I don't appreciate you posting this question in several forums at the same time.
If I would know you also posted this on Asktom, I wouldn't even have bothered.
As to your 'issue':
First of all: somehow cursor_sharing MUST have been set to FORCE. Oracle is a predictable system, not a fruitmachine.
Your statement the '0' is replaced by a bind variable anyway is simply false. If you really believe it is not false, SUBMIT a SR.
But your real issue is not Oracle: it is your 'application', which is a mess anyway. Allowing for alphanumeric numbers is a really bad idea.
Right now you are already putting workaround on workaround on workaround on workaround.
Issue is the application: it is terminal., and you either need to kill it, or to replace it.
Sybrand Bakker
Senior Oracle DBA -
Oracle 11G - Oracle AWR export import Query Statistics.
I have Oracle 11G, i have seen the sql statements through Historical AWR option from Top Activites in performance tab. Can i export all AWR query statistics from production machine so that i can analyze all logs after importing it.
How can i know all statistical sql ( information ) and performace of production machine ?
any help ?Hello,
have you checked the DBA_HIST* objects to see what / how was imported?
If the awr export dosn't get the contents of the rolling buffer, then you won't see any session statistics that are only there. If you want to get the contents of the rolling buffer you have to dump the contents of it with :
oradebug setmypid
oradebug dump ashdump 10
and load it into your "test" database.
But before doing this I suggest you read the related metalink documentation if any!!!
Regards,
Franky -
Oracle 11g- Straing behaviour of query after importing from Oracle 10g
Hi,
I have a table in Oracle 10g as follows:
Create Table xyz (col1 varchar2(50), col2 varchar2(50));
With following Data
Col1 Col2
A 320
A 110
A 290
A 380
B ABC
B 256
B LMN
I am running following Query
select * from xyz
Where Col1='A' and Col2=110
It works fine. But when I export this table and import it in Oracle 11g. It says invlid identifier.
But if I enclose 110 in single quotes. It works fine.
Also If I recreate this table in Oracle 11g like
Create table xyz1
as select * from xyz;
Now alos I am able to run this query smoothly.
select * from xyz1
Where Col1='A' and Col2=110
What is wrong exporting this table from 10g to 11g.
Any comments/suggestion??
AarbiThe check in your where clause
Col2=110Is comparing a string (Col2 is defined as a VARCHAR) with a numeric literal, so there will be an implicit conversion taking place from character to number. The query then fails due to the B LMN row when 'LMN' fails number conversion.
I'm guessing there was there an index on the table in your 10g installation which would allow the query to be satisfied without checking the B ABC or B LMN rows but is not present or not used in the 11g installation so a full table scan results in an attempt to convert 'ABC' and 'LMN' to a number. Check the explain plans.
Or it could even just be a difference in the order in which the two conditions in the where clause are evaulated between the two versions.
The solution, as you have already found is to do a string comparision
Col2='110'Edited by: Cyn on Dec 7, 2009 12:38 PM -
Oracle 11G - Oracle AWR query execution time in report
I have used AWR tool of oracle 11G. I have exported query historical statistics of production databaser using awrextr.sql and then load the exported dump file using awrload.sql script.
Then i used awrrpti.sql and awrsqrpi.sql for generating report of sql queries. Every thing is working fine and generated reports are also very helpful, but report does not show the exact time when the query was executed. How can i get the actual time when the query was executed ?
any help please ?If you would have consulted the Oracle Reference Manual to get the view descriptions, you should have your question is a rhetorical one with the answer NO.
This is because every statement can be executed one or more times, and Oracle would need to keep track of all individual executions.
I do agree most 'applications' do not use bind variables, and consequently only have unique statements, but Oracle didn't take that into account, and rightly so.
Sybrand Bakker
Senior Oracle DBA
Maybe you are looking for
-
You can download past purchases on this computer with just one Apple ID every 90 days
I have a mac which my fiancee and I share. There are 2 separate accounts and 2 separate apple ids used to buy different music (i.e. we have 2 separate iphones and music collections). I received the following error (see uploaded image) which states th
-
The data in the file [file name] has already been added to the response file
I'm obtaining this error when trying to import(Add) new PDF forms into the PDF Portfolio response file distributed with PDF's. It's a new problem. I've never seen this before. In fact, I imported a few dozen forms back in November. Now, I can only im
-
Photoshop CS3 Extended upgrade to CS5?
Tried asking the online chat to answer this simple question . . . the person really didn't understand what I was asking. So here it goes, the complex question of - Will a regular CS5 upgrade work for a CS3 Photoshop Extended version or not?
-
Windows Fax Connection Timeout Value
Like for most, sending a fax is a rare event and used to work with the currently installed hardware but doesn't with Win 8.1. It has been about a year since I sent a fax so I don't know when it stopped working. What is happening is that the fax numbe
-
for some reason it wouldn't let me edit the image could some one help me, and tell me why ???? and what to do