Forcing nologging hint in the delete statement
Hi,
We are forcing nologging hint in the delete statement to improve the performance of delete statement.
DELETE /*+ nologging */ FROM A
Table and Tablespace level Logging is set to Yes. Our database is running in archivelog mode and we have physical standby database.
I would like to know the following.
1. redo entries will be generated or not during the delete opeation with nologging hint
2. If no, how records will be deleted in the standby database
3. Do we really gain performance with nologging in the delete statement
Thanks.
You mean that, nologgin hint ...First, there is no such thing as a nologging hint. At least I've never heard of one, documented or undocumented.
Second, as Herman said, DELETE is always logged. In fact DML is always logged except for direct path inserts.
Similar Messages
-
The DELETE statement conflicted with the REFERENCE constraint "FK_Equipment_Assets". The conflict occurred in database "WorkOrderSystem", table "dbo.Equipment", column 'AssetCode'
ya that's true row is referenced by another table.....but i want the row to referred by another table ,I don't know how to fix it
Actually this is not a C# issue. It is a T-SQl issue.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=transactsql
The above link should be posted.
Per my understanding, first you should
delete the record from the Foreign Table and then after you have to delete the record from the Primary Key table
Hope it helps you.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
iPhone 4S with the latest updates 8.1.3 (12B466) installed.
When I switch back to an ongoing application, from the switcher, it reverts to its own 'homepage' rather than the stay at the state/stage I left it at.
How can I force applications to maintain the current state?
I am in the process of getting enough screenshots to demonstrate further.ios7 keeps refreshing apps after switching
solcwd -
SQL error msg - The DELETE statement conflicted with the SAME TABLE REFERENCE constraint
Executed as user: ****. The DELETE statement
conflicted with the SAME TABLE REFERENCE constraint "FK_PARENT_TASK_REF".
The conflict occurred in database "****", table "****", column
'PARENT_TASK_ID'. [SQLSTATE 23000] (Error 547) The statement has been
terminated. [SQLSTATE 01000] (Error 3621). The step failed.
Does this error msg indicate the whole script failed to execute or was it just a single step/task that failed ?
What does error msg mean ?
Anyway to prevent this error msg and ensure script runs successfullyHi mdavidh,
This error occurs because the record 'PARENT_TASK_ID' was referenced by 'FK_PARENT_TASK_REF'.
Please refer below codes:
CREATE TABLE MyTable (
ID INT, primary key(ID), -- primary key
ID_Parent INT foreign key(ID_Parent) references MyTable(ID), -- foreign key reference the same table
insert into MyTable(ID,ID_Parent)
values(0,0);
insert into MyTable(ID,ID_Parent)
values(1,0);
insert into MyTable(ID,ID_Parent)
values(2,0);
insert into MyTable(ID,ID_Parent)
values(3,1);
insert into MyTable(ID,ID_Parent)
values(4,3);
insert into MyTable(ID,ID_Parent)
values(5,4);
CREATE TRIGGER MyTrigger
on MyTable
instead of delete
as
set nocount on
update MyTable set ID_Parent = null where ID_Parent in (select ID from deleted)
delete from MyTable where ID in (select ID from deleted)
Now we could delete records.
delete from MyTable where ID_Parent=0
Thanks,
Candy Zhou -
How to delete the data from KNVP without using the delete statement
Hello friends,
I have a requirement that I have to delete the data from KNVP table without using any delete statement. For it I have to use the Standard BAPI or any standard program.
Can you please tell me the name of the standard program or BAPI to delete the data .
Thanks in Advance
KuldeepHello Raymond,
I have use the function 'CUSTOMER_UPDATE' in which I only gives the data in T_XKNVP table only but still the data is not get deleting. Please see the code below.
=============================================================
REPORT ZK_TEST2 .
data :
I_KNA1 LIKE KNA1,
I_KNB1 LIKE KNB1,
I_KNVV LIKE KNVV,
I_YKNA1 LIKE KNA1,
I_YKNB1 LIKE KNB1.
Data :
T_XKNAS LIKE FKNAS occurs 0,
T_XKNB5 LIKE FKNB5 occurs 0,
T_XKNBK LIKE FKNBK occurs 0,
T_XKNVA LIKE FKNVA occurs 0,
T_XKNVD LIKE FKNVD occurs 0,
T_XKNVI LIKE FKNVI occurs 0,
T_XKNVK LIKE FKNVK occurs 0,
T_XKNVL LIKE FKNVL occurs 0,
T_XKNVP LIKE FKNVP occurs 0 with header line,
T_XKNVS LIKE FKNVS occurs 0,
T_XKNEX LIKE FKNEX occurs 0,
T_XKNZA LIKE FKNZA occurs 0,
T_YKNAS LIKE FKNAS occurs 0,
T_YKNB5 LIKE FKNB5 occurs 0,
T_YKNBK LIKE FKNBK occurs 0,
T_YKNVA LIKE FKNVA occurs 0,
T_YKNVD LIKE FKNVD occurs 0,
T_YKNVI LIKE FKNVI occurs 0,
T_YKNVK LIKE FKNVK occurs 0,
T_YKNVL LIKE FKNVL occurs 0,
T_YKNVP LIKE FKNVP occurs 0 with header line,
T_YKNVS LIKE FKNVS occurs 0,
T_YKNEX LIKE FKNEX occurs 0,
T_YKNZA LIKE FKNZA occurs 0.
T_XKNVP-KUNNR = '7000002648' .
*T_XKNVP-VKORG = '0001' .
*T_XKNVP-VTWEG = '01' .
*T_XKNVP-SPART = '01' .
T_XKNVP-KZ = 'D' .
append T_XKNVP to T_XKNVP.
CALL FUNCTION 'CUSTOMER_UPDATE'
EXPORTING
I_KNA1 = I_KNA1
I_KNB1 = I_KNB1
I_KNVV = I_KNVV
I_YKNA1 = I_YKNA1
I_YKNB1 = I_YKNB1
TABLES
T_XKNAS = T_XKNAS
T_XKNB5 = T_XKNB5
T_XKNBK = T_XKNBK
T_XKNVA = T_XKNVA
T_XKNVD = T_XKNVD
T_XKNVI = T_XKNVI
T_XKNVK = T_XKNVK
T_XKNVL = T_XKNVL
T_XKNVP = T_XKNVP
T_XKNVS = T_XKNVS
T_XKNEX = T_XKNEX
T_XKNZA = T_XKNZA
T_YKNAS = T_YKNAS
T_YKNB5 = T_YKNB5
T_YKNBK = T_YKNBK
T_YKNVA = T_YKNVA
T_YKNVD = T_YKNVD
T_YKNVI = T_YKNVI
T_YKNVK = T_YKNVK
T_YKNVL = T_YKNVL
T_YKNVP = T_YKNVP
T_YKNVS = T_YKNVS
T_YKNEX = T_YKNEX
T_YKNZA = T_YKNZA
============================================================= -
How to add the delete statement in this procedure.
I got a string from user e.g. 1,2,3 and userid =14 from user;
I wrote a procedure that will insert the record as follows;
Userid newsletterid
14 1
14 2
14 3
The procedure is
CREATE OR REPLACE PROCEDURE usersubscription_procd (vuserid in number, vnewsletterid IN VARCHAR2)
AS
I NUMBER;
J NUMBER;
VAL VARCHAR2(100);
BEGIN
I := 1;
J := 1;
WHILE INSTR(vnewsletterid,',',I) != 0 LOOP
VAL := SUBSTR(vnewsletterid,I,INSTR(vnewsletterid,',',I)-J);
I := INSTR(vnewsletterid,',',I)+1;
J := I;
INSERT INTO usersubscription (usersubcriptionid,userid,newsletterid)
VALUES (usersubscription_seq.nextval,vuserid,VAL);
END LOOP;
VAL := SUBSTR(vnewsletterid,I,LENGTH(vnewsletterid));
INSERT INTO usersubscription (usersubcriptionid,userid,newsletterid)
VALUES (usersubscription_seq.nextval,vuserid,VAL);
END;
Now one requirement is that
When next string comes like 1,4 for same user
Then I want to delete the 2 and 3 and insert the 4 .
Please tell me solution.Hi,
Try to delete all record from ther current user :
CREATE OR REPLACE PROCEDURE usersubscription_procd (vuserid in number, vnewsletterid IN VARCHAR2)
AS
I NUMBER;
J NUMBER;
VAL VARCHAR2(100);
BEGIN
begin
delete usersubscription where userid = vuserid;
exception when others then null;
end;
I := 1;
J := 1;
WHILE INSTR(vnewsletterid,',',I) != 0 LOOP
VAL := SUBSTR(vnewsletterid,I,INSTR(vnewsletterid,',',I)-J);
I := INSTR(vnewsletterid,',',I)+1;
J := I;
INSERT INTO usersubscription (usersubcriptionid,userid,newsletterid)
VALUES (usersubscription_seq.nextval,vuserid,VAL);
END LOOP;
VAL := SUBSTR(vnewsletterid,I,LENGTH(vnewsletterid));
INSERT INTO usersubscription (usersubcriptionid,userid,newsletterid)
VALUES (usersubscription_seq.nextval,vuserid,VAL);
END;
/Nicolas. -
Table Update using Nolog/Hint
Hi all
Although we can insert records using /nolog so that they are not added into archive logs.
We required using this for table update for some large routene updates which in any way does not effect the integrity of the database.
This table updation facility using /nolog was not available in earlier versions.
Alternate solution for temporarily turning the database into Noarchivelog ->Fire update statement ->Turn database into archivelog mode is not acceptable as the database is production database where certain users are always on with their routene small entry/updation jobs.
I want to know whether this has been enhanced in Oracle 10g or is there any work around by way of giving some hints at the update statement. As large table updation generating too much archive logs are not really desired in certain cases.
Suresh BansalMr. Sayed
Thanks for reply. Insert idea is given just for the available workaround when required and to link this to the subject of discussion. Idea is when Oracle has provided some workaround for Inserting records without loging , why they have not provide so for update.
Pl. advise some workaround for the large update problem.
In Oracle 10g, the default is 'database force logging'. Hence, even nologging transaction, oracle will force to create logging.I would request you to elaborate this. We installed Oracle 10g at one site and the database runs in Noarchive log which is default installation in Windows 2003 server. I could not understand what you mean by default 'database force logging'
Suresh Bansal -
Script for handling triggers and delete statements
Hello,
currently I'm facing a problem which I don't know how to deal with.
We need a script which deletes/disables two triggers first, then delete some data and afterwards create/enable the triggers again.
I didn't find a proper hint how to cover this with dbmcli, probably we have to use a "higher" language..?!?!
Is it possible at all to provide "dbmcli -i" with a file including sql statements like the example afterwards ?
Is it possible to disable/enable triggers or do I have to delete and create them ?
e.g.:
disable/drop trigger trig_a
disable/drop trigger trig_b
delete from a where....
delete from b where...
enable/create trigger trig_a...
enable/create trigger trig_b...
used maxDB version is 7.5.0.38
any hint appreciated....GERD.....Hi Gerd,
please be aware that DBMCLI is a DBMServer client, not a SQL client (although it can tunnel some sql through the DBMServer).
Better use SQLCLI for things like that.
And. no, you cannot switch triggers on and off - just drop and recreate them.
But you may specify the IGNORE TRIGGER keyword for the delete statements.
That way you can leave the triggers just as they are.
p.s.
Any reason to stay on super old 7.5 ?
regards,
Lars -
Prallel query and Delete statements
Hi Gurus, need your help in understanding parallel execution
We are noticing that delete statements are executing very slowly when parallel query is forced. Is this expected?
All the literature that I read says that parallel query has no impact on DML statements. Yet, the query plan on the delete statement shows that it will be executed in parallel mode. This could mean that the scan portion is happening in parallel but the delete operation itself is happening in serial, correct?
I tested in various servers and multiple tables before posting my question here. They all seem to show consistent results. Delete statements are twice slower when parallel query is forced. The same happens when parallel degree is set in table definition.
For your information, we are running 10g on windows server with 15 million rows in table, 5 million rows being deleted with the statement. There is one index on the table and it doesn’t match the columns in query. Query plan shows full table scan. Table is not portioned.
Thanks for your help in advanceParallel DML is supported by Oracle. Obviously when enabled, it can impact a DML statement.. (what literature have you read that said otherwise?)
The delete operation itself is done in parallel using rowid ranges (e.g. each PQ slave process does a distinct physical "piece" of the table).
Parallel DML should typically speed up the process. Why? Because I/O itself has latency. The process needs to wait (idle CPU time) for the I/O operation to complete before continuing.
So let's assume the process can only do a 100 deletes per second. The actual I/O channel is capable of a 1000 I/O's per second. But due to inherant latency, the "max delete speed limit" for a procces is a 100 I/O's per second. The full capacity of the I/O channel is thus not used (and cannot be used by a single process).
Parallel Query enables more processes to do I/O in order to utilise this "max speed limit".
Why would you see a degradation in performance? It could be due to overutilising the I/O channels (attempting to go faster than the speed limit so to say).
It could be due to some other contention in Oracle or even the o/s. You will need to investigate the wait state and events of the PQ processes to try and determine the probable cause. -
Delete statement is not working.
Hi,
find the code. Here the delete statement is not working and i am getting sy-subrc = 4. although ,
xe1edp10-idnkd = 34596 and dint_edidd -sdata = 34596.
please help me ...
loop at dekek_x.
loop at dint_edidd where segnam = 'E1EDP10'.
if dekek_x-stpin = 1 .
CLEAR xe1edp10.
MOVE dint_edidd-sdata TO xe1edp10.
delete dint_edidd where sdata = xe1edp10-idnkd.
endif.
endloop.1st thing..
i tried this :
tables: edidd, e1edp10.
edidd-sdata = '315934 EA 017'.
WRITE edidd-sdata.
move edidd-sdata to e1edp10.
IF edidd-sdata = e1edp10-idnkd.
WRITE: e1edp10-idnkd.
else.
WRITE: 'nothing'.
ENDIF.
output
>315934 EA 017
>315934 EA 017
2nd thing,.
your loop inside loop doesnt make any sense as they are not related any where.
3rd thing:
the fields are not type compatible.. this might be the reason for wrong delete statement..
and 1 more clarification:
TABLES: edidd, e1edp10.
DATA :it TYPE TABLE OF edidd WITH HEADER LINE.
edidd-sdata = '315934 EA 017'.
WRITE edidd-sdata.
APPEND edidd TO it.
edidd-sdata = '315934 EA 018'.
APPEND edidd TO it.
LOOP AT it." where segnam = 'E1EDP10'.
CLEAR e1edp10.
MOVE it-sdata TO e1edp10.
DELETE it WHERE sdata = e1edp10-idnkd.
ENDLOOP.
in this also delete is working perfectly fine... you run and check.. -
Hi there, I have created this code below. The select statement works, however the delete statement does not work.
DECLARE
@CategoryASVARCHAR(255)
DECLARE
@NameASVARCHAR(255)
DECLARE
@Name1ASVARCHAR(255)
DECLARE
@ParentTypeAsint
SET
@Category='General
Building Data'
SET
@Name='Purchase
Date'
SET
@Name1='Purchase
Cost'
Set
@ParentType=20
Select
*fromtbAttributeValueA
Join
tbAttributeTemplateDefinitionLinkATDLONATDL.AttributeTemplateDefinitionLinkID=A.AttributeTemplateDefinitionLinkID
Join
tbAttributeTemplateDefinitionATDONATD.AttributeTemplateDefinitionID=ATDL.AttributeTemplateDefinitionID
JOIN
tbAttributeSetSONS.AttributeSetID=ATDL.LinkedParentID
Where
S.ParentType=@ParentType
AND
S.Name=@Category
AND
([email protected]=@Name1)
AND
A.Value=0
delete
fromtbAttributeValueA
Join
tbAttributeTemplateDefinitionLinkATDLONATDL.AttributeTemplateDefinitionLinkID=AttributeTemplateDefinitionLinkID
Join
tbAttributeTemplateDefinitionATDONATD.AttributeTemplateDefinitionID=ATDL.AttributeTemplateDefinitionID
JOIN
tbAttributeSetSONS.AttributeSetID=ATDL.LinkedParentID
Where
S.ParentType=@ParentType
AND
S.Name=@Category
AND
([email protected]=@Name1)
AND
A.Value=0
The delete statement fails on the first join. Incorrect Syntax near 'A'. What am I doing wrong? As I have only changed the select * to delete. So therefore does this mean I need to put the delete statement into a
sql sub query? Or is there another way of doing this?Try this:
DELETE FROM tbAttributeValue
FROM tbAttributeTemplateDefinitionLink ATDL
JOIN tbAttributeValue t
ON ATDL.AttributeTemplateDefinitionLinkID = t. AttributeTemplateDefinitionLinkID
JOIN tbAttributeTemplateDefinition ATD
ON ATD.AttributeTemplateDefinitionID = ATDL.AttributeTemplateDefinitionID
JOIN tbAttributeSet S
ON S.AttributeSetID = ATDL.LinkedParentID
WHERE S.ParentType = @ParentType
AND S.NAME = @Category
AND ( ATD.NAME = @Name
OR ATD.NAME = @Name1 )
AND A.Value = 0 -
Question about delete statement
I have question about delete statement...
i am performing some simple delete statement against one table..but its taking so long..How can we check whether particular delete statements actually deleting records or not..?Is the associated select-statement returning rows or not?
If yes -> delete is deleting
If no -> delete is just using CPU-cycles
To tune the delete-statement, you have to tune the corresponding select-statement. To tune the select-statement, you want to read the thread When your query takes too long ... -
DELETE STATEMENT IN ECC6.0
HI,
How to use the DELETE statement in ECC6.0.
when i am using this statement , it is going to short dump.
Delete itab from wtab.
pls let me know
i am getting the error ,
convert the charater to numerics, only numerics are supported in at the argument position , bcos it is a unicode program.
let me know pls .
regards,hi,
chk the syntax:
DELETE - itab_lines
Syntax
... itab [FROM idx1] [TO idx2] [WHERE log_exp]... .
Extras:
1. ... FROM idx1
2. ... TO idx2
3. ... WHERE log_exp
Effect
To delete several lines at once, you have to specify at least one of the additions FROM, TO, or WHERE. You can only use the additions FROM and TO with standard tables and sorted tables.
If you specify several of the additions, the rows are deleted that result from the intersection of the individual additions.
Addition 1
... FROM idx1
Effect
If you specify FROM, all the table rows from the table index idx1 onwards are included. idx1 must be a data object with type i. If the value of idx1 is less than or equal to 0, a runtime error occurs. If the value is greater than the number of table rows, no rows are deleted.
Addition 2
... TO idx2
Effect
If you specify TO, only the table rows up to table index idx2 are included. idx2 must be a data object with type i. If the values of idx2 is less than or equal to 0, a runtime error occurs. If the value is greater than the number of table rows, it is set to the number of rows. If idx2 is less than idx1, no rows are deleted.
Addition 3
... WHERE log_exp
Effect
You can specify any logical expression log_exp after WHERE, for which the first operand of each individual comparison is a component of the internal table. This enables all logical expression with the exception of IS ASSIGNED, ISREQUESTED, and IS SUPPLIED. The dynamic specification of components using character-type data objects in parentheses is not supported here. All rows for which the logical expression is true are deleted.
hope this helps u,
keerthi -
Oracle deadlocks on delete statement
I had a package procedure that deletes from a inline-view. It worked well and didn't create any database locks, looked like this:
PROCEDURE serverdisconnect(pCode1 NUMERIC, pCode2 NUMERIC) IS
BEGIN
DELETE FROM
SELECT cl.* FROM CurrentLogins cl, Accounts a
WHERE cl.Code1 = pCode1
AND cl.Code2 = pCode2
AND cl.Code = a.code
AND a.Type = 'lplayer'
ORDER BY a.code
COMMIT;
END serverdisconnect;I slightly changed the procedure to look like following, and deadlocks started to come:
PROCEDURE ServerDisconnect(pCode1 NUMERIC, pCode2 NUMERIC, pChannelServerCode CurrentLogins.ChannelServerCode%TYPE, pDeleteList OUT cursor_type)
IS
vDeleteList sys.ODCINumberList;
BEGIN
DELETE FROM
SELECT cl.* FROM CurrentLogins cl, Accounts a
WHERE cl.Code1 = pCode1
AND cl.Code2 = pCode2
AND cl.Code = a.code
AND cl.ChannelServerCode = pChannelServerCode
AND cl.Code = a.code
AND a.Type = 'lplayer'
) RETURNING Code
BULK COLLECT INTO vDeleteList;
OPEN pDeleteList FOR
SELECT * FROM TABLE(vDeleteList);
COMMIT;
END ServerDisconnect;As you see the main difference in the delete statement is that i removed "ORDER BY"-clause? Can really such data ordering plays a role with dead locking? Does the data records be always ordered with ORDER-BY-clause same way always to avoid deadlock? Why i started to get deadlock after changing the procedure?
I have Oracle 10g.Yes, typo, i fixed initial post now.
Delete will be technically done on table CurrentLogins, using that inline-view.
I will move the Commit to proper place as you suggested.
but still i don't understand why deadlocks started to occure.
Maybe really the answer is having "order by" clause, which solves the deadlocks?
See this link:
http://www.oracle-base.com/articles/misc/Deadlocks.php
>
To resolve the issue, make sure that rows in tables are always locked in the same order.
>
Does it says that i always have to have "order by" sentence included into my delete statement?
Relationships between tables:
alter table CURRENTLOGINS
add constraint FK_CURRENTLOGINS_ACCOUNTS foreign key (CODE)
references ACCOUNTS (CODE);Maybe ORDER-BY really solves deadlocks then, see:
http://www.dbasupport.com/forums/archive/index.php/t-50438.html
>
Add an explicit ORDER BY to the select, and it will probably go away.
>
Edited by: CharlesRoos on Sep 9, 2010 6:05 AM -
hi,
We have a performance issue the delete statements on the database are running very slow they are taking about 12 hours.
the delete statements are like
DELETE table_name
WHERE column1 = 'temp'
AND col2 LIKE 'A%'
AND col3 = 0;
that table has an composite index with 5 columns and the columns specified in the delete statements are in the order
column1 position 4
col2 position 3
col3 position 5
no additional indexes are present on the tableAs already suggested get an execution plan for the deletes to see what it is doing to make informed decisions about what to do.
Until then ...
You said you have one index on 5 columns
WHERE column1 = 'temp'
AND col2 LIKE 'A%'
AND col3 = 0;
that table has an composite index with 5 columns and the columns specified in the delete statements are in the order
column1 position 4
col2 position 3
col3 position 5Oracle might be doing a skip scan on the index or a full table scan - it is possible neither is efficient for your operation. An index ordered by # of unique values (most unique first) on column1, col2, col3 might help performance on this delete if a small percentage of rows are being deleted (anywhere from 5% to maybe 30%, it depends). If a large percentage of rows are being deleted then a full table scan might be better.
If you have the license and the database is set up for it parallel DML is a possiblity - check the on-line documentation to see how to do the delete in parallel.
Maybe you are looking for
-
Mac OS 10.4.11 to Mac OS 9.2.0 Problem
I have a wonderful Power Mac G3 Blue. Its was running fine. Then I just started it up the other day. It was starting up on Mac OS X 10.4.11. Then one day I started it up and It started up on Mac OS X 9.2 and I didn't do anything to it to do this so.
-
How can I retrive photos deleted from my iPhone ?
I accidentally deleted some photos on my iPhone while copying them onto my PC using windows explorer. Is there anyway to retrieve them back, those photos are very important.
-
R/3 ISA B2B: Catalog Views
Hello experts in the group, I need to create catalog views for R/3 ISA B2B application. I have to use cross division 00 to handle multiple sales areas and I want to address these divisions using catalog views. I already have one of the four product c
-
How to get file names of processes
i am writing an application engine for monitoring ps jobs and processes i want to send an email to support group with log file if any process runs to error. Can anybody tell me how to get the log/trace files generated for each process. i tried many w
-
I have turned off and on the password setting,, still doesn't help