Solved

How to use a Commit when we are  deleting the   Large amont of data

Posted on 2011-09-05
6
280 Views
Last Modified: 2012-05-12
Hi

We are using the Oracle 10g database ,We are using the Script to delete the data older than six months, if it fails for one table than everything Rollbacks,
 How to use commit command in between so that after deleting few tables it can commit in between.or can we use the commit command for each each table .
Please suggest asasp!!

Thanks in advance
Raj.
0
Comment
Question by:nrajasekhar7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 36482688
- you can write a procedure for the delete operations and specify a commit after each table delete.
- or in your script, you can put a commit after each table delete operation eg:

delete tablename1 where ... ;
commit;
delete tablename2 where ... ;
commit;
0
 
LVL 15

Expert Comment

by:x77
ID: 36482863
Depending of size of tables and number of rows to delete, this task become complex as you need take care about redo log size, time to delete ...

If the size is aceptable, do one commit only as some table information can be related to other tables.
Include a Whenever sentence to do roolback.

WHENEVER SQLERROR {EXIT [SUCCESS | FAILURE | WARNING | n | variable | :BindVariable] [COMMIT | ROLLBACK] | CONTINUE [COMMIT | ROLLBACK | NONE]}

0
 
LVL 7

Accepted Solution

by:
Docteur_Z earned 500 total points
ID: 36485032
You need to know the functionnal of application (or at least its LDM) to design the order op delete operation.
Sometimes with foreign key cascading constraints you have to pay attention to manipulated data volume.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 5

Expert Comment

by:Sanjeev Labh
ID: 36491840
If you are using proper foreign keys. Then you use the on delete cascade clause so if any dependency it will automatically cater it otherwise you can rollback. Depending upon the average data being deleted you can provide the commit within the iteration likewise.
0
 
LVL 2

Expert Comment

by:quistlogic
ID: 36493009
You can use Truncate which doesn't need a Commit.

Truncate Table1;
Truncate Table2;
etc...

You cannot roll-back from a Truncate.
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 36509394
Add exception handling to your code block which has delete statements and handle the exception/error and do a commit in the exception section.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question