Purge script for 11g database

Hi All,
I have a database with version
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionI have a purge script to purge the database which is not working. Can anyone tell has oracle released any purge scripts for purging 11G database.
DECLARE
   MAX_CREATION_DATE timestamp;
   MIN_CREATION_DATE timestamp;
   batch_size integer;
   max_runtime integer;
   retention_period timestamp;
  BEGIN
   MIN_CREATION_DATE := to_timestamp('2012-03-10','YYYY-MM-DD');
   MAX_CREATION_DATE := to_timestamp('2012-03-20','YYYY-MM-DD');
    max_runtime := 20;
    retention_period := to_timestamp('2012-03-20','YYYY-MM-DD');
   batch_size := 20000;
     soa.delete_instances(
     min_creation_date => MIN_CREATION_DATE,
     max_creation_date => MAX_CREATION_DATE,
     batch_size => batch_size,
     max_runtime => max_runtime,
     retention_period => retention_period,
     purge_partitioned_component => false);
  END;Thanks
DUOS

You need to be more specific.
First, you said that you wanted to purge your database, and then the tablespace, and finally, some tables...
If you want to flush data from a table completelly, use TRUNCATE TABLE.
If you want to remove some rows of that table, use DELETE FROM TABLE WHERE [your condition here]

Similar Messages

  • Oracle SQL template to create re-usable DDL/DML Scripts for Oracle database

    Hi,
    I have a requirement to put together a Oracle SQL template to create re-usable DDL/DML Scripts for Oracle databases.
    Only the Oracle DBA will be running the scripts so permissions is not an issue.
    The workflow for any DDL is as follows:-
    1) New Table
    a. Check if the table exists from the system/admin views.
    b. If table exists then give message "Table Exists"
    c. If table does not exist then execute DDL code
    2) Add Column
    a. Check if Column exists for a given table from system/admin views
    b. If column exists in the specified table,
    b1. backup table.
    b2. alter table to make changes to the column
    b3. verify data or execute dml script convert from backup to the new change.
    c. If Column does not exist
    c1. backup table
    c2. alter table to add column
    c3. execute dml to populate column with default value.
    The DML scripts are for populating base tables with data required for business operations.
    3) Add new row
    a. check if row exists by comparing old values of each column with new values to be added for the new record.
    b. If exists, give message row exists
    c. If not exists, add new record.
    4) Update existing record (We have createtime columns in these tables so changes can be tracked)
    a. check if row exists using primary key.
    b. If exists,
    b1. deactivate the record using the "active" column of the table
    b2. Add new record with the changes required.
    c. If does not exist, add new record with the changes required.
    Could you please help with some ideas which can get this done accurately?
    I have tried several ways, but I am not able to put together something that fulfills all requirements.
    Thank you,

    First let me address your question. (This is the easy part.)
    1. The existence of tables can be found in DBA_TABLES. Query it and and then use conditional logic and execute immediate to process the DDL.
    2. The existence of table columns is found in DBA_TAB_COLUMNS. Query it and then conditionally execute your DDL. You can copy the "before picture" of the table using that same dba view, or even better, use DBMS_METADATA.
    As for your DML scripts, they should be restartable, reversible, and re-run-able. They should "fail gracefully" on error, be written in such a way that they can run twice in a row without creating duplicate changes.
    3. Adding appropriate constraints can prevent invalid duplicate rows. Also, you can usually add to the where clause so that the DML does only what it needs to do without even relying on the constraint (but the constraint is there as a safeguard). Look up the MERGE statement to learn how to do an UPSERT (update/insert), which will let you conditionally "deactivate" (update) or insert a record. Anything that you cannot do in SQL can be done with simple procedural code.
    Now, to the heart of the matter...
    You think I did not understand your requirements?
    Please be respectful of people's comments. Many of us are professionals with decades of experience working with databases and Oracle technology. We volunteer our valuable time and knowledge here for free. It is extremely common for someone to post what they feel is an easy SQL or PL/SQL question without stating the real goal--the business objective. Experienced people will spot that the "wrong question" has been asked, and then cut to the chase.
    We have some good questions for you. Not questions we need answers from, but questions you need to ask yourself and your team. You need to reexamine this post and deduce what those questions are. But I'll give you some hints: Why do you need to do what you are asking? And will this construct you are asking for even solve the root cause of your problems?
    Then ponder the following quotations about asking the right question:
    Good questions outrank easy answers.
    — Paul Samuelson
    The only interesting answers are those which destroy the questions.
    — Susan Sontag
    The scientific mind does not so much provide the right answers as ask the right questions.
    — Claude Levi-Strauss
    You can tell whether a man is clever by his answers. You can tell whether a man is wise by his questions.
    — Mahfouz Naguib
    One hears only those questions for which one is able to find answers.
    — Friedrich Nietzsche
    Be patient towards all that is unresolved in your heart and try to love the questions themselves.
    — Rainer Maria Rilke
    What people think of as the moment of discovery is really the discovery of the question.
    — Jonas Salk
    Judge a man by his questions rather than his answers.
    — Voltaire
    The ability to ask the right question is more than half the battle of finding the answer.
    — Thomas J. Watson

  • How to install Oracle Change Management Pack for 11g database.

    Hi,
    I need to setup "Oracle Change Management Pack" for my oracle11g database. Can any body help to do the same. i am able to configure following.
    Oracle Configuration Management Pack
    Oracle Data Masking Pack
    Oracle Diagnostic Pack
    Oracle Tuning Pack
    using following URL
    http://docs.oracle.com/cd/B28359_01/license.111/b28287/options.htm#CIHBGJCC but not able to install "Oracle Change Management Pack for 11g database". Can any body share any pointers if any...
    Regards
    DBA.

    As far as I could understand, this is a part of Oracle EM/Grid installation:
    The sections that follow describe the Oracle management packs. The management packs can be purchased only with Enterprise Edition. The features in these packs are accessible through Oracle Enterprise Manager Database Control, Oracle Enterprise Manager Grid Control, and APIs provided with Oracle Database software.

  • Recommended Third Party Archive and Purging Software for Oracle Database (Oracle CC&B)

    Hi,
    We are currently exploring third party archive and purging software for Oracle Database specifically used by an Oracle Customer Care and Billing implementation. Our current data is growing that we think archiving and purging is a now a viable option. Thanks.
    Regards,
    Dennis

    According to the fine Oracle® Utilities Application Framework Administration Guide Chapter 17, "Archiving and Purging" is readily available to CC&B.

  • Where can I download the agent for 11g database for 10.2.0.4 grid control?

    where can I download the agent for 11g database for 10.2.0.4 grid control? i can't find the link.

    I don't think there is one yet, but you can use Grid Control 10gR4 to monitor a 11g database. Please refer the certification matrix in Note 412431.1 Oracle Enterprise Manager 10g Grid Control Checker

  • Performance Tuning For 11g Database

    I've heard some Oracle DBA's suggest / recommend that specific parameters be tuned in the O.S. for using Linux as a dedicated Oracle 11g database server. I'm guess those parameters vary greatly based on utilization, hardware, and various other factors. I just wanted to ask if there are some soft or safe performance adjustments I can make which regardless of other various factors that are unknown would most likely benefit and or improve database performance?
    Here is what I know:
    - OS = RHEL 6.2 or OEL 6.2 64-bit
    - RAM = 4 GB
    - x2 Quad Core Xeon CPU's
    Thanks for shedding any light on this for me...

    >
    I've heard some Oracle DBA's suggest / recommend that specific parameters be tuned in the O.S. for using Linux as a dedicated Oracle 11g database server. I'm guess those parameters vary greatly based on utilization, hardware, and various other factors. I just wanted to ask if there are some soft or safe performance adjustments I can make which regardless of other various factors that are unknown would most likely benefit and or improve database performance?
    >
    ALWAYS read and follow the instructions provided by Oracle in the installation guide. It discusses the very issue you mention.
    http://docs.oracle.com/cd/E11882_01/install.112/e24321.pdf
    There is even a section for 'Configuring Kernel Parameters for Linux'
    After you read the installation guide and evaluate your own installation environment if you have any specific questions then post them. And if you intend to 'guess those parameters vary greatly based on utilization, hardware, and various other factors' then it should be obvious that you need to provide information on 'utilization, hardware, and various other factors' or we won't be able to help you with your specific use case.

  • Alter table script for wrong database version

    When we generate an alter table script by connecting to a database, the scripts that get generated are for database version 7.3.
    Furthermore we cannot update the field "oracle version" for the database we created.
    When we choose a database version from the pulldown box and try to save it, the field is blank again.
    We are on Designer 9 on a oracle 10g database and we try to alter the table in a oracle 10g database.

    I had this error last night while applying a patch to 6.0. However in my case the version was 21 versus a required version of 23.
    As far as i know 6.1 is not compatible with the 5 db schema, so you will need an update / migration plan for the db also.

  • Patch set for 11g database.

    From where can I download the patchset for oracle 11g database?
    Regards,
    Atif Iqbal

    Any patchset for 11g release 1/2You can download 11gR2 (11.2.0.2.0/11.2.0.1.0) or 11gR1 (11.1.0.7.0/11.1.0.6.0) directly from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html and you do not need to apply any patchset on top of it.
    and also the meta notes access.Since you do not have a CSI number, I believe this will not be helpful -- We cannot post the contents of MOS (Metalink) docs since this violates Oracle support agreement policy.
    Thanks,
    Hussein

  • Running a oracle script for multible database on same server

    Hello friends
    I am thinking of creating a script in HP UX which will run a SQL script on multiple oracle in same server. I can do this for one oracle but i'm unable to do it for multiple database.
    I need to do newid oraSID user every time for diff. database .. can u suggest something..
    regards
    Ashish

    Hi Markus,
    Its not working .. When i run this script from my ID, it says SQLPLUS not found. see this .. i have created 1 sql file and 1 script file to call it with exporting ORACLE_HOME & ORACE_SID for one of the system E40.
    Can you suggest something ..
    er3asu82:(/tmp)(xchason)#ll /tmp/testsql.sql /tmp/testscr.dat
    -rwxrwxrwx   1 xchason    dba            109 Aug  9 11:10 /tmp/testscr.dat
    -rwxrwxrwx   1 xchason    dba             32 Aug  9 11:08 /tmp/testsql.sql
    er3asu82:(/tmp)(xchason)#cat /tmp/testsql.sql
    select * from v$instance;
    quit
    er3asu82:(/tmp)(xchason)#cat /tmp/testscr.dat
    #! /bin/ksh
    export ORACLE_HOME=/oracle/E40/102_64
    export ORACE_SID=E40
    sqlplus "/as sysdba" @testsql.sql
    er3asu82:(/tmp)(xchason)#/tmp/testscr.dat
    /tmp/testscr.dat[5]: sqlplus:  not found
    Again when i try to run this from other orasid, it does not work as well..
    er3asu82:oraq52 1> /tmp/testscr.dat
    Error 6 initializing SQL*Plus
    Message file sp1<lang>.msb not found
    SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
    thanks
    ashish

  • Minimum parameters and values required for 11g database

    Hi
    Can anyone please provide me with the list of parameters and the minimum value required for these parameters in 11g database (11.1.0.6.0).
    Thanks

    user8940828 wrote:
    Thanks for your help
    But this basic parameters did not mention the following parmeters . What can be the mimimum value that can be assigned to these parameters.
    dml_locks
    log_checkpoint_interval
    log_checkpoint_timeout
    open_cursors
    open_links
    parallel_max_servers
    processes
    session_cached_cursors
    session_max_open_files
    job_queue_processes
    log_buffer
    shared_pool_size
    sort_area_retained_size
    sort_area_size
    db_cache_size
    pga_aggregate_target
    ThanksI suggest you to start letting the default parameters and then tune them step-by-step.
    Eg:
    - open_links => If you dont have database links you can avoid to set it.
    - processes: number of backgroud processes + expected session/users for your application. if you have 1000 users connecting at the same time you would set a value higher than 1000.
    - shared_pool_size, db_cache_size, sort_area_size, pga_aggregate_target are not mandatory if you use automatic memory management by Oracle.
    - etc.

  • RMAN Backup script for RAC Database..please suggest

    Hi All,
    I am currently working on backup policy for RAC Database for my client.The client requirement is to backup while database is shutdown(mount state).I have made below script and could any one please suggest what further things should I need to add with below rman script.
    echo "Shutdown Database";date
    srvctl stop database -d PROD
    srvctl status database -d PROD
    echo "Database shutdown on";date
    echo "Mount Database ";date
    srvctl start instance -d PROD -i "PROD1" -o mount
    srvctl status database -d PROD
    echo "Start Full Database Backup on";date
    $ORACLE_HOME/bin/rman target / nocatalog <<EOF
    configure controlfile autobackup on;
    configure controlfile autobackup format for device type disk to '/BACKUP/PRODBKP/%F';
    run{
    allocate channel c1 device type disk connect 'sys/******@node1-vip:1521/PROD';
    allocate channel c2 device type disk connect 'sys/*****@node2-vip:1521/PROD';
    backup format '/BACKUP/PRODBKP/PROD_df_%t_%s_%p.bak'(database);
    backup format '/BACKUP/PRODBKP/archive_%t_%s_%p.bak' archivelog all;
    copy current controlfile to '/BACKUP/PRODBKP/PROD.ctl';
    delete noprompt obsolete;
    release channel c1;
    release channel c2;
    exit
    EOF
    echo "RMAN Backup Finished on";date
    echo "Shutdown Database";date
    srvctl stop database -d PROD
    echo "Start Database";date
    srvctl start database -d PROD
    srvctl status database -d PROD
    Please share your experiences.
    Regards

    Hi,
    Some tweaks for your script.
    echo "Shutdown Database";date
    srvctl stop database -d PROD
    srvctl status database -d PROD
    echo "Database shutdown on";date
    echo "Mount Database ";date
    srvctl start instance -d PROD -i "PROD1" -o mount1. If you database does not shutdown properly , does your script stops the execution of next step?
    2. configure controlfile autobackup on;
    configure controlfile autobackup format for device type disk to '/BACKUP/PRODBKP/%F';(Why you need to configure this every time) ?
    It's persistent at db level one time setting (until some other script changes the settings by other dba - else remove that - set the configuration at db level once for all)
    - Pavan Kumar N
    3.

  • Copying script for itunes database files?

    Hi,
    I stored my itunes music on another internal HD called Spitfire. The default storage folder for the itunes xml and library files is in my main internal HD /user/music/itunes folder ie. Master
    i use superduper to backup Spitfire, but i would like to backup the 2 aforementioned files.
    is there a script (I'm using panther latest version) to automatcially copy and paste the 2 files from Master to Spitfire?
    Cheers,
    keebler

    Try this:
    tell application "Finder"
    repeat with this_item in items of folder "path:to:folder"
    if modification date of this_item is greater than date "Sunday January 1, 2006 00:00:00" then
    set the_alias to this_item as alias
    tell application "iTunes"
    add alias the_alias
    end tell
    end if
    end repeat
    end tell
    The path to the folder in line 2 and the date in line 3 can be customized as needed. The path needs to be delimited by colons.
    (13381)

  • Purging Logs for AS Database

    Does anyone know of any way to purge AS database logs based on a "time" setting as opposed to a "size" setting?

    According to the fine Oracle® Utilities Application Framework Administration Guide Chapter 17, "Archiving and Purging" is readily available to CC&B.

  • PowerShell Script For Finding Database Instance Names

    G'day
    I am trying to get information on a couple of dozen SQL database servers database instances - long story, but our DBA's do not have complete lists at the moment, and I need to find out this information.
    I have done a bit of work with PowerShell (and love it) version 3, however I do not know many SQL commands and was wondering if someone could point me in the right direction please.
    This is the code I have at the moment:
    Get-Service -ComputerName MSQLULTDBS04 | ?{$_.DisplayName -like "*SQL*"} | Select name,DisplayName,status
    It gets the information on the SQL Server install on the remote server.
    What I am trying to do however is get a list of the databases that are running on this server. Can someone help me out please?

    Hello Scott,
    Please have a look at TechNet ScriptCenter:
    Create Inventory of SQL Server in Network as Html
    It lists also all databases, but of course you need permissions to logon to that SQL Servers.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • How to enable autoconfig for Oracle database 11g?

    Hi,
    I have a Oracle 11g database installed using runInstaller, and now I want to enable autoconfig feature in this database.
    Is it possible to do that?
    Please suggest me..
    Thanks,
    Prasad

    I do not believe you can run autoconfig for database server. Oracle apps database are configured with some specific table which are used by these adcfg pre clone scripts to store some information but you do will nto find these tables in normal databases. This is the reason I believe you cannot run autoconig on normal databases.
    You might be able to do something similar to autoconfig if you show some creativity by tweaking the scripts and creating the tables  but why to go this difficult route. You can instead create and automate script for duplicating database using RMAN.
    http://www.oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2.php

Maybe you are looking for

  • Multiple Rotate3d filters makes everything looks blurry

    Hi I have a Flex 4 project that uses two rotate filters. Once it to rotate the main container and the other to rotate an internal element. The issue is that when applied simultaneously text, and everything looks blurry. If I add a delay time to one o

  • Camera Raw 6.2 on Lr3.2 download page

    If Cs5 is NOT installed is this Camera Raw 6.2 not expected to be installed? After extracting the Camera Raw zip file a folder 'payloads', meta.inf and Adobe Patch Installer.exe resulted. Clicking on the Patch installer resulted in a pop up message '

  • Cinema Display DVI connector replacement.

    I was wondering if it were possible to get the DVI connector on my 20" Cinema Display replaced, 2 of the pins on the connector have been broken off . Does apple offer this service?

  • Table name in APO for demand planning

    Hi gurus, I want to upload Excel data (forecast demand) into APO SNP for the following fields APO product APO product Name Demand Qty Demand Date Can you please tell me the suitable table name in APO for those fields? Regards Rajib Pathak

  • Parent templates

    G'day My parent templates are not loading up and therefore not accessed through contribute CS3. This is stopping me from creating new pages using the templates. The templates files are .dwt files. In addition when I want to repeat an editable region