How to delete large data using XML batch in chunk
public void DeleteListItems(SPWeb web, SPList list)
RMPExceptionManager.LogErrorInFile("--------Delete List Items from : " + list + " starts--------", true);
try
web.AllowUnsafeUpdates = true;
StringBuilder builder = new StringBuilder();
builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Batch>");
string s = "<Method>" +
"<SetList Scope=\"Request\">" + list.ID + "</SetList>" +
"<SetVar Name=\"ID\">{0}</SetVar>" +
"<SetVar Name=\"Cmd\">Delete</SetVar>" +
"</Method>";
foreach (SPListItem item in list.Items)
builder.Append(string.Format(s, item.ID.ToString()));
builder.Append("</Batch>");
web.ProcessBatchData(builder.ToString());
web.AllowUnsafeUpdates = false;
RMPExceptionManager.LogErrorInFile("--------Delete List Items from : " + list + " ends--------", true);
catch (Exception ex)
RMPExceptionManager.LogErrorInFile("--------delete List Items exception--------", bIsLogEnabled);
RMPExceptionManager.LogErrorInFile(ex.Message, bIsLogEnabled);
RMPExceptionManager.LogErrorInFile(ex.Source, bIsLogEnabled);
RMPExceptionManager.LogErrorInFile(ex.StackTrace, bIsLogEnabled);
RMPExceptionManager.LogErrorInFile("-------------------------------------------------------", bIsLogEnabled);
I am using the above code to delete the data from list.
currently its not deleting properly as its executing huge xml batch.
How can I change the above code in to chunk of 1000 so that I can delete 25000 records easily?
I tried the below code but its not working properly.
first time when it comes in do loop its deleting the records one by one and not using batch of 1000.
after some time(aprox 30 min) it starts executeing batch of 1000 but not deleting whole records. out of 10,000 its deleting hardly 7000 then stops the delete process and jumps on next step.
I am not getting why its showing this behaivour ? Is it time out after some time in xml batch? but its still executing the other code after comming out of delete function.
web.AllowUnsafeUpdates = true;
StringBuilder builder = new StringBuilder();
builder.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Batch>");
string s = "<Method>" +
"<SetList Scope=\"Request\">" + list.ID + "</SetList>" +
"<SetVar Name=\"ID\">{0}</SetVar>" +
"<SetVar Name=\"Cmd\">Delete</SetVar>" +
"</Method>";
// Query to get the unprocessed items.
SPQuery query = new SPQuery();
query.RowLimit = 1000;
query.Query = "<Where></Where>";
do
SPListItemCollection remainingItems = list.GetItems(query);
foreach (SPListItem item in remainingItems)
builder.Append(string.Format(s, item.ID.ToString()));
builder.Append("</Batch>");
web.ProcessBatchData(builder.ToString());
query.ListItemCollectionPosition = remainingItems.ListItemCollectionPosition;
RMPExceptionManager.LogErrorInFile("--------Delete batch remaining : " + remainingItems.ListItemCollectionPosition + " --------", true);
} while (query.ListItemCollectionPosition != null);
any body got this type of issue?
is there any problem in above code?
is there any other way to do this deletion process in better way?
Similar Messages
-
How to delete Master data using Process Chain
I need to delete data in respective data targets such as Infocubes, DSOs & Master data Infoobjects. It was fine with Infocubes & DSOs using respective process type. But the issue is with Master data Infoobjects.
Is there any process type by using which I can delete data in Master data Infoobjects using process chain?Murali,
Master data object process type is not there because in BW, master data is conformed or is shared by other infoproviders. Due to this dependency, master data loading is a bit more complex. You need to drop all the data from all the infproviders which are using the master data you want to delete.
-Saket -
How to delete the data from partition table
Hi all,
Am very new to partition concepts in oracle..
here my question is how to delete the data from partition table.
is the below query will work ?
delete from table1 partition (P_2008_1212)
we have define range partition ...
or help me how to delete the data from partition table.
Thanks
Sree874823 wrote:
delete from table1 partition (P_2008_1212)This approach is wrong - as Andre pointed, this is not how partition tables should be used.
Oracle supports different structures for data and indexes. A table can be a hash table or index organised table. It can have B+tree index. It can have bitmap indexes. It can be partitioned. Etc.
How the table implements its structure is a physical design consideration.
Application code should only deal with the logical data structure. How that data structure is physically implemented has no bearing on application. Does your application need to know what the indexes are and the names of the indexes,in order to use a table? Obviously not. So why then does your application need to know that the table is partitioned?
When your application code starts referring directly to physical partitions, it needs to know HOW the table is partitioned. It needs to know WHAT partitions to use. It needs to know the names of the partitions. Etc.
And why? All this means is increased complexity in application code as this code now needs to know and understand the physical data structure. This app code is now more complex, has more moving parts, will have more bugs, and will be more complex to maintain.
Oracle can take an app SQL and it can determine (based on the predicates of the SQL), which partitions to use and not use for executing that SQL. All done totally transparently. The app does not need to know that the table is even partitioned.
This is a crucial concept to understand and get right. -
How to delete aggreagetd data in a cube without deleting the Aggregates?
Hi Experts,
How to delete aggreagetd data in a cube without deleting the Aggregates?
Regards
Alok KashyapHi,
You can deactivate the aggregate. The data will be deleted but structure will remain.
If you switch off the aggregates it wont be identified by the OLAP processor. report will fetch the data directly from the cube. Switching off the aggreagte won't delete any data,but temporarly the aggregate will not be availbale as if it is not built on the info cube. No reporting is not possible on swtiched off aggregates. The definition of the aggregate is not deleted.
You can temporarily switch off an aggregate to check if you need to use it. An aggregate that is switched off is not used when a query is executed.This aggregate will be having data from the previous load's. If the aggregate is switched off means it wont be available for reporting but data can be rolled up into it.
If u deactivate the aggregates the data will be deleted from the aggregates and the aggregate structure will remain the same.
The system deletes all the data and database tables of an aggregate. The definition of the aggregate is not deleted.
Later when you need those aggregate once again you have to create it from scratch.
Hope this helps.
Thanks,
JituK -
How to insert the data from XML to a table
Hi,
I'm using Oracle 10g Express Edition
I need help in How to insert the data from XML file into the table.
Below is the example i'm working on..
I have create ridb user with below mentioned privileges:
Account Status Locked Unlocked
Default Tablespace: USERS
Temporary Tablespace: TEMP
User Privileges :
Roles:
CONNECT
RESOURCE
Direct Grant System Privileges:
CREATE DATABASE LINK
CREATE MATERIALIZED VIEW
CREATE PROCEDURE
CREATE PUBLIC SYNONYM
CREATE ROLE
CREATE SEQUENCE
CREATE SYNONYM
CREATE TABLE
CREATE TRIGGER
CREATE TYPE
CREATE VIEW
& table is created TRIALZIPCODES below mentioned is the DDL:
CREATE TABLE TRIALZIPCODES
STATE_ABBR VARCHAR2(20) NOT NULL
, ZIP_CODE NUMBER(10, 0) NOT NULL
, ZIP_CODE_EXT VARCHAR2(20)
Below is the XML FILE: which is stored in C:\OracleProject Folder
File name: trial.xml
<?xml version="1.0" ?>
<metadata>
- <Zipcodes>
- <mappings Record="4">
<STATE_ABBREVIATION>CA</STATE_ABBREVIATION>
<ZIPCODE>94301</ZIPCODE>
</mappings>
- <mappings Record="5">
<STATE_ABBREVIATION>CO</STATE_ABBREVIATION>
<ZIPCODE>80323</ZIPCODE>
<ZIP_CODE_EXTN>9277</ZIP_CODE_EXTN>
</mappings>
</Zipcodes>
</metadata>
PL/SQL Procedure:which i'm trying to execute from SQLDeveloper
create or replace
PROCEDURE TRIAL AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
begin
-- DBMS_XMLGEN.setRowTag ( ctx IN ctxHandle, rowTag IN VARCHAR2);
-- DBMS_XMLGEN.setRowSetTag ( ctx IN ctxHandle, rowSetTag IN VARCHAR2);
-- the name of the table as specified in our DTD
DBMS_XMLGEN.SETROWSETTAG(l_context_handle,'zipcodes');
-- the name of the data set as specified in our DTD
DBMS_xmlgen.setRowTag(l_context_handle,'mappings');
-- for getting the output on the screen
dbms_output.enable(1000000);
-- open the XML document in read only mode
v_FileHandle := utl_file.fopen('c:/OracleProject','trial.xml', 'r');
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
-- for inserting the XML data into the table
insCtx := DBMS_XMLSTORE.NEWCONTEXT('RIDB.TRIALZIPCODES');
insCtx := DBMS_XMLSTORE.INSERTXML(insCtx, finalStr);
dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
DBMS_XMLStore.closeContext(insCtx);
END;
END TRIAL;
For the first time when i complied i got the errors as :
Procedure RIDB.PROCEDURE1@RIDB
Error(16,14): PLS-00201: identifier 'UTL_FILE' must be declared
Error(16,14): PL/SQL: Item ignored
Error(29,1): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(29,1): PL/SQL: Statement ignored
Error(33,1): PL/SQL: Statement ignored
Error(33,19): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(36,1): PL/SQL: Statement ignored
Error(36,17): PLS-00320: the declaration of the type of this expression is incomplete or malformed
So i logged in as sys & grant the permission to execute on UTL_FILE to ridb (user):
SQL Statement:
grant execute on utl_file to ridb
So, it got compiled successfully but when i execute it gives me error as:
Source does not have a runnable target.
What does this mean?
So I browse through forum & i got to know that i need to initial the UTL_FILE_DIR ="C:/OracleProject" in init.ora
So can i edit the init.ora with notepad.When i tried to do that it says permission denied
In my system it shows the init.ora file in path C:\oraclexe\app\oracle\product\10.2.0\server\config\scripts
but there is also other file initXETemp in the same path do i need to do the changes in it.
I have tried even editing the SPFILE as mentioned below:
C:\oraclexe\app\oracle\product\10.2.0\server\dbs\SPFILEEXE - I had edit this file using notepad & set the value of UTL_FILE_DIR ="C:/OracleProject". So next time when i restarted i'm unable to log on to the database.
So i had reinstall the software again.
Could you please let me know how to proceed..hi,
I have created the directory from sys database
CREATE or replace DIRECTORY XML_DIR2 AS 'C:\OracleProject';
& grant read,write access to the user
grant read,write on directory XML_DIR2 to RIDB;
& i had change the tag name in the xml file as shown below:
<?xml version = '1.0'?>
<metadata>
<Zipcodes>
<mappings Record="4">
<STABBRE>CA</STABBRE>
<ZIPCODE>94301</ZIPCODE>
</mappings>
<mappings Record="5">
<STABBRE>CO</STABBRE>
<ZIPCODE>80323</ZIPCODE>
<ZIPCODEEXT>9277</ZIPCODEEXT>
</mappings>
</Zipcodes>
</metadata>
TRIALZIPCODE table as shown below:
CREATE TABLE "RIDB"."TRIALZIPCODE"
( "STABBRE" VARCHAR2(20 BYTE),
"ZIPCODE" NUMBER(*,6) NOT NULL ENABLE,
"ZIPCODEEXT" NUMBER
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
I have tried two methods as shown below:
Procedure 1:
create or replace
PROCEDURE TRIAL_V2 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
insCtx := DBMS_XMLStore.newContext('DEV.TRIALZIPCODES');
DBMS_XMLStore.setUpdateColumn(insCtx, 'STABBRE');
DBMS_XMLStore.setUpdateColumn(insCtx, 'ZIPCODE');
DBMS_XMLStore.setUpdatecolumn(insCtx, 'ZIPCODEEXT');
DBMS_XMLStore.setRowTag(insCtx, 'mappings');
cnt := DBMS_XMLStore.insertXML(insCtx, xmldoc);
DBMS_XMLStore.closeContext(insCtx);
END;
Procedure 1 was compiled with out errors but when i execute i got the error as :
Source does not have a runnable target.
Procedure 2_
CREATE OR REPLACE PROCEDURE TRIAL_V3 AS
BEGIN
DECLARE
-- declare attributes
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
v_FileHandle UTL_FILE.FILE_TYPE;
l_context_handle dbms_xmlgen.ctxHandle;
insCtx DBMS_XMLStore.ctxType;
cnt NUMBER;
xmldoc xmltype := xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') );
--XML_DIR VARCHAR2(40) := 'C:\\OracleProject';
BEGIN
INSERT INTO trialzipcode (STABBRE, ZIPCODE, ZIPCODEEXT)
SELECT extractvalue(x.column_value, 'mappings/STABBRE'),
extractvalue(x.column_value, 'mappings/ZIPCODE'),
extractvalue(x.column_value, 'mappings/ZIPCODEEXT')
FROM TABLE(
XMLSequence(
EXTRACT(
xmltype( bfilename('XML_DIR2','trialxml.xml'), nls_charset_id('AL32UTF8') ),
'metadata/Zipcodes/mappings'
) x
END;
END TRIAL_V3;
Procedure 2 was complied without errors but when i execute i got the error as:
Connecting to the database RIDB.
ORA-22288: file or LOB operation FILEOPEN failed
The system cannot find the file specified.
ORA-06512: at "SYS.DBMS_LOB", line 523
ORA-06512: at "SYS.XMLTYPE", line 287
ORA-06512: at "RIDB.TRIAL_V3", line 12
ORA-06512: at line 2
Process exited.
Disconnecting from the database RIDB.
Could you please let me know how to proceed... -
How to delete no longer use Purchase Requisition
Dear Experts,
How to delete no longer use Purchase Requisition, thanks!
Wilson HongHi Hong,
Hope you are looking for archiving PR. Please refer below link.
http://help.sap.com/saphelp_nw04s/helpdata/EN/8d/3e4c11462a11d189000000e8323d3a/frameset.htm
As per SAP you cant delete any data....you can only archive it.
Cheers
Arun. -
How to connect mysql database using xml
welcome to all,
here my doubt is how to connect mysql database using xml file, how to integrate xml file and jsp file and how to access data from dabase using jsp file. can any one help me
regardsShort answer: you wouldn't do any of those things. The first two are meaningless and the third is a bad practice. I have no idea what those ideas were supposed to achieve so I have no idea what tutorials I should suggest to you.
-
hi everyone...i want to upload a video to youtube from my desktop application. i went through the following link.
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html#Sending_a_Resumable_Upload_API_Request
it is for sending data using XML. but i don't know how to send data using XML. can someone give me an insight of data POST'ing using XML? any help is appreciated.actually i saw the following segment in this link :
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_resumable_uploads.html#Sending_a_Resumable_Upload_API_Request
POST /resumable/feeds/api/users/default/uploads HTTP/1.1
Host: uploads.gdata.youtube.com
Authorization: AuthSub token="DXAA...sdb8"
GData-Version: 2
X-GData-Key: key=adf15ee97731bca89da876c...a8dc
Content-Length: 1941255
Slug: my_file.mp4
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
<media:title type="plain">Bad Wedding Toast</media:title>
<media:description type="plain">
I gave a bad toast at my friend's wedding.
</media:description>
<media:category
scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People
</media:category>
<media:keywords>toast, wedding</media:keywords>
</media:group>
</entry> -
Delete Master Data using Process Chain?
Hi Friends,
How do I delete Master Data using Process Chain?
Thanks,
PradeepHi Bhanu,
I am not sure why we would want to delete MD. But that is the task given to me. I actually know it is not possible. But is there a way to delete MD using chains?
Thanks,
Pradeep -
How to delete selective data in a cube
Hi all,
Can any one tell me, how to delete selective data in a cube. For example if i want to delete data corresponding particular Matrial Id or particular Customer ID (say C400) ? And even deleting the data based on particular Request numer.?
Sandy.Hi,
RSMO > Infocube > Manage > contents tab > selective deletion
Then define your selections for deletions (Matrial Id or particular Customer ID (say C400)).
Request based deletions can be done directly from Request tab.
Thanks,
JituK -
How to delete multiple data domains with single step ?
how to delete multiple data domains with single step ?
You can go to your Endeca-Server domain home e.g.($WEBLOGIC-HOME$/user_projects/domains/endeca_server_domain/EndecaServer/bin)
run
[HOST]$ ./endeca-cmd.sh list-dd
default is enabled.
GettingStarted is enabled.
endeca is enabled.
BikeStoreTest is enabled.
create a new file from the output just with the domains that you want to delete and then create a loop
[HOST]$ vi delete-dd.list
default
GettingStarted
endeca
BikeStoreTest
[HOST]$ for i in $(cat delete-dd.list); do; ./endeca-cmd.sh delete-dd $i; done
Remember that this can not be undone, unless you have a backup. -
How to delete some date in target table at a mapping?
How to delete some date in target table at a mapping?
I extract date from source tabel into target table,
but before extract date I want to delete some date from target?
how to do?Just to change a bit of terminology in the reply, within the mapping, click on operator properties and choose TRUNCATE/INSERT.
Note that truncate is dependent on constraints, so you probably must disable those before doing this. You can of course do DELETE/INSERT...
Jean-Pierre -
How to delete spotlight data in macbook air ?
how to delete spotlight data in macbook air ?
Open system preferences and go to Spotlight then to the privacy tab and add the Macintsoh HD to the list for "Prevent Spotlight from searching these locations. That will remove all spotlght data. Then you should highlight that entry and click the Minus ( - ) sign at the bottom to have spotlight reindex your drive.
-
How to send an email using XML Publisher
Can any body help me how to send an email using XML Publisher.
Regards,
SureshSorry ,
when a http://blogs.oracle.com/xmlpublisher/newsItems/departments/documentDelivery
this it show this not answer the question.
Thanks
Welcome to Oracle Blogs
Welcome to the Oracle blogging community, where Oracle executives, employees, and non-employees exchange views about customer requirements and best practices.
We're sorry, the weblog you requested cannot be accessed.
- You may not have the necessary permission for access the weblog.
- This weblog does not exist.
You may wish to try again using one of the tools below.
- Check the URL and contact your System Administrator for access.
- Or click here to go back to Oracle Blogs homepage.
Powered by
Movable Type and Oracle
The views expressed on this blog are my own and do not necessarily reflect the views of Oracle. Terms of Use -
How to delete the data based on concurrent request Id
Hi
from account receivable to gl i am posted a cheque through concurrent program.
right now my problem is I want to delete that data in database tables based on concurrent request id.
how to delete that data based on concurent request id, Please give me some suggessionsWhat is the application version ? what exactly you want to achieve ?
Direct deletion is not recommended in oracle application database.
regards,
Maybe you are looking for
-
Hi All, I need to make some changes to Accounting Document line items just before they are saved. Basically i have to consolidate the FI line items so that they do not exceed 999. I tried some BTE but SAP is over writing my changes after the BTE is c
-
What is the quickest way to get a new iPhone swapped for my current iPhone?
Hello all, I'm in search of a solution for my parents. The conundrum is this: Parents have a pair of iPhone 4 8GB picked up for free on contract back in 2010 from Verizon Wireless. They're interested in the new iPhone (6) and would like to get replac
-
Too many photos in catalog ??
Greetings Everyone, I've been using LR3 since Beta 1.(no previous LR experience). I transferred about 11000 photos from PSE 3 to LR3. Did lots of processing, keywording etc and whittled the total to about 8300. I really liked the process and enjoy
-
hello plz help me what is roll area and user context????? reply thaknx aafaq husain
-
Hello, With the following functions "SAP_EC_SUS_ADMIN_VENDOR" or "SAP_EC_SUS_ADMIN_PURCHASER" it is possible to allow the administrator to create/view/copy/change and delete the users. We don't want that the users have the capacity to delete/copy or