Isn't there a flaw in this query?
I've been asked to review this stored proc (an SP with OUT parameter). If you look at the code below, After the UPDATE of RSP_RQ table, the developer is trying to pad the values into comma separated string. But p_rptReqstId is hardcoded to '1' , so, In line 45, the ELSE bit will never get executed and the coma separated string will never be formed. Am i right?
Another question on formatting for readability? Once i put the code ({}) tags, i can't seem to Bold the text inside the code tags for highlighing purposes? How can i make a word BOLD which is inside the code tags?
CREATE OR REPLACE PROCEDURE get_nxtprcId
(in_maxCnt IN integer DEFAULT 5,
in_dynReqstr IN VARCHAR2 DEFAULT NULL,
in_dynServType IN varchar2 DEFAULT NULL,
in_rptTurnReqStr IN varchar2 DEFAULT NULL,
p_rptReqstId OUT varchar2
As
TYPE rptid_type IS TABLE OF RSP_RQ.rpt_reqst_id%TYPE;
v_stmt VARCHAR2(4096);
rptid_array rptid_type;
v_rptid RSP_RQ.rpt_reqst_id%TYPE;
BEGIN
p_rptReqstId := '1'; --Parameter hardcoded to '1'
.code where v_stmt string is built
EXECUTE IMMEDIATE v_stmt BULK COLLECT
INTO rptid_array
using in_maxCnt;
-- For each Record...
FOR j IN 1 .. rptid_array.COUNT LOOP v_rptid := rptid_array(j);
--Update the stat_code by 8
Update RSP_RQ rpq
SET rpq.STAT_CODE = (rpq.STAT_CODE + 8),
rpq.mod_date_time = sysdate
where rpq.RPT_REQST_ID = v_rptid;
-- Process only if a record has been updated...
if (SQL%ROWCOUNT > 0) then
if (p_rptReqstId = '1') then
-- Taking the first element from the associative array...
p_rptReqstId := v_rptid;
else -- LINE 45. this else bit won't be processed since p_rptReqstId hardcoded to '1'
-- Add it to the list...
p_rptReqstId := trim(p_rptReqstId) || ', ' || v_rptid;
end if;
end if;
end loop;Edited by: user10633418 on Feb 16, 2009 4:44 AM
Edited by: user10633418 on Feb 16, 2009 6:21 AM
SQL> create or replace procedure get_nxtprcid(p_rptreqstid out varchar2)
as
begin
p_rptreqstid := '1'; --Parameter hardcoded to '1'
if (p_rptreqstid = '1')
then
dbms_output.put_line('You are right');
else
-- LINE 45. this else bit won't be processed since p_rptReqstId hardcoded to '1'
dbms_output.put_line('p_rptReqstId is ' || p_rptreqstid);
end if;
end get_nxtprcid;
Procedure created.
SQL> set serveroutput on
SQL> declare
my_id varchar2(5) := 'a';
begin
get_nxtprcid(my_id);
end;
You are right
PL/SQL procedure successfully completed.
SQL>Regards
Peter
Edit:
Ouch, missed the point that OP's code is executed in a LOOP. John Spencer got it correct below
Edited by: Peter on Feb 16, 2009 1:45 PM
Similar Messages
-
Is there any logical flaw in this query?
DB version:10gR2
Do you see any logical flaw, room for improvement in this query
SELECT SHIP_QRY.RCVD_SHPMT_NBR, SHIP_QRY.ORIG_SHPMT_NBR, SHIP_QRY.DC_ORD_NBR, SHIP_QRY.WORK_ORD_NBR, SHIP_QRY.MFG_PLNT, SHIP_QRY.CONS_CASE_PRTY, SHIP_QRY.CONS_PRTY_DATE, SHIP_QRY.CONS_SEQ, SHIP_QRY.MFG_DATE, SHIP_QRY.RCVD_DATE, SHIP_QRY.XPIRE_DATE, SHIP_QRY.SHIP_BY_DATE, SHIP_QRY.PROC_IMMD_NEEDS, SHIP_QRY.VOL, SHIP_QRY.EST_WT, SHIP_QRY.ACTL_WT, SHIP_QRY.CASE_SIZE_TYPE, SHIP_QRY.PKG_NBR, SHIP_QRY.PKG_TYPE, SHIP_QRY.PO_NBR, SHIP_QRY.SHIP_VIA, SHIP_QRY.TRLR_NBR, SHIP_QRY.STAT_ID, SHIP_QRY.STAT_DATE_TIME, SHIP_QRY.VENDOR_CNTR_NBR, SHIP_QRY.PHYS_ENTITY_CODE, SHIP_QRY.PLT_ID, SHIP_QRY.TIER_QTY, SHIP_QRY.SNGL_pdt_CASE, SHIP_QRY.PUTWY_TYPE, SHIP_QRY.OUT_OF_ZONE_INDIC, SHIP_QRY.LAST_FROZN_DATE_TIME, SHIP_QRY.LAST_CNT_DATE_TIME, SHIP_QRY.SPL_INSTR_CODE_1, SHIP_QRY.SPL_INSTR_CODE_2, SHIP_QRY.SPL_INSTR_CODE_3, SHIP_QRY.SPL_INSTR_CODE_4, SHIP_QRY.SPL_INSTR_CODE_5, SHIP_QRY.MOD_DATE, SHIP_QRY.MOD_DATE_TIME, SHIP_QRY.USER_ID, SHIP_QRY.RETN_DISP_CODE, SHIP_QRY.FINAL_DISP_CODE, SHIP_QRY.INCUB_DATE, SHIP_QRY.SUPP_FTZ_CASE, SHIP_QRY.RCPT_IN_PROC_FLAG, SHIP_QRY.CD_MASTER_ID, SHIP_QRY.VENDOR_MASTER_ID, SHIP_QRY.VOCO_INTRNL_REVERSE_ID, SHIP_QRY.VOCO_INTRNL_REVERSE_PLT_ID, SHIP_QRY.CASE_NBR, SHIP_QRY.ship, SHIP_QRY.LOCN_ID, SHIP_QRY.PREV_LOCN_ID, SHIP_QRY.DEST_LOCN_ID FROM SHIP_QRY WHERE ( SHIP_QRY.CASE_NBR = :1 ) FOR UPDATE WAIT :"SYS_B_0"
Edited by: user10583227 on Jan 13, 2009 7:05 PMHow do you expect from us to find your logical flaw when we don't have any idea about your intention?
Please post the details with some sample input data and your required output data along with brief explanation.
Got me?
Regards.
Satyaki De. -
Is there anyway to tune this query?
DB Version:10gR2
The below query using an Inline view is slow because alloc_ord_dtl table has more than a million records and a_inventoryid column in the join condition
(i.inventory_id = aod.a_inventoryid)has only 75,000 distinct records (out of 1 million total records in alloc_ord_dtl).
Is there any way to rewrite the below query?
select b.a_identity ALLOC_ID, b.inventory_id CURR_I_ID, b.sku_id SKU_ID, b.item_name SKU_NAME, ii.inventory_id DEST_I_ID
from ( select aod.a_identity, i.inventory_id, i.sku_id, i.facility_id,
ic.item_name, ic.item_id
from inv_task i inner join alloc_ord_dtl aod on (i.inventory_id=aod.a_inventoryid)
inner join inbound_carton ic on (aod.a_skuname=ic.item_name)
and aod.a_status =30
and i.inventory_type =6
and i.inventory_object_type=14
and i.inventory_status =44
) b left outer join inv_task ii (on b.sku_id=ii.sku_id)
and ii.inventory_object_type=8
and b.facility_id = ii.facility_idT.Boyd wrote:
Is there any way this query can re-written?That's like me asking you to fix my car without providing any other information. If you would like a reasonable answer to that question you must provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details. -
Is there something wrong with this query
my query in a prepared statement is:
select * from RAC.v_ABRIDGEMENTS where ((? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) OR (? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) and ENTRY_DATE = ? and COUNTY = ? ) its obviusly wrong - the between stuff where i place two years - a lowYearLimit and an upperYearLimit they some how override the entry_date match that i'm trying to do :
so eg .
select * from RAC.v_ABRIDGEMENTS where (('1870' BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) OR ('1870' BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)) and ENTRY_DATE = '1870-01-03 00:00:00.000' and COUNTY = 'Wigtown' )
will give all stuff 1870 and not just the 1870-01-03 matching stuff in 1870 ---how can i fix this ? ---basically the year stuff is in format of upperyear and lower year to account for occurances where the year is in a year range - such as 1870-1873 --this is in the same columnOK, reformatting this so I can read it (and getting rid of the useless sets of parenthesis), this is:
select *
from RAC.v_ABRIDGEMENTS
where ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
OR ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
and ENTRY_DATE = ?
and COUNTY = ?Now, if you understand operator precendence, the answer should be obvious; however, you probably don't so I'll spell it out....
Your WHERE clause has:
WHERE condition A
OR condition B
AND condition C
AND condition DApplying standard operator precedence, this is the same as:
A or (B and C and D)What I think you want is:
select *
from RAC.v_ABRIDGEMENTS
where (
? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
OR ? BETWEEN left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1) AND right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
and ENTRY_DATE = ?
and COUNTY = ?This gives you:
WHERE (A or B) and C and D -
Tabs on top? Why isn't there an option for this???!!!
How is it possible Safari was released without the option to place tabs on the browser's top??!
This was the single best innovation from Apple in browser implementation -- EVER.
Tabs on top was BRILLIANT.
<Edited by Host>So why censor my post????
http://messages.finance.yahoo.com/Stocks_(Ato_Z)/StocksA/threadview?m=te&bn=60&tid=2450176&mid=2450176&tof=1&frt=1#2450176
There are already 7,000 viewers of the official "Tab Not On Top" thread the day after Safari's release!
Options should be the norm. Safari should be allowed to evolve through interaction with users -- not by dictation from timid anti-innovators in Apple's hierarchy.
I don't need to see the site title -- if I don't know which site I am at I can look at the location bar url. Shesh.
Let users decide!
<Edited by Host> -
I do not remember for the life of me where I was once able to check how my iphone was functioning but recall I did it straight from my phone. Is anyone familiar with what I'm referring to and where it's located? I appreciate any info on the subject. Thanks in advance!
As far as I know, there is no such program.
What is not functioning on your iPhone? -
How to optimize this query?
Hi,
I have this query:
UPDATE t1
SET update_date = SYSDATE
WHERE (col1, col2, col3, col4, col5, col6)
IN (Some SELECT statement that uses GROUP BY)
My issue is that table t1 has a full scan on it. It is big and does not have index on update_date column. Is there anyway to accelerate this query?
Thanks!It is 10g and I am not concerned what is happening in the IN clause..
Plan
UPDATE STATEMENT ALL_ROWSCost: 15,604 Bytes: 216 Cardinality: 1
8 UPDATE t1
7 HASH JOIN RIGHT SEMI Cost: 15,604 Bytes: 216 Cardinality: 1
5 VIEW VIEW SYS.VW_NSO_1 Cost: 4,940 Bytes: 167 Cardinality: 1
4 SORT GROUP BY Cost: 4,940 Bytes: 212 Cardinality: 1
3 HASH JOIN Cost: 4,939 Bytes: 212 Cardinality: 1
1 TABLE ACCESS FULL TABLE t2 Cost: 3 Bytes: 171 Cardinality: 1
2 INDEX FAST FULL SCAN INDEX (UNIQUE) XPKt1 Cost: 4,918 Bytes: 118,869,250 Cardinality: 2,899,250
6 TABLE ACCESS FULL TABLE t1 Cost: 10,646 Bytes: 142,063,250 Cardinality: 2,899,250 -
Is there any way to tune this query? EXPLAIN PLAN included
DB version:10gR2
The below query was taking more than 3 seconds. The statistics are up to date for these tables. Is there any other way i could tune this query?
SELECT COUNT(1)
FROM
INVN_SCOPE_DTL, ship_dtl WHERE ship_dtl.WHSE = INVN_SCOPE_DTL.WHSE (+)
AND 'QC' = INVN_SCOPE_DTL.FROM_WORK_GRP (+)
AND 'MQN' = INVN_SCOPE_DTL.FROM_WORK_AREA (+)
AND ship_dtl.START_CURR_WORK_GRP = INVN_SCOPE_DTL.TO_WORK_GRP (+)
AND ship_dtl.START_CURR_WORK_AREA = INVN_SCOPE_DTL.TO_WORK_AREA (+)
AND ship_dtl.WHSE = '930' AND ship_dtl.OWNER_USER_ID = 'CTZDM'
OR ship_dtl.OWNER_USER_ID = '*'
AND ship_dtl.STAT_CODE >= '10'
AND ship_dtl.STAT_CODE <= '20'
ORDER BY ship_dtl.OWNER_USER_ID DESC,
ship_dtl.CURR_TASK_PRTY ASC, INVN_SCOPE_DTL.DISTANCE ASC, ship_dtl.RLS_DATE_TIME ASC, ship_dtl.TASK_ID ASC;
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 1 | 86 | 86 (2)|
| 1 | SORT AGGREGATE | | 1 | 86 | |
| 2 | NESTED LOOPS OUTER | | 898 | 77228 | 86 (2)|
| 3 | INLIST ITERATOR | | | | |
|* 4 | TABLE ACCESS BY INDEX ROWID| ship_dtl | 898 | 31430 | 85 (2)|
|* 5 | INDEX RANGE SCAN | ship_dtl_IND_4 | 2876 | | 1 (0)|
| 6 | TABLE ACCESS BY INDEX ROWID | INVN_SCOPE_DTL | 1 | 51 | 2 (50)|
PLAN_TABLE_OUTPUT
|* 7 | INDEX UNIQUE SCAN | PK_INVN_SCOPE_DTL | 1 | | |
Predicate Information (identified by operation id):
4 - filter("ship_dtl"."WHSE"='930' AND "ship_dtl"."STAT_CODE">=10 AND
"ship_dtl"."STAT_CODE"<=20)
5 - access("ship_dtl"."OWNER_USER_ID"='*' OR "ship_dtl"."OWNER_USER_ID"='CTZDM')
7 - access("INVN_SCOPE_DTL"."WHSE"(+)='930' AND
"INVN_SCOPE_DTL"."FROM_WORK_GRP"(+)='QC' AND "INVN_SCOPE_DTL"."FROM_WORK_AREA"(+)='MQN'
PLAN_TABLE_OUTPUT
AND "ship_dtl"."START_CURR_WORK_GRP"="INVN_SCOPE_DTL"."TO_WORK_GRP"(+) AND
"ship_dtl"."START_CURR_WORK_AREA"="INVN_SCOPE_DTL"."TO_WORK_AREA"(+))
filter("ship_dtl"."WHSE"="INVN_SCOPE_DTL"."WHSE"(+))
25 rows selected.William Robertson wrote:
I notice an OR predicate in the middle of some AND predicates without explicit bracketing. Are you sure it does what you think it does?I underline this point.
A conjuction (AND expression) has a higher priority and will be executed (logically) before the disjunction (OR expression)! So your select looks like this
SELECT COUNT(1)
FROM INVN_SCOPE_DTL, ship_dtl
WHERE
( ship_dtl.WHSE = INVN_SCOPE_DTL.WHSE (+)
AND 'QC' = INVN_SCOPE_DTL.FROM_WORK_GRP (+)
AND 'MQN' = INVN_SCOPE_DTL.FROM_WORK_AREA (+)
AND ship_dtl.START_CURR_WORK_GRP = INVN_SCOPE_DTL.TO_WORK_GRP (+)
AND ship_dtl.START_CURR_WORK_AREA = INVN_SCOPE_DTL.TO_WORK_AREA (+)
AND ship_dtl.WHSE = '930'
AND ship_dtl.OWNER_USER_ID = 'CTZDM'
OR ( ship_dtl.OWNER_USER_ID = '*'
AND ship_dtl.STAT_CODE >= '10'
AND ship_dtl.STAT_CODE <= '20'
;This might be want you want, but I doubt it very much. Please add parenthesis', to get it working the way it should be.
Edited by: Sven W. on Oct 16, 2008 3:25 PM -
I just bought the new ipod touch, but when I try to sync it I get told to use the cloud and download from there. How do I sync it to my itunes so that I get all my songs without going through cloud? Otherwise if this isn't possible I am taking this back!
Thanks for no help... but for anyone else, turn off itunes match on the ipod
-
Is there any better way of writing this query??
I have a query on insert which looks like this,
INSERT INTO TEMP( I1,I2)
SELECT TI1 FROM CLIENT1
WHERE R_CD ='PR' OR 'SR',
SELECT TI2 FROM CLIENT2
WHERE R_CD = 'MN' OR 'OP
There are two tables where the source data is coming from and inserted into TEMP table. I find this query to be inefficient. Anybody who can help me writing a good one?? Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by [email protected]:
I have a query on insert which looks like this,
INSERT INTO TEMP( I1,I2)
SELECT TI1 FROM CLIENT1
WHERE R_CD ='PR' OR 'SR',
SELECT TI2 FROM CLIENT2
WHERE R_CD = 'MN' OR 'OP
There are two tables where the source data is coming from and inserted into TEMP table. I find this query to be inefficient. Anybody who can help me writing a good one?? Thanks.<HR></BLOCKQUOTE>
A possible solution,
INSERT INTO TEMP( I1,I2)
SELECT C1.TI1, C2.TI2
FROM CLIENT1 C1, CLIENT2 C2
WHERE (C1.R_CD = 'PR' OR C1.R_CD ='SR') AND
(C2.R_CD = 'MN' OR C2.R_CD = 'OP')
null -
Why there is a error in this query ?
why there is a error in this query ?
declare
v_exist pls_integer;
v_search varchar2(255) := '175';
v_sql varchar2(255);
begin
for s in
(select table_name, column_name
from user_tab_columns
where data_type like '%CHAR%'
order by table_name, column_name)
loop
v_sql := 'select count(*) from '||s.table_name||
' where instr('||s.column_name||',' || CHR(39)|| v_search|| CHR(39) ||') > 0';
execute immediate v_sql into v_exist;
if v_exist > 0 then
dbms_output.put_line(s.table_name||'.'||s.column_name||' matches the string.');
end if;
end loop;
end;
Error:
The following error has occurred:
ORA-00933: SQL command not properly ended
ORA-06512: at line 14
Edited by: user575089 on Dec 23, 2009 4:14 AM
Edited by: user575089 on Dec 23, 2009 4:14 AMSee, Right now i am in schema and see below :
set serveroutput on;
declare
v_exist pls_integer;
v_search varchar2(255) := 'SCOTT';
v_sql varchar2(255);
begin
for s in
(select '"'||table_name||'"' table_name,'"'||column_name||'"' column_name
from user_tab_columns
where data_type like '%CHAR%'
and table_name not like '%$%'
order by table_name, column_name)
loop
v_sql := 'select count(*) from '||s.table_name||' where instr('||s.column_name||',' || CHR(39)|| v_search|| CHR(39)||') > 0';
--dbms_output.put_line(v_sql);
--execute immediate v_sql;
execute immediate v_sql into v_exist;
if v_exist > 0 then
dbms_output.put_line(s.table_name||'.'||s.column_name||' matches the string.');
end if;
end loop;
end;
"EMP"."ENAME" matches the string.
"EXCEPTIONS"."OWNER" matches the string.
"FLOW_TABLE"."OBJECT_OWNER" matches the string.
"MYEMP"."ENAME" matches the string.
PL/SQL procedure successfully completed.
I am getting output; that i search "SCOTT" word in my search string. -
Is there a faster form of this query?
I received a table of corrections that have to be 'propagated' to a master table, i.e. the corrections table is composed of a few columns and every value of every column of every row must be used to update the corresponding row-column in the master table. Both tables have id columns that can be used to match rows from the two. The query I was given to do this was:
update master a
set a.calculated_error = ( select calculated_error from corrections b where b.id = a.id ),
... additional columns to update follow with the same syntax.
The columns being updated are not indexed in either table.
The query takes a very long time to run. I suppose I can see why, lots of queries on columns that are not indexed so each query involves a table scan.
Is there a faster form of this query?
Thanks,
-=bIn additon to Herald's suggestion, assuming he is correct in his assumption that corrections is small in relation to master, I might also consider updating all of the columns in one shot. something along the lines of:
update master a
set (a.calculated_error, a.first_add, a.second_add) = (select calculated_error, first_add, second_add
from corrections b where b.id = a.id )
WHERE a.id in (SELECT id from corrections)Alternatively, if corrections.id is unique, I might also try creating a unique index on it and using an updateable join view like:
UPDATE (SELECT a.calculated_error, a.first_add, b.second_add,
b.calculated_error new_calc, b.first_add new_first,
b.second_add new_second
FROM master a, corrections b
WHERE a.id = b.id)
SET calculated_error = new_calc,
first_add = new_first,
second_add = new_secondIf you need to deal with NULLs in corrections, then use something like:
SET first_add = NVL(new_first, first_add)John -
Is there any way to rewrite this query?
Is there room for improvement/rewrite for this query so that it performs well?
select distinct shp_locn
from shp_mstr
where zone = to_char(:b3)
and locn_class = 'r'
and aisle = 'GX-08'
and dock = 'KN'
and locn_id not in (select locn_id from tmp_shp_out_dtl)
order by shp_locnuser659394 wrote:
Alex,
Stop your st_u_pi_d f_u_c__king sarcasm. There were lots of instances like the below thread
where you bring your boring sarcasm to meaningful technical discussions.
If you dont want to answer, just leave it..... you C__u__n__t
Error for a SELECT COUNT ... in stored proc
Alex was giving you perfectly valid assistance.
Your post has now been reported to the moderators as it is completely offensive, unprofessional and unnecessary. -
Hello,
I would like to ask you about advice.
We have MSSQL 2008 R2, 32 bit. Memory is 4GB, split into 2GB for Windows and 2GB for applications. Database has recovery model simple because we have replicated data into other servers ( 2 ). Contemporary we work with 2 servers. Max memory for MSSQL is 2048
MB.
We set the backup as follows:
USE MSDB
GO
DECLARE @JMENO_ZALOHY VARCHAR(120)
SELECT @JMENO_ZALOHY = 'E:\backup\BackupSQL\1 Pondeli\DAVOSAM_'+ convert( varchar(2), datepart( hh, getdate() ) ) + '00_DEN_DIFF.bak'
SELECT @JMENO_ZALOHY
BACKUP DATABASE [DAVOSAM]
TO DISK = @JMENO_ZALOHY
WITH INIT, DIFFERENTIAL, CHECKSUM, COMPRESSION
GO
Every second or third day in log there is error message: 'There is insufficient system memory in resource pool 'internal' to run this query' Accurate in time of backup. The error is still repeat, majority in working hours.
Today I have found out, that problem is probably in compression of backup. Because if I removed word: compression, a backup normally runs without error.
Question: Is my hypothesis correct that problem is in backup with compression?
Thank you DavidHello, today evening I have ran backup command bellow. All is OK. Probably MSSQL has cleaned memory. Next attempt I will try in peak next week.
Since time I have removed word compression, in error log is not any error.
I have checked memory as soon as memory gets on top, it is about 1.707 GB the MSSQL writes into log this messgages:
2014-03-14 15:00:04.63 spid89 Memory constraints resulted reduced backup/restore buffer sizes. Proceding with 7 buffers of size 64KB.
2014-03-14 15:00:08.74 Backup Database differential changes were backed up. Database: DAVOSAM, creation date(time): 2014/01/12(22:03:10), pages dumped: 16142, first LSN: 1894063:1673:284,
last LSN: 1894063:1792:1, full backup LSN: 1894053:15340:145, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'E:\backup\BackupSQL\5 Patek\DAVOSAM_1500_DEN_DIFF.bak'}). This is an informational message. No user action is required.
2014-03-14 15:00:12.79 spid72 Memory constraints resulted reduced backup/restore buffer sizes. Proceding with 7 buffers of size 64KB.
2014-03-14 15:00:12.88 Backup Database differential changes were backed up. Database: WEBFORM, creation date(time): 2014/02/01(05:22:47), pages dumped: 209, first LSN: 125436:653:48, last
LSN: 125436:674:1, full backup LSN: 125435:689:36, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'E:\backup\BackupSQL\5 Patek\WEBFORM_1500_DEN_DIFF.bak'}). This is an informational message. No user action is required.
After that the MSSQL reduced memory on 1.692.
USE MSDB
GO
DECLARE @JMENO_ZALOHY VARCHAR(120)
SELECT @JMENO_ZALOHY = 'E:\backup\BackupSQL\6 Sobota\DAVOSAM_'+ convert( varchar(2), datepart( hh, getdate() ) ) + '00_DEN_FULL.bak'
SELECT @JMENO_ZALOHY
BACKUP DATABASE [DAVOSAM]
TO DISK = @JMENO_ZALOHY
WITH INIT, CHECKSUM, COMPRESSION, MAXTRANSFERSIZE=65536
GO
E:\backup\BackupSQL\6 Sobota\DAVOSAM_2100_DEN_FULL.bak
(1 row(s) affected)
Processed 467240 pages for database 'DAVOSAM', file 'DavosAM_Data' on file 1.
Processed 2 pages for database 'DAVOSAM', file 'DavosAM_Log' on file 1.
BACKUP DATABASE successfully processed 467242 pages in 24.596 seconds (148.411 MB/sec).
select * from sys.dm_exec_connections
where net_packet_size > 8192
session_id most_recent_session_id connect_time net_transport protocol_type
protocol_version endpoint_id encrypt_option auth_scheme
node_affinity num_reads num_writes last_read last_write net_packet_size client_net_address
client_tcp_port local_net_address local_tcp_port
connection_id parent_connection_id most_recent_sql_handle
(0 row(s) affected)
SELECT SUM (pages_allocated_count * page_size_in_bytes)/1024 as 'KB Used', mo.type, mc.type
FROM sys.dm_os_memory_objects mo
join sys.dm_os_memory_clerks mc on mo.page_allocator_address=mc.page_allocator_address
GROUP BY mo.type, mc.type, mc.type
ORDER BY 1 DESC;
KB Used type type
29392 MEMOBJ_SORTTABLE MEMORYCLERK_SQLSTORENG
9392 MEMOBJ_SOSNODE MEMORYCLERK_SOSNODE
8472 MEMOBJ_SQLTRACE MEMORYCLERK_SQLGENERAL
5480 MEMOBJ_SECOLMETACACHE USERSTORE_SCHEMAMGR
5280 MEMOBJ_RESOURCE MEMORYCLERK_SQLGENERAL
5008 MEMOBJ_CACHEOBJPERM USERSTORE_OBJPERM
4320 MEMOBJ_SOSSCHEDULER MEMORYCLERK_SOSNODE
2864 MEMOBJ_PERDATABASE MEMORYCLERK_SQLSTORENG
2328 MEMOBJ_SQLCLR_CLR_EE MEMORYCLERK_SQLCLR
2288 MEMOBJ_SESCHEMAMGR USERSTORE_SCHEMAMGR
2080 MEMOBJ_SOSDEADLOCKMONITORRINGBUFFER MEMORYCLERK_SQLSTORENG
2008 MEMOBJ_LOCKBLOCKS OBJECTSTORE_LOCK_MANAGER
1584 MEMOBJ_CACHESTORETOKENPERM USERSTORE_TOKENPERM
1184 MEMOBJ_LOCKOWNERS OBJECTSTORE_LOCK_MANAGER
840 MEMOBJ_SNIPACKETOBJECTSTORE OBJECTSTORE_SNI_PACKET
760 MEMOBJ_SOSDEADLOCKMONITOR MEMORYCLERK_SQLSTORENG
752 MEMOBJ_SESCHEMAMGR_PARTITIONED USERSTORE_SCHEMAMGR
688 MEMOBJ_RESOURCEXACT MEMORYCLERK_SQLSTORENG
616 MEMOBJ_SOSWORKER MEMORYCLERK_SOSNODE
552 MEMOBJ_METADATADB MEMORYCLERK_SQLGENERAL
480 MEMOBJ_SRVPROC MEMORYCLERK_SQLCONNECTIONPOOL
424 MEMOBJ_SQLMGR CACHESTORE_SQLCP
400 MEMOBJ_SBOBJECTPOOLS OBJECTSTORE_SERVICE_BROKER
384 MEMOBJ_SUPERLATCH_BLOCK MEMORYCLERK_SQLSTORENG
384 MEMOBJ_RESOURCEDATASESSION MEMORYCLERK_SQLGENERAL
352 MEMOBJ_SOSSCHEDULERMEMOBJPROXY MEMORYCLERK_SOSNODE
328 MEMOBJ_SBMESSAGEDISPATCHER MEMORYCLERK_SQLSERVICEBROKER
320 MEMOBJ_METADATADB USERSTORE_DBMETADATA
296 MEMOBJ_INDEXSTATSMGR MEMORYCLERK_SQLOPTIMIZER
264 MEMOBJ_LBSSCACHE OBJECTSTORE_LBSS
224 MEMOBJ_XE_ENGINE MEMORYCLERK_XE
216 MEMOBJ_GLOBALPMO MEMORYCLERK_SQLGENERAL
208 MEMOBJ_PROCESSRPC USERSTORE_SXC
200 MEMOBJ_SYSTASKSESSION MEMORYCLERK_SQLCONNECTIONPOOL
200 MEMOBJ_REPLICATION MEMORYCLERK_SQLGENERAL
192 MEMOBJ_SOSSCHEDULERTASK MEMORYCLERK_SOSNODE
176 MEMOBJ_SQLCLRHOSTING MEMORYCLERK_SQLCLR
168 MEMOBJ_SYSTEMROWSET CACHESTORE_SYSTEMROWSET
128 MEMOBJ_RESOURCESUBPROCESSDESCRIPTOR MEMORYCLERK_SQLGENERAL
128 MEMOBJ_CACHESTORESQLCP CACHESTORE_SQLCP
128 MEMOBJ_RESOURCESEINTERNALTLS MEMORYCLERK_SQLSTORENG
120 MEMOBJ_BLOBHANDLEFACTORYMAIN MEMORYCLERK_BHF
120 MEMOBJ_SNI MEMORYCLERK_SNI
88 MEMOBJ_QUERYNOTIFICATON MEMORYCLERK_SQLOPTIMIZER
72 MEMOBJ_HOST MEMORYCLERK_HOST
72 MEMOBJ_INDEXRECMGR MEMORYCLERK_SQLOPTIMIZER
64 MEMOBJ_RULETABLEGLOBAL MEMORYCLERK_SQLGENERAL
56 MEMOBJ_SERVICEBROKER MEMORYCLERK_SQLSERVICEBROKER
56 MEMOBJ_REMOTESESSIONCACHE MEMORYCLERK_SQLGENERAL
56 MEMOBJ_PARSE CACHESTORE_PHDR
48 MEMOBJ_CACHESTOREBROKERTBLACS CACHESTORE_BROKERTBLACS
48 MEMOBJ_APPENDONLYSTORAGEUNITMGR MEMORYCLERK_SQLSTORENG
40 MEMOBJ_SBASBMANAGER MEMORYCLERK_SQLSERVICEBROKER
32 MEMOBJ_OPTINFOMGR MEMORYCLERK_SQLOPTIMIZER
32 MEMOBJ_SBTRANSPORT MEMORYCLERK_SQLSERVICEBROKERTRANSPORT
32 MEMOBJ_CACHESTOREBROKERREADONLY CACHESTORE_BROKERREADONLY
32 MEMOBJ_DIAGNOSTIC MEMORYCLERK_SQLGENERAL
32 MEMOBJ_UCS MEMORYCLERK_SQLSERVICEBROKER
24 MEMOBJ_STACKSTORE CACHESTORE_STACKFRAMES
24 MEMOBJ_CACHESTORESXC USERSTORE_SXC
24 MEMOBJ_FULLTEXTGLOBAL MEMORYCLERK_FULLTEXT
24 MEMOBJ_APPLOCKLVB OBJECTSTORE_LOCK_MANAGER
24 MEMOBJ_FULLTEXTSTOPLIST CACHESTORE_FULLTEXTSTOPLIST
24 MEMOBJ_CONVPRI CACHESTORE_CONVPRI
16 MEMOBJ_SQLCLR_VMSPY MEMORYCLERK_SQLCLR
16 MEMOBJ_VIEWDEFINITIONS MEMORYCLERK_SQLOPTIMIZER
16 MEMOBJ_SBACTIVATIONMANAGER MEMORYCLERK_SQLSERVICEBROKER
16 MEMOBJ_AUDIT_EVENT_BUFFER OBJECTSTORE_SECAUDIT_EVENT_BUFFER
16 MEMOBJ_HASHGENERAL MEMORYCLERK_SQLQUERYEXEC
16 MEMOBJ_SBTIMEREVENTCACHE MEMORYCLERK_SQLSERVICEBROKER
16 MEMOBJ_ASYNCHSTATS MEMORYCLERK_SQLGENERAL
16 MEMOBJ_BADPAGELIST MEMORYCLERK_SQLUTILITIES
16 MEMOBJ_QSCANSORTNEW MEMORYCLERK_SQLQUERYEXEC
16 MEMOBJ_SCTCLEANUP MEMORYCLERK_SQLGENERAL
16 MEMOBJ_XP MEMORYCLERK_SQLXP
8 MEMOBJ_SECURITY MEMORYCLERK_SQLGENERAL
8 MEMOBJ_CACHESTOREBROKERRSB CACHESTORE_BROKERRSB
8 MEMOBJ_EXCHANGEXID MEMORYCLERK_SQLGENERAL
8 MEMOBJ_CACHESTOREVENT CACHESTORE_EVENTS
8 MEMOBJ_CACHESTOREXPROC CACHESTORE_XPROC
8 MEMOBJ_DBMIRRORING MEMORYCLERK_SQLUTILITIES
8 MEMOBJ_SERVICEBROKERTRANSOBJ CACHESTORE_BROKERTO
8 MEMOBJ_CACHESTOREOBJCP CACHESTORE_OBJCP
8 MEMOBJ_CACHESTOREXMLDBELEMENT CACHESTORE_XMLDBELEMENT
8 MEMOBJ_ENTITYVERSIONINFO MEMORYCLERK_SQLSTORENG
8 MEMOBJ_AUDIT_MGR MEMORYCLERK_SQLGENERAL
8 MEMOBJ_EXCHANGEPORTS MEMORYCLERK_SQLGENERAL
8 MEMOBJ_DEADLOCKXML MEMORYCLERK_SQLSTORENG
8 MEMOBJ_CACHESTORETEMPTABLE CACHESTORE_TEMPTABLES
8 MEMOBJ_HTTPSNICONTROLLER MEMORYCLERK_SQLHTTP
8 MEMOBJ_CACHESTOREVIEWDEFINITIONS CACHESTORE_VIEWDEFINITIONS
8 MEMOBJ_CACHESTOREPHDR CACHESTORE_PHDR
8 MEMOBJ_CACHESTOREXMLDBTYPE CACHESTORE_XMLDBTYPE
8 MEMOBJ_CACHESTORE_BROKERUSERCERTLOOKUP CACHESTORE_BROKERUSERCERTLOOKUP
8 MEMOBJ_EVENTSUBSYSTEM MEMORYCLERK_SQLGENERAL
8 MEMOBJ_CACHESTOREBROKERDSH CACHESTORE_BROKERDSH
8 MEMOBJ_SOSDEADLOCKMONITORXMLREPORT MEMORYCLERK_SQLSTORENG
8 MEMOBJ_CACHESTOREXMLDBATTRIBUTE CACHESTORE_XMLDBATTRIBUTE
8 MEMOBJ_CACHESTOREBROKERKEK CACHESTORE_BROKERKEK
8 MEMOBJ_QPMEMGRANTINFO MEMORYCLERK_SQLQUERYEXEC
8 MEMOBJ_CACHESTOREQNOTIFMGR CACHESTORE_NOTIF
(101 row(s) affected)
David -
There is an insufficient memory to run this query.
I am getting an error :
there is an insufficient memory to run this query Error: 701, Severity: 17, State: 42
The instance is SQL 2005 instance with SP2.
Please help.SQLServer 2005 SP4
I have a same problem getting the error
2014-06-04 17:52:08.77 spid104 Error: 701, Severity: 17, State: 123.
2014-06-04 17:52:08.77 spid104 There is insufficient system memory to run this query.
2014-06-04 17:52:08.78 spid104 Error: 701, Severity: 17, State: 130.
2014-06-04 17:52:08.78 spid104 There is insufficient system memory to run this query.
Our queries are running so slow already.
2014-06-04 17:52:08.85 spid5s
Memory node Id = 0
VM Reserved = 1186200 KB
VM Committed = 218572 KB
AWE Allocated = 15843328 KB
SinglePage Allocator = 263344 KB
MultiPage Allocator = 21752 KB
2014-06-04 17:52:08.85 spid5s
MEMORYCLERK_SQLQUERYEXEC (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 25792 KB
MultiPage Allocator = 1040 KB
2014-06-04 17:52:08.85 spid5s
MEMORYCLERK_SQLOPTIMIZER (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 29360 KB
MultiPage Allocator = 384 KB
2014-06-04 17:52:08.85 spid5s
MEMORYCLERK_SQLUTILITIES (Total)
VM Reserved = 960 KB
VM Committed = 960 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 37672 KB
MultiPage Allocator = 0 KB
2014-06-04 17:52:08.85 spid5s
MEMORYCLERK_SQLQERESERVATIONS (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 408408 KB
MultiPage Allocator = 0 KB
2014-06-04 17:52:08.85 spid5s
CACHESTORE_OBJCP (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 51352 KB
MultiPage Allocator = 760 KB
2014-06-04 17:52:08.85 Server
Memory node Id = 0
VM Reserved = 1186200 KB
VM Committed = 218572 KB
AWE Allocated = 15843328 KB
SinglePage Allocator = 263360 KB
MultiPage Allocator = 21752 KB
2014-06-04 17:52:08.85 spid5s
CACHESTORE_PHDR (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 20832 KB
MultiPage Allocator = 136 KB
2014-06-04 17:52:08.85 Server
MEMORYCLERK_SQLQUERYEXEC (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 25792 KB
MultiPage Allocator = 1040 KB
2014-06-04 17:52:08.85 Server
MEMORYCLERK_SQLOPTIMIZER (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 29368 KB
MultiPage Allocator = 384 KB
2014-06-04 17:52:08.85 Server
MEMORYCLERK_SQLUTILITIES (Total)
VM Reserved = 960 KB
VM Committed = 960 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 37672 KB
MultiPage Allocator = 0 KB
2014-06-04 17:52:08.86 Server
MEMORYCLERK_SQLQERESERVATIONS (Total)
VM Reserved = 0 KB
VM Committed = 0 KB
AWE Allocated = 0 KB
SM Reserved = 0 KB
SM Committed = 0 KB
SinglePage Allocator = 408408 KB
MultiPage Allocator = 0 KB
Maybe you are looking for
-
Can you use Apple education discount in store?
I'm a sixth form student, and I have a UniDays student discount which allows me to get up to 15% off a Macbook on the Apple store. Can I use this discount to buy a Macbook in an Apple store? And also because the Apple education pricing states univers
-
Some TV shows in iTunes but not Apple TV menu
I noticed that some shows (in this case, 30 Rock) do not show up in any of the Apple TV menus - even with a straight search. The shows are, however, available in iTunes on my Mac. Is there any way to purchase and manage these shows from the TV, or do
-
Hi I need help ..I do not know how to edit a pdf file that I scanned in,
Hi I need help ..I do not know how to edit a pdf file that I scanned in, will someone please tell me what I should do PLEASE HELP
-
Hi, In weblogic 9.0 document http://edocs.bea.com/wls/docs90/notes/new.html#1198903, it says it implements jaxp 1.2, but also says the default parser is the one that is shipped in JDK 5.0. I checked and found "The J2SE 5 platform includes a reference
-
Deactivate a muse site from domain
Hi there, I created an adobe muse site and hosted it with a Go Daddy domain for my sister. It became too hard for mw to always maintain the site so my sister created another site but still wants to keep the domain name for her new site. How do I deac