Solved

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

Posted on 2011-09-05
6
278 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

821 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