I've been experiencing strange Oracle behavior from time to time when using "explain plan". what could be the reason? (I'm going to create an Oracle ticket when I could find the cause...)
The total cost of a query was low (ex. ~500) while sub-parts of the query has high cost (ex. ~10000).I don't want to provide the query itself as the issue is observed for huge queries (like 2M characters!).The execution plan looks like this:
I'm wanting to create a query that will give me a summary of parts and labor from work orders. However there are three tables. work_order, parts, labor. Sometimes there will only be parts, sometimes just labor, or sometimes both. Well my query will only return results when they are on both. Sample query is below. Do I need to create a temp table to gather the data or is there a way to do this with a sub query.
select work_order.wono, sum(parts.cost), sum(labor.cost) from work_order, parts, labor where work_order.wono = parts.wono and work_order.wono = labor.wono group by work_order.wono;
The SDO_LENGTH command appears to be giving us the length of only the first line segment in a mult-segmented polylines. ... For example.. for this
polyline.... MDSYS.SDO_GEOMETRY(3002,82212,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,4,2,1,2,1,7,2,2),MDSYS.SDO_ORDINATE_ARRAY(489308.53608219,5465823.43147879,0,489254.621813806,5465739.29869485,0,489223.453489433,5465690.81111309,0,489217.608149169,5465676.83952032,0,489213.696031073,5465662.20843221,0,489213.337168734,5465657.12388026,0,489213.259485918,5465652.02727197,0)) RunningUPDATE TEMP_1 SET LEN = SDO_GEOM.SDO_LENGTH (GEOMETRY,0.005,'unit=meter');
We get 99.925 meters,and not the 198.075 that we were expecting.
When as scott, I run the following command select * from tab, I get the output that has been attached as pdf. This output contain some strange objects like-
Target Database machine OS: Red Hat Enterprise Linux Server release 5.4 , 64-bit Target Database version/addition: 10.2.0.4.0 EE
Therefore, I did an export using Oracle Data Pump:
Export: Release 11.2.0.1.0 - Production on Tue Jun 11 13:13:28 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Release 11.2.0.1.0 - 64bit Production Starting "SYSTEM"."SYS_EXPORT_SCHEMA_04": system/******** directory=DATA_PUMP_DIR dumpfile=exp_PRODSCHEMAS_20130611.dmp schemas=PRD_100,SHR_100 logfile=exp_PRODSCHEMAS_20130611.log VERSION=10.2.0.4.0 Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 1.026 GB Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT [code]....
does it have to do with the VERSION parameter value? what can I check to investigate?
For importing higher version database exp dump e.g. 10g exp dump into 9i database it is suggested at many places "Always use a version of the EXPORT utility that is equal to the lowest version of either the source or the target database"
I understand from this is, I will be using 9i exp utility for exporting 10g database
I would like to know the ways it can be achieved.
1) Installing oracle 9i client on 10g database Do I still need to execute 9i catexp.sql after that? If answer to above is 'yes', I assume catexp.sql of 9i wont be created after 9i client is installed as such I will need to copy it from 9i database server and execute on 10g database server. Correct? For above question I have assumed catexp.sql has different contents for 9i and 10g
2) After configuring tns file in 9i database, can I use?
exp user/password@10gdbconnstring ....
(of course for small amount of data)
Is there any other option for achieving the same?
Also I understand export and import between any 9.* into any 9.* wont be issue e.g. import from 9.2 into 9.1 Similarly any 10.* to another 10.* wont be issue.
We have a Oracle 10g database in the server. We are trying to connect to the server using oracle6 client and we are able to do so. How ever when retrieving the "time stamps" field , getting an error "ORA-03115: unsupported network datatype or representation". I understood from the error that, the client version need an upgrade.
How ever , We have another server which is having Oracle6 installed in the server and hence If i install/upgrade the client in my local system , I will be having trouble.
My question is , is there any way to get the timestamps from oracle6 client with out any issue.
How can I drop a lower case tablespace name from my DB?
SQL> select * from v$version; BANNER ------------------------------------------------------------ Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for IBM/AIX RISC System/6000: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production [code]....
I am using oracle 10g, i want to know the cost of query. In the explain plan and by auto trace am able to get some query cost, but i dont know how to calculate the query cost.
How i will know the query is costly and take more time..? But i know about the hash table and nested tables in the explain plan. Other than this how to calculate the query cost..?
prepare data: CREATE TABLE a AS SELECT LEVEL ID ,decode(mod(LEVEL,10),1,'CODE'||LEVEL) CODE from dual CONNECT BY LEVEL<20001;
sql1: CREATE TABLE TEST AS SELECT ID, NVL(CODE,LAG(CODE ignore nulls) OVER(ORDER BY ID )) CODE FROM a;
the sql is slow,most of the waits on session is resmgr:cpu quantum and almost all of the cpu resource is occupied
sql2: CREATE TABLE TEST AS SELECT ID, NVL(CODE,last_value(CODE ignore nulls) OVER(ORDER BY ID ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)) CODE FROM a;
this sql is fast
How lag function is implemented if the offset is not deterministic?
Table: temp_user_access NAME Null? Type ------------------------------- --------- ----- USERGROUP VARCHAR2(255) USERNAME NOT NULL VARCHAR2(40) NICKNAME VARCHAR2(40) AAACC VARCHAR2(70) SYSTEM VARCHAR2(10)
I am trying to insert data from 9i to 11g using db link with the below query but while doing so the select statement is going for a full table scan even though rowid is used. But when we execute the same select statement without this insert command it is using proper index. Similar issues I am facing for updates.
Query:
INSERT INTO /*+ APPEND */ emp@db_link select * from emp where rowid ='AAC2SmAIIAAAHQgAAZ'
I am facing one performance issue, in which the query cost is very low compare to cpu cost and as a result the cpu always show the high graph.I am also attaching the gv$sql and gv$sql_plan data of this query.
This is the query:
SELECT PTLS.ITEMTYPE , PTLS.ITEMID , PTLS.STAGEID, TS.USERID, SUM(PREVIOUSHOURS) AS PREVIOUSHOURS, MIN(STARTDATE) AS STARTDATE, MAX(STARTDATE) AS ENDDATE FROM PROJECTTIMELOGSSTAGE PTLS, PROJECTTIMESHEETITEM PTSI, TIMESHEET TS WHERE PTLS.PROJECTID = :B2 AND TS.TIMESHEETID = PTSI.TIMESHEETID AND TS.USERID = :B1 AND PTSI.TIMESHEETID = PTLS.TIMESHEETID AND PTSI.ITEMTYPE = PTLS.ITEMTYPE AND PTSI.ITEMID = PTLS.ITEMID AND (PTSI.ISPWFITEM = 'N' OR PTSI.ISPWFITEM IS NULL) AND PTLS.ITEMTYPE NOT IN ('OtherTsk','NewTsk','Loc','Glb') AND (PTLS.ITEMTYPE, PTLS.ITEMID ) IN (SELECT ITEMTYPE, ITEMID FROM PROJECTTIMELOGSSTAGE PTLS1 WHERE PTLS1.PROJECTID = :B2 AND PTLS1.TIMESHEETID = :B3 ) GROUP BY PTLS.ITEMTYPE, PTLS.ITEMID, PTLS.STAGEID, TS.USERID
I have one table which has two columns name,qty and it has data like arif,3 pcs i want to display it in 3 lines if the qty is 3 and in 2 lines if the qty is 2 using sql query
I am working on Tuning a Materialized view. I was getting an error saying ORA-12008: error in materialized view refresh path
ORA-12801: error signaled in parallel query server P002, instance hrms-stg-db01:HRSTG1 (1) ORA-01652: unable to extend temp segment by 16 in tablespace TEMP1.
so i increased the temp size. I am trying out various hints to get it rectified. But i am not sure if i should go for less cost or less bytes.
I brought in the Northwind database 2003 in to SQL Developer. I was looking at the view 'Summary of Sales by Quarter' But this report brings in everything. It doesent give me summary of sales for Qtr1, Qtr4 etc
These are the columns:
ShippedDate OrderId Subtotal CREATE OR REPLACE FORCE VIEW "NORTHWIND"."SUMMARY_OF_SALES_BY_QUARTER" ("SHIPPEDDATE", "ORDERID", "SUBTOTAL") AS
[code]....
How can i recreate this view to show me summary data for qtr1, qtr2, qtr3 and qtr 4 for the year 1997??
EFFECTIVE_START_DATE: SCD field, Date ABACUS moves from one department to another.
EFFECTIVE_END_DATE: SCD field, Date ABACUS left the department from another. To keep history of movement.
The sample report shows possible scenario on my data.
I want to build monthly report to cater from departmental headcount on monthly basis, starting from from ABACUS start date.
see sample report below
MONTH | DEPARTMENT |NEW_HIRES | RELOCATION (OUT) | RELOCATION (IN) | NET TOTAL PREV MONTH | NET TOTAL PRESENT MONTH | WHERE MONTH: REPORT MONTH DEPARTMENT: THE DEPARTMENTS IN THE ORGANIZATION NEW_HIRES: NUMBER OF NEW STAFFS HIRED THAT MONTH BASE ON EMP_START_DATE RELOCATION_OUT: NUMBER OF STAFFS MOVEMENT TO ANOTHER DEPARTMENT (EMP_END_DATE IS NULL, EFFECTIVE_START_DATE AND
Create a procedure generate_daily_session_summary that will read the pcm_session_summary (pk sess_id) table and create a per day summary in the pcm_session_summary_daily table.
1. Summarize all records from pcm_session_summary for session start timestamp (START_TS) greater than the max existing SESS_DT from pcm_session_summary_daily table and less than the start of current day. Insert the records into the pcm_session_summary_daily table.
2. Populate the fields in pcm_session_summary_daily as follows :
sess_dt - truncated date from pcm_session_summary.start_ts unique_user_cnt - count of unique cws ids encountered in that day, sess_cnt number - count of total sessions in that day , max_concurrent_sess_cnt number - maximum number of concurrent sessions at any point of time in that day. Concurrent sessions are defined as those that have overlapping start_ts or end_ts - sessions that were active at the same moment in time would be concurrent with each other.
3. The procedure will be scheduled to run every day in a batch job and will summarize session data until the end of the previous day
I have the table with below details.
desc PCM_SESSION_SUMMARY Name Null Type ---------- -------- ------------ SESS_ID NOT NULL NUMBER USER_CUPID VARCHAR2(10) START_TS TIMESTAMP(6) END_TS TIMESTAMP(6) ACT_CNT NUMBER
[code]....
I have written the below query to get the result for question no:1
select trunc(start_ts,'DDD') start_ts,count(distinct(user_cupid)) user_cnt,count(SESS_ID) Sess_cnt from PCM_SESSION_SUMMARY where START_TS < sysdate or START_TS > (select max(sess_dt) from pcm_session_summary_daily where sess_dt < sysdate) group by trunc(start_ts,'DDD') order by start_ts;
However i tried a lot but not sure how to get maximum concurrent session count for a day.One of my friend comment below.
The Pcm_session_summary_daily is empty so you need to handle nulls when doing max. That will fix the issue of no results for the Greater Than condition.
You need to get concurrent count of sessions with respect to one another, the query that you have will not work. Do it in PL/SQL using procedural logic. The queries would return multiple rows, you need to handle that.
and we click on create summary folders we got this error Summary management not available because : this user has no privilige or quota to create materialized view in the current schema External summary registeration not available because : this user has no privilige or quota to create materialized view in the current schema
I have one group wise report and my requirement is i need to print both the Outputs in one single report first, is group with details and the summary in the last page showing machine code and summary of qty as totals ,I have given below test case .
insert into ot_cut_detail values ('L1','01','1001',2); insert into ot_cut_detail values ('L1','01','1002',2); insert into ot_cut_detail values ('L1','01','1003',2); insert into ot_cut_detail values ('L2','01','1004',2); insert into ot_cut_detail values ('L2','01','1005',2);
ck_amt is checkbox.. ck_amt_tot is total of jtt_amt_1 [but total only those record whose checkbox is checked]
My task is like this When i checked checkbox whatever value in jtt_amt transfer to jtt_amt_1 field
but i can change value in jtt_amt_1 field ...i want to take addition of that changed field and show that sumation in ck_amt_tot.
I write trigger when-checkbox-changed like this ------------------------------------------------- IF :jou_tra1_tab.ck_amt = 'Y' THEN set_item_INSTANCE_property ('jou_tra1_tab.jtt_amt_1',CURRENT_RECORD, UPDATE_ALLOWED, PROPERTY_TRUE); :jou_tra1_tab.jtt_amt_1 := :jou_tra1_tab.jtt_amt; else :jou_tra1_tab.jtt_amt_1 := 0; END IF;
and when validation item trigger for jtt_amt_1 : -------------------------------------------------- IF :jou_tra1_tab.ck_amt = 'Y' then :jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot + :jtt_amt_1 ; else :jou_tra1_tab.ck_amt_tot := :jou_tra1_tab.ck_amt_tot - :jtt_amt_1 ;
But when i changed value in jtt_amt_1 field i cant get write summation .