Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 4 of 4

Thread: Purge (PL/)SQL script

  1. #1
    Senior Member fid509's Avatar
    Join Date
    Feb 2002
    Location
    Brussels
    Posts
    381

    Question Purge (PL/)SQL script

    Hello,

    I created an Oracle SQL script that deletes closed incidents and related data from eg. clocks, activity,etc. older then 2 years. This works fine except that there is always be room for improvement. One of the shortcomings in the script is the lack of flexibility. Now it contains for every a-table in Oracle a seperate and almost similar line of SQL in the script. If I add an array, in for example probsummary, I have to remember to put an extra line into the SQL script.
    So I would like to put some kind of loop in the script that tells the script to do the delete for every probsummaryaxx tables it could find in the database. The same applies for each of the related tables.
    I think I have to resort to PL/SQL for that but I don't know anything about PL/SQL programming. Can somebody give me some tips on how this could be done?

  2. #2
    Administrator tommy's Avatar
    Join Date
    Nov 2001
    Location
    Copenhagen
    Posts
    4,272

    Default

    I can't help You with PL/SQL but I wonder why don't You just create a purge schedule in servicecenter? If You make sure the erddefs and joindefs are correct deleting an incident will delete all related files and You don't have to worry about updating a purge routine when adding new arrays.
    Best regards Tommy
    Blog - - ITIL certified - Accredited Integration Specialist – HP OpenView Service Management

    Want to keep this site alive? Consider making a donation. Click here.

  3. #3
    Senior Member fid509's Avatar
    Join Date
    Feb 2002
    Location
    Brussels
    Posts
    381

    Default

    On the volume of incidents I'm talking about it would take SC hours to complete the job. SQL is much faster, plus I rebuild all the indexes after the purge.

  4. #4
    Senior Member fid509's Avatar
    Join Date
    Feb 2002
    Location
    Brussels
    Posts
    381

    Default

    Never mind, I teached myself PL/SQL in 4 hours with a little aid of google

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts