Need help to redesign legacy SQL Script

Hello Experts,
I have the below code which produces a CREATE TRIGGER statement. as of now this does for updating. I need to re-design this code to add for inserting and deleting as well. I just need help in the structuring wise. I can build the logic for inserting and updating inside. I want to know how i can continue to get for "inserting" and "deleting" as well.
you will understand my question better if you go through main code, present output and required output format below.
I know this is a bad design first of all. but the below code is a legacy one. so i cant change the entire structure of the code :-( all i can do is to continue designing it to add new changes. Hence sought help from you all.
please help
SQL CODE:
WITH audit_tables
AS
   (SELECT object_name,
           MIN (column_id) min_col,
           MAX (column_id) max_col
    FROM   user_objects o,
           user_tab_columns c
    WHERE  o.object_name = 'CHR_VAL_DESC_A_T'
    AND    o.object_name = c.table_name
    GROUP BY object_name
SELECT txt
FROM (
SELECT ' CREATE OR REPLACE TRIGGER ' || REPLACE(object_name,'_A_T') || '_ADT_TRG' || CHR(13) ||
       '   AFTER INSERT ' || CHR(13) ||
       '   OR    UPDATE ' || CHR(13) ||
       '   OR    DELETE ' || CHR(13) ||
       '   ON ' || REPLACE(object_name,'_A_T','_T') || CHR(13) ||
       '   FOR EACH ROW ' || CHR(13) ||
       ' DECLARE ' || CHR(13) ||
       ' BEGIN ' || CHR(13) ||
       ' IF updating THEN ' || CHR(13) ||
       '   INSERT INTO ' || object_name || CHR(13) ||
       '   (' txt, object_name, 1 disp_order, 0 column_id
FROM audit_tables
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM (SELECT 
        CASE
          WHEN max_col = column_id THEN
            '    '||column_name
          ELSE
            '    '||column_name || ','
          END AS txt, object_name, 2 disp_order, column_id
      FROM  audit_tables t,
            user_tab_columns C
      WHERE c.table_name = t.object_name
      ORDER BY c.column_id ASC)
UNION ALL
SELECT '   )' || CHR(13) ||
       '   VALUES ' || CHR(13) ||
       '   (', object_name, 3 disp_order, 0
FROM audit_tables t
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM (SELECT
        CASE
          WHEN max_col = column_id THEN
            CASE
              WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
              WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||');'
              WHEN min_col = column_id THEN
                '    1'
              WHEN column_id = 2 THEN
                '     ''I'''
              WHEN column_id = 3 THEN
                '    SYSDATE'
              ELSE
              '    :NEW.'||column_name||');'
            END
          ELSE
            CASE
              WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
              WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||','
              WHEN min_col = column_id THEN
                '    1'||','
              WHEN column_id = 2 THEN
                '    ''I'''||','
              WHEN column_id = 3 THEN
                '    SYSDATE' ||','
              ELSE
                '    :NEW.'||column_name||','
               END
          END AS txt,object_name, 4 disp_order, column_id
      FROM audit_tables t,
           user_tab_columns c
      WHERE c.table_name = t.object_name
      ORDER BY c.column_id ASC)
UNION ALL
SELECT 'END '||REPLACE(object_name,'_A_T') || '_ADT_TRG;' || CHR(13),
       object_name, 5 disp_order, 0
FROM    audit_tables)
ORDER BY object_name, disp_order, column_id
PRESENT OUTPUT:
CREATE OR REPLACE TRIGGER CHR_VAL_DESC_ADT_TRG
   AFTER INSERT
   OR    UPDATE
   OR    DELETE
   ON CHR_VAL_DESC_T
   FOR EACH ROW
DECLARE
BEGIN
IF updating THEN
   INSERT INTO CHR_VAL_DESC_A_T
    TXN_ID,                                  
    TXN_TYP,                                 
    ADT_DTTM,                                
    CHR_VAL_DESC_ID,                         
    CHR_VAL_ID,                              
    LANG_ID,                                 
    DESC_ID,                                 
    O_CHR_VAL_DESC,                          
    N_CHR_VAL_DESC,                          
    O_TRANS_STATE,                           
    N_TRANS_STATE,                           
    CRTD_BY,                                 
    CRTD_DTTM,                               
    O_UPD_BY,                                
    N_UPD_BY,                                
    O_UPD_DTTM,                              
    N_UPD_DTTM,                              
    O_LOCK_NUM,                              
    N_LOCK_NUM                               
   VALUES
    1,                                       
    'I',                                     
    SYSDATE,                                 
    :NEW.CHR_VAL_DESC_ID,                    
    :NEW.CHR_VAL_ID,                         
    :NEW.LANG_ID,                            
    :NEW.DESC_ID,                            
    :OLD.CHR_VAL_DESC,                       
    :NEW.CHR_VAL_DESC,                       
    :OLD.TRANS_STATE,                        
    :NEW.TRANS_STATE,                        
    :NEW.CRTD_BY,                            
    :NEW.CRTD_DTTM,                          
    :OLD.UPD_BY,                             
    :NEW.UPD_BY,                             
    :OLD.UPD_DTTM,                           
    :NEW.UPD_DTTM,                           
    :OLD.LOCK_NUM,                           
    :NEW.LOCK_NUM);                          
END CHR_VAL_DESC_ADT_TRG;
REQUIRED OUTPUT FORMAT:
CREATE OR REPLACE TRIGGER TRIGGER_NAME
   AFTER INSERT
   OR    UPDATE
   OR    DELETE
   ON TABLE_NAME
   FOR EACH ROW
DECLARE
BEGIN
IF updating THEN
   INSERT TABLE_NAME
    list of column names                               
   VALUES
IF inserting THEN
   INSERT TABLE_NAME
    list of column names                               
   VALUES
IF deleting THEN
   INSERT TABLE_NAME
    list of column names                               
   VALUES
END TRIGGER_NAME;

can anyone please help?
i tried adding with inserting and updating also..but when i tried to add deleting part the final output not comes in proper structure.
WITH audit_tables
AS
   (SELECT object_name,
           MIN (column_id) min_col,
           MAX (column_id) max_col
    FROM   user_objects o,
           user_tab_columns c
    WHERE  o.object_name IN ('CHR_VAL_DESC_A_T', 'CHR_VAL_A_T')
    AND    o.object_name = c.table_name
    GROUP BY object_name
SELECT txt
FROM (
SELECT ' CREATE OR REPLACE TRIGGER ' || REPLACE(object_name,'_A_T') || '_ADT_TRG' || CHR(13) ||
       '   AFTER INSERT ' || CHR(13) ||
       '   OR    UPDATE ' || CHR(13) ||
       '   OR    DELETE ' || CHR(13) ||
       '   ON ' || REPLACE(object_name,'_A_T','_T') || CHR(13) ||
       '   FOR EACH ROW ' || CHR(13) ||
       ' DECLARE ' || CHR(13) ||
       ' BEGIN ' || CHR(13) ||
       *' IF inserting THEN '* || CHR(13) ||
       '   INSERT INTO ' || object_name || CHR(13) ||
       '   (' txt, object_name, 1 disp_order, 0 column_id
FROM audit_tables
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM (SELECT 
        CASE
          WHEN max_col = column_id THEN
            '    '||column_name
          ELSE
            '    '||column_name || ','
          END AS txt, object_name, 2 disp_order, column_id
      FROM  audit_tables t,
            user_tab_columns C
      WHERE c.table_name = t.object_name
      ORDER BY c.column_id ASC)
UNION ALL
SELECT '   )' || CHR(13) ||
       '   VALUES ' || CHR(13) ||
       '   (', object_name, 3 disp_order, 0
FROM audit_tables t
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM (SELECT
        CASE
          WHEN max_col = column_id THEN
            CASE
              WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
              WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                '    NULL'||');'
              WHEN min_col = column_id THEN
                '    1'
              WHEN column_id = 2 THEN
                '     ''I'''
              WHEN column_id = 3 THEN
                '    SYSDATE'
              ELSE
              '    :NEW.'||column_name||');'
            END
          ELSE
            CASE
              WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
              WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                '    NULL'||','
              WHEN min_col = column_id THEN
                '    1'||','
              WHEN column_id = 2 THEN
                '    ''I'''||','
              WHEN column_id = 3 THEN
                '    SYSDATE' ||','
              ELSE
                '    :NEW.'||column_name||','
               END
          END AS txt,object_name, 4 disp_order, column_id
      FROM audit_tables t,
           user_tab_columns c
      WHERE c.table_name = t.object_name
      ORDER BY c.column_id ASC)
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM(SELECT *' ELSIF updating THEN '* || CHR(13) ||
       '   INSERT INTO ' || object_name || CHR(13) ||
       '   (' txt, object_name, 5 disp_order, 0 column_id
FROM audit_tables
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM (SELECT 
        CASE
          WHEN max_col = column_id THEN
            '    '||column_name
          ELSE
            '    '||column_name || ','
          END AS txt, object_name, 6 disp_order, column_id
      FROM  audit_tables t,
            user_tab_columns C
      WHERE c.table_name = t.object_name
      ORDER BY c.column_id ASC)
UNION ALL
SELECT '   )' || CHR(13) ||
       '   VALUES ' || CHR(13) ||
       '   (', object_name, 7 disp_order, 0
FROM audit_tables t
UNION ALL
SELECT txt, object_name, disp_order, column_id
FROM (SELECT
        CASE
         WHEN max_col = column_id THEN
            CASE
              WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
              WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||');'
              WHEN min_col = column_id THEN
                '    1'
              WHEN column_id = 2 THEN
                '     ''U'''
              WHEN column_id = 3 THEN
                '    SYSDATE'
              ELSE
              '    :NEW.'||column_name||');'
            END
          ELSE
            CASE
              WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
              WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||','
              WHEN min_col = column_id THEN
                '    1'||','
              WHEN column_id = 2 THEN
                '    ''U'''||','
              WHEN column_id = 3 THEN
                '    SYSDATE' ||','
              ELSE
                '    :NEW.'||column_name||','
            END
          END AS txt,object_name, 8 disp_order, column_id
      FROM audit_tables t,
           user_tab_columns c
      WHERE c.table_name = t.object_name
      ORDER BY c.column_id ASC)
UNION ALL
SELECT 'END IF;' || CHR(13) ||
       'END '||REPLACE(object_name,'_A_T') || '_ADT_TRG;' || CHR(13),
       object_name, 9 disp_order, 0
FROM    audit_tables)
ORDER BY object_name, disp_order, column_id)

Similar Messages

  • What tool I need to download to execute SQL scripts inOracle? please Help!

    I'm a SQL Server developer trying to pratice SQL scriptinging in ORACLE environment. Can any subject matter expert let me know exactly which tool I need to download to experiment with SQL scripting? It's kind of confusing as ORACLE has so many components. If I'm correct, SQL Plus might be the tool and PL/SQL is the ORACLE version of SQL language/scripting. I know that i can download 180 days of evaluation version software. Can someone tell me the exact link of the oracle tool where I can execute my SQL scripts?
    Thank you so much in advanced.
    Thanks
    Syed Islam

    Try Oracle Express Edition (XE)
    Completely free.
    You can use SQL*Plus, but coming from Windows/SQL world, you'll definitely enjoy using SQL Developer as well. That's a separate download. You'll have a worksheet, visual query builder, object navigator/browser, etc - much like you see in SSMS.

  • Need help in rewriting a sql query

    Can any one please tell me if there is any utility that can help me correcting the sql I have I need to tune the query as its taking lot of time. I want to use some tool that will help me re-formating the query.
    Any help in this regard will be highly appreciated.

    If you think that Oracle SQL Tuning Tools like SQL Tuning Advisor and SQL Access Advisor are not helping.
    You might look into thrid party tools like Quest- SQL Navigator and TOAD.
    But I don't advise this based on the following:
    Re: Oracle Third Party Tools and Oracle Database
    Oracle have enough tools of its own to satisfy the various needs.
    Adith

  • Need help in writing a vbs script

    I am very new to scripting and need help in scripting the following:
    When the Windows 7 machine boots up or a user logs on (easy to do with GPO), I want to execute a script that starts some services
    ONLY if the length of the computer name is less than or equal to 15 else it should exit. It has to be done in the background without any user interaction.
    The script should be able to work for both x86 and x64 version of Win7.
    Any help would be greatly appreciated.
    Thanks in advance.
    JD
    JD

    Hi,
    I highly recommend that you skip VBScript and learn PowerShell instead. This is pretty trivial in PowerShell:
    If ($env:COMPUTERNAME.Length -le 15) {
    # Do stuff
    # HINT: Look into Start-Service
    Write-Host "Under limit: $env:COMPUTERNAME"
    } Else {
    # Do optional stuff
    Write-Host "Over limit: $env:COMPUTERNAME"
    (OT: jrv - happy? =])
    If you must stick with VBScript for some odd reason, here's an example to get you started:
    Set wshNetwork = WScript.CreateObject( "WScript.Network" )
    strComputerName = wshNetwork.ComputerName
    If Len(strComputerName) <= 15 Then
    'Do stuff here when the name is short enough
    WScript.Echo "Under limit: " & strComputerName
    Else
    'Do stuff here when the name is too long (only if you want to)
    WScript.Echo "Over limit: " & strComputerName
    End If
    http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/services/
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • I need help to modify my AS script

    I have the following script and I would like to modify it:
    1.On this file I need to type the name of some video Albums in order to be displayed in the SWF file.
    2. What I wanr is that this file read the specific folder and read the directories which they will be the names of the Albums
    How can I do this?
    One more thing is that this file was created to work with Flas CS3 and I am trying to test it with CS5.
    I really appreciate the whole help I can get.
    I don't know anything about AS2 nor AS3, I only know hoe to modify the files by following comments and other samples from all around the web.
    Thanks and I hope someone can help me, I've been trying few thing but I just stuck. So I really need help.
    //  Set the path to the External Parameters file relative to the *.swf file.
    //  If this file cannot be found or if it contains errors, the
    //  Internal Parameters(the parameters below) will be used.
    //var ParametersFile = "MyControls.xml";
    var ParametersFile = "XML_Files/MyControls.xml";
    //  Set the path to the Theme file relative to the *.swf file.
    //  If this file cannot be found or if it contains errors, the
    //  Default Grey skin will be used instead.
    //  To learn how to edit Themes, please refer to the 'Help' folder.
    // next line commented by SAMY
    //var ThemeFile = "Theme.xml";
    // NEXT LINE ADDED BY SAMY
    var ThemeFile = "FLASH_DIR/3D_GALLERY/BlueTheme.xml";
    //  To learn more about how to add albums, please refer to the
    //  'Help' folder. This line says that replace and modify the name of the title album and the xml file which is as shown here
    var AlbumLabel_1 = "Pastor Alejandro Bullon";//<-- This is the typical line that I want to be input from the external folder name *
    //var AlbumDataFile_1 = "Videos/Alejandro_B/Alejandro_Bullon.xml";
    // next line for website configuration typical
    //var AlbumDataFile_1 = "Media/Media.xml";
    //next line works fine locally
    //var AlbumDataFile_1 = "Videos/Videos_website.xml";
    var AlbumDataFile_1 = "FLASH_DIR/3D_GALLERY/Videos/Alejandro_B/Alejandro_B.xml";
    var AlbumLabel_2 = "Pastor Stephen Bohr";// <--  *
    // next line commented by samy
    var AlbumDataFile_2 = "FLASH_DIR/3D_GALLERY/Videos/Stephen_B/Stephen_Bohr.xml";
    // next line added by samy for website configuration typical for all albums
    //var AlbumDataFile_2 = "Videos/Videos.xml";
    var AlbumLabel_3 = "Pastor Caleb Jara";
    var AlbumDataFile_3 = "FLASH_DIR/3D_GALLERY/Videos/Caleb_Jara/Caleb_Jara.xml";
    //var AlbumDataFile_3 = "City/City.xml";
    var AlbumLabel_4 = "Pastor Doug_Batchellor";
    var AlbumDataFile_4 = "FLASH_DIR/3D_GALLERY/Videos/Doug_B/Doug_Batchellor.xml";
    //var AlbumDataFile_4 = "FLASH_DIR/3D_GALLERY/City/City.xml";
    var AlbumLabel_5 = "Musica";
    var AlbumDataFile_5 = "FLASH_DIR/3D_GALLERY/Musica/Musica.xml";
    //var AlbumDataFile_5 = "Landscape/Landscape.xml";
    var AlbumLabel_6 = "Powerpoint";
    var AlbumDataFile_6 = "FLASH_DIR/3D_GALLERY/Powerpoint/Powerpoint.xml";
    var AlbumLabel_7 = "Escuela Sabatica '10";
    var AlbumDataFile_7 = "FLASH_DIR/3D_GALLERY/Escuela_Sab/Esc_Sab_2010.xml";
    var AlbumLabel_8 = "Escuela Sabatica '11";
    var AlbumDataFile_8 = "FLASH_DIR/3D_GALLERY/Escuela_Sab/Esc_Sab_2011.xml";
    var AlbumLabel_9 = "Test Nature";
    var AlbumDataFile_9 = "Nature/Nature.xml";
    //  Select wether to enable or disable error messages created
    //  due to 'file not found' , 'format not supported' or 'corrupted
    //  XML files' type of errors.
    //  Note: There error messages are automatically disabled when you
    //  export your *.swf file.
    var EnableErrorMessages = "yes";//[Yes  , No]
    //  Set parameters for items.
    var ItemWidth = 170;
    var ItemHeight= 130;
    var ShowItemNumber = "yes";
    //var ShowItemNumber = "no";
    //  Select fitting technique , stretch the thumb picture to fit the item
    //  or crop it from the top left.
    var ThumbFittingMethod = "stretch";
    //  Select what to do when the file preview is clicked, either to enlarge
    //  the preview or navigate to the URL provided for the current item in
    //  the XML data file of the current album
    var WhenPreviewIsClicked = "Enlarge";//[Enlarge  , GetUrl]
    //  Select the window target, '_blank' to open a new window or '_self' to
    //  navigate to the URL in the same window
    var WindowTarget = "_blank";
    //  Select wether to show the information of the item or not
    var ShowItemInfo = "yes";
    //  Select wether to show the albums menu or not
    var ShowAlbumsMenu = "yes";
    //  Select wether to show the video controller or not
    var ShowVideoController = "yes";
    //  Select wether to show the autoplay option or not
    //var ShowAutoplayButton="no";
    var ShowAutoplayButton="yes";
    //  Set the delay time for autoplay, this will be used for pictures only
    var AutoplayDelayTime = 5;
    //  Set the spinning speed of a single wheel
    //var WheelSpinningSpeed = 5;
    var WheelSpinningSpeed = 2;
    //  Select direction of scrolling of pages
    var DefaultDirection = "LeftToRight";
    //  Select wether you want to disable one of the wheels
    var DisableWheel = "none";
    //  Set the maximum number of items to be loaded on a single wheel
    var MaximumLoadOnEachWheel = 10;
    //  Select how you want the wheel to interact with the mouse
    //  Refer to the 'Help' folder for more information.
    var ScrollingStyle = "2";
    //  Select wether to enable tool tips or not.
    var EnableToolTips = "yes";
    //  Set the delay time for the tool tips to appear
    var ToolTipsDelayTime = 1;
    //  This is like a shortcut, set this parameter to 'Name' to display
    //  the name of the item as a tool tip.......
    var ToolTipsContent = "tooltips";//[ToolTips , Name , FileType]
    //  Select wether to enable or disable visual effects.
    var EnableDepthOfField = "yes";
    var EnableMotionBlur = "yes";
    Message was edited by: samy4movies

    This is a web-based app. And the application is for a carrousel video gallery.
    I already figure out the auto XML generator with php, but I think I want to get all in one process. Meaning that I only want to upload my videos and run php codes by themselves and not to worry in adding or modifying the *.fla file everytime that I insert a new folder ("Album").
    This is the link for the project I am working 
    http://anaheimspanish.net/index.php?option=com_content&view=article&id=98&Itemid=124
    It's called 3D Video Gallery, I bought the component through a website for flash components, but their support is not very good, that's why I want to fix as much as I need.
    Thanks in advance for your help
    If you need a full zip project to test it, let me know.

  • Need Help with Formula using SQL maybe

    I need help!  I work with Crystal reports XI and usually manage just fine with the Formula editor but his one I think will require some SQL and I am not good at that.
    We are running SQL 2000 I think (Enterprise Manager 8.0)  Our sales people schedule activities and enter notes for customer accounts.  Each is stored in a separate table.  I need to find activities that are scheduled 240 days into the future and show the most recent note that goes with the account for which that activity is scheduled.
    The two tables, Activities and History, share the an accountID field in common that links them to the correct customer account.   I want to look at dates in the Startdate.Activities field more than 240 days in the future and show the most recent note from the History table where the accountid's match. I figure my query will contain a join on AccountID.Activities and AccountID.History used with Max(completedate.History) but I do not understand how to word it.
    I would like to perform all this in crystal if possible.  I humbly request your help.
    Membery

    You SQL would look something like this...
    SELECT
    a.AccountID,
    a.BlahBlahBlah, -- Any other fields you want from the Activities table
    h.LastComment
    FROM Activities AS a
    LEFT OUTER JOIN History AS h ON a.AccountID = h.AccountID
    WHERE (a.ActivityDate BETWEEN GetDate() AND DateAdd(dd, 240, GetDate()))
    AND h.HistoryID IN (
         SELECT MAX(HistoryID)
         FROM History
         GROUP BY AccountID)
    This method assumes that the History table has a HistoryID that increments up automatically each time a new comment is added... So a comment made today would always have a higher HistoryID that one made yesterday.
    If I'm wrong and there is no HistoryID or the HistoryID doesn't increment in a chronological fashion, it can still be done but the code is a bit more complex.
    HTH,
    Jason

  • HELP !!! - sql script to find free space in Oracle7,8,9 DB

    Hi All
    I got a PL/SQL script to find out free space in Oracle7,8,9 db. But because in Oracle 7 there is no maxbytes column in dba_data_files, so this script is not working. I am trying to use cursor and putting sql in a variable so that when program executes, it does not see maxbytes. But it still does not work.
    Please help. !!!
    Script
    set feedback off;
    set serveroutput on;
    set termout off;
    set verify off;
    spool /u01/app/oracle/admin/common/bck/log/ts.log
    declare
    v_tablespace_name varchar2(50);
    v_total_space number(12) := 0;
    v_free_space number(12);
    v_space number(12);
    v_space_used number(12);
    v_pct_free number(6,3);
    v_pct_threshold number(3) := 2;
    v_table_exist number(2) := 0;
    v_sql varchar2(300) := 'select sum(maxbytes) from dba_data_files where TABLESPACE_NAME = tablespace_rec.tablespace_name';
    TYPE t_tableref IS REF CURSOR;
    t_tablecur t_tableref;
    begin
    for tablespace_rec in (select tablespace_name from dba_tablespaces)
    loop     
    -- Get the total space for the current tablespace
    -- if this FILEXT$ view exists then some of the datafiles have autoextend on;
              select count(*) into v_table_exist from dba_tables where table_name = 'FILEXT$';
              dbms_output.put_line('table count: ' || v_table_exist);               
              if v_table_exist = 0 then
                        OPEN t_tablecur for v_sql;
                        fetch t_tablecur into v_total_space;                         
                        CLOSE t_tablecur;     
              --     select sum(maxbytes) into v_total_space from dba_data_files
              --     where TABLESPACE_NAME = tablespace_rec.tablespace_name;               
              --      v_total_space := getMaxBytes(tablespace_rec.tablespace_name);
              end if;
              select sum(bytes) into v_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;          
         if (v_total_space = 0 or v_total_space < v_space) then
              select sum(bytes) into v_total_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
         else
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              v_space_used := v_space - v_free_space;
              v_free_space := v_total_space - v_space_used;          
         end if;
    -- calculate the percent free for the current tablespace
    v_pct_free := (v_free_space / v_total_space) * 100;
         if (v_pct_free < v_pct_threshold) then
         dbms_output.put_line(tablespace_rec.tablespace_name|| ' - Percent Free: ' || v_pct_free      
         ||'%');
         end if;
    end loop;
    end;
    spool off;

    Hi All
    I got a PL/SQL script to find out free space in Oracle7,8,9 db. But because in Oracle 7 there is no maxbytes column in dba_data_files, so this script is not working. I am trying to use cursor and putting sql in a variable so that when program executes, it does not see maxbytes. But it still does not work.
    Please help. !!!
    Script
    set feedback off;
    set serveroutput on;
    set termout off;
    set verify off;
    spool /u01/app/oracle/admin/common/bck/log/ts.log
    declare
    v_tablespace_name varchar2(50);
    v_total_space number(12) := 0;
    v_free_space number(12);
    v_space number(12);
    v_space_used number(12);
    v_pct_free number(6,3);
    v_pct_threshold number(3) := 2;
    v_table_exist number(2) := 0;
    v_sql varchar2(300) := 'select sum(maxbytes) from dba_data_files where TABLESPACE_NAME = tablespace_rec.tablespace_name';
    TYPE t_tableref IS REF CURSOR;
    t_tablecur t_tableref;
    begin
    for tablespace_rec in (select tablespace_name from dba_tablespaces)
    loop     
    -- Get the total space for the current tablespace
    -- if this FILEXT$ view exists then some of the datafiles have autoextend on;
              select count(*) into v_table_exist from dba_tables where table_name = 'FILEXT$';
              dbms_output.put_line('table count: ' || v_table_exist);               
              if v_table_exist = 0 then
                        OPEN t_tablecur for v_sql;
                        fetch t_tablecur into v_total_space;                         
                        CLOSE t_tablecur;     
              --     select sum(maxbytes) into v_total_space from dba_data_files
              --     where TABLESPACE_NAME = tablespace_rec.tablespace_name;               
              --      v_total_space := getMaxBytes(tablespace_rec.tablespace_name);
              end if;
              select sum(bytes) into v_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;          
         if (v_total_space = 0 or v_total_space < v_space) then
              select sum(bytes) into v_total_space from dba_data_files
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
         else
              select sum(bytes) into v_free_space from dba_free_space
              where TABLESPACE_NAME = tablespace_rec.tablespace_name;
              v_space_used := v_space - v_free_space;
              v_free_space := v_total_space - v_space_used;          
         end if;
    -- calculate the percent free for the current tablespace
    v_pct_free := (v_free_space / v_total_space) * 100;
         if (v_pct_free < v_pct_threshold) then
         dbms_output.put_line(tablespace_rec.tablespace_name|| ' - Percent Free: ' || v_pct_free      
         ||'%');
         end if;
    end loop;
    end;
    spool off;

  • Need help with min max sql

    hi all, forgot i had a user name and password and haven't needed help for quite a bit since i didn't do sql for a while but now i'm back at reporting again...
    Here is a sample table as i remember it:
    Item     Date     Time     Time Frame     Duration     Duration Frame
    A     20100926     0     5     500     10
    A     20100926     600     10     500     30
    A     20100926     1500     12     100     30
    B     20100926     1800     28     200     40
    B     20100926     2200     6     150     70
    B     20100926     2600     15     600     60
    B     20100926     3600     30     200     70
    Results Set (expected):                         
    Item     Date     Time     Total Duration          
    A     20100926     0     1600:20     --basically max (time+duration) - min(time+duration)     
    B     20100926     1800     2000:00
    Sorry, but. I didnt put my sql statement as I wasn't planning on posting and left it at work, but, i've been looking on internet and people say to use min/max function and i've attenpted it with it works with just this table (without grouping). But as soon as i group it the values seem to mess up.
    Last i remembered it gave me:
    Item     Date     Time     Total Duration          
    A     20100926     0     1600:30     --basically max(time+duration) - min(time+duration)     
    B     20100926     1800     2000:70
    I think it's looking at max duration which is 30&70 and hence it retrurns those values in the result set. Is it because of the max function hence it's returning this value? any help is appreciated. thanks
    Edited by: stanleyho on Sep 30, 2010 4:44 PM

    Okay, here we go again, repost, hopefully okay this time:
    Hi Madhu, okay, just got to work: I am using TOAD and working in Oracle 10g. Here is my table structure and the query i use to try and get what I am looking for:
    There is one extra table but that is only used to link these two tables listed below so i didn't bother posting it.
    TABLE: TX_RECON_INSTANCE_VIEW
    ColumnName ColID DataType Null
    CHANNEL_CODE 3 VARCHAR2 (4 Char) N
    DURATION 8 NUMBER (10) N
    DURATION_FRAME 9 NUMBER (2) N
    REAL_TIME 6 NUMBER (10) N
    REAL_TIME_FRAME 7 NUMBER (2) N
    ITEM_ID 4 NUMBER Y
    TX_DATE 2 CHAR (8 Byte) N
    TX_ID 1 NUMBER (9) N
    TX_TYPE 13 VARCHAR2 (4 Char) N
    TABLE: TX_SCHEDULE
    ColumnName ColID PK Null DataType
    TX_TYPE 22 N VARCHAR2 (4 Char)
    TX_ID 1 1 N NUMBER (9)
    TX_DATE 2 N CHAR (8 Byte)
    SCHEDULE_TIME_FRAME 9 N NUMBER (2)
    SCHEDULE_TIME 8 N NUMBER (10)
    REAL_TIME 10 N NUMBER (10)
    DURATION_FRAME 13 N NUMBER (2)
    DURATION 12 N NUMBER (10)________________________________________
    And the data and results:
    TX_ID TX_DATE REAL_TIME REAL_TIME_FRAME DURATION DURATION_FRAME ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION SCHEDULE_TIME SCHEDULE_TIME_FRAME DURATION_1 DURATION_FRAME_1
    1651000 20100710 0 0 545 20 1234 00:00:00:00 00:09:05:20 00:00:00:00 00:09:05:20 0 0 545 20
    1752223 20100710 667 12 281 7 1234 00:11:07:12 00:04:41:07 00:11:07:10 00:04:41:07 667 10 281 7
    1846501 20100710 1071 13 335 9 1234 00:17:51:13 00:05:35:09 00:17:50:09 00:05:35:09 1070 9 335 9
    2001102 20100710 1525 6 249 14 1234 00:25:25:06 00:04:09:14 00:25:22:08 00:04:09:14 1522 8 249 14
    3246669 20100710 1800 0 586 2 1235 00:30:00:00 00:09:46:02 00:30:00:00 00:09:46:02 1800 0 586 2
    4456822 20100710 2492 16 276 5 1235 00:41:32:16 00:04:36:05 00:41:32:16 00:04:36:05 2492 16 276 5
    1253168 20100710 2890 15 222 17 1235 00:48:10:15 00:03:42:17 00:48:10:15 00:03:42:17 2890 15 222 17
    1112456 20100710 3277 18 297 0 1235 00:54:37:18 00:04:57:00 00:54:35:10 00:04:57:00 3275 10 297 0
    Grouped results set:
    TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
    20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:20
    20100710 1235 00:30:00:00 00:29:34:17 00:30:00:00 00:29:32:17
    --> SCHEDULED DURATION "00:29:31:20" is not correct as it should be (00:25:22:08+00:04:09:14)-(00:00:00:00)=00:29:31:22
    --> see expected results below
    Expected results:
    TX_DATE ITEM_ID AS RUN TIME AS RUN DURATION SCHEDULED TIME SCHEDULED DURATION
    20100710 1234 00:00:00:00 00:29:34:20 00:00:00:00 00:29:31:22
    20100710 1235 00:30:00:00 00:29:34:18 00:30:00:00 00:29:34:10________________________________________
    And the query I am using:
    SELECT --TXR.TX_ID,
    TXR.TX_DATE, TXR.ITEM_ID,
    TO_CHAR(TRUNC((MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXR.REAL_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "AS RUN TIME",
    to_char(trunc((MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME+TXR.DURATION)-MIN(TXR.REAL_TIME),60),'FM00')||':'||to_char(mod(MAX(TXR.REAL_TIME_FRAME+TXR.DURATION_FRAME)-MIN(TXR.REAL_TIME),60),'FM00') "AS RUN DURATION",
    TO_CHAR(TRUNC((MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) )/3600),'FM00')||':'||TO_CHAR(TRUNC(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,3600)/60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00')||':'||TO_CHAR(MOD(MIN(TXS.SCHEDULE_TIME_FRAME) KEEP (DENSE_RANK FIRST ORDER BY TXR.REAL_TIME) ,60),'FM00') "SCHEDULED TIME",
    to_char(trunc((MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME))/3600),'FM00')||':'||to_char(trunc(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),3600)/60),'FM00')||':'||to_char(mod(MAX(TXS.SCHEDULE_TIME+TXS.DURATION)-MIN(TXS.SCHEDULE_TIME),60),'FM00')||':'||to_char(mod(MAX(TXS.DURATION_FRAME),60),'FM00') "SCHEDULED DURATION"
    FROM TX_RECON_INSTANCE_VIEW TXR, TX_SCHEDULE TXS, TX_SCHEDULE_RECON TXREC
    WHERE TXR.TX_DATE=20100926 AND TXR.TX_TYPE='P'
    AND TXR.TX_ID=TXREC.RECON_TX_ID(+)
    AND TXREC.BASE_TX_ID=TXS.TX_ID(+)
    GROUP BY TXR.TX_DATE, TXR.ITEM_ID
    ORDER BY TXR.TX_DATE, TXR.ITEM_ID, MAX(TXR.REAL_TIME)--does this work for everyone now? let me know...thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need help in writinf a stop script for a production server

    can somebody help me with a stop script which stops a jrun
    production server.
    jrun -stop production
    this command should work but how do i use this in a script .
    Thanks

    Hi,
    I highly recommend that you skip VBScript and learn PowerShell instead. This is pretty trivial in PowerShell:
    If ($env:COMPUTERNAME.Length -le 15) {
    # Do stuff
    # HINT: Look into Start-Service
    Write-Host "Under limit: $env:COMPUTERNAME"
    } Else {
    # Do optional stuff
    Write-Host "Over limit: $env:COMPUTERNAME"
    (OT: jrv - happy? =])
    If you must stick with VBScript for some odd reason, here's an example to get you started:
    Set wshNetwork = WScript.CreateObject( "WScript.Network" )
    strComputerName = wshNetwork.ComputerName
    If Len(strComputerName) <= 15 Then
    'Do stuff here when the name is short enough
    WScript.Echo "Under limit: " & strComputerName
    Else
    'Do stuff here when the name is too long (only if you want to)
    WScript.Echo "Over limit: " & strComputerName
    End If
    http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/services/
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • I need help finding or creating a script to automatically create iCal email and message reminders. iCal

    Dear All,
    I'm learning to use iCal v.5.0.3 on a Mac Pro (2,1) 2x3 Ghz Quad-Core Intel Xeon, running Lion OSX10.7.5.
    I need to find or write a script which, when I create a new iCal timed event, will automatically send me an email and give a screen alert 24 hours before - plus on the morning of the appointment, plus 2 hours beforehand. I'm wondering if such a script exists already or can be adapted.  I've searched various forums and am unable to find specific simple instructions on how to create such a thing in Applescript or Automator or whatever. So I've really tried to find out on my own.
    Can anyone direct me to a set of instructions? This can't be so hard, can it? To clarify, when I create an "event" with a time (an appointment), I want to hit a button which tells iCal  to send me these reminders without my having to set multiple reminders in iCal for each of my new "events".
    I'd be most grateful for any advice at all.
    Many thanks for taking the trouble to read this. Hope you can set me on the right course. I have no knowledge of Applescript or Automator, but am ready to learn. I am very stupid, so instruction has to be in language comprehensible by a small hamster.
    Best wishes,
    Harry.

    Doing a shell script to burn a DVD from a folder (for example) is pretty challenging. The reason is that you need to execute the entire script in one shot, because making a burned disk is a 3 part affair with each part of the operation taking time. The problem with executing separate commands is that Applescript can't wait around until a shell command is finished, while a shell script will not proceed to the next command until the previous command is completed.
    Burning disk takes these 3 parts:
    1) Create an empty diskimage of your desired size
    2) Mount the empty and copy your stuff to it
    3) Burn and eject
    There may be a shortcut by burning an existing folder but you don't say exactly what you're doing. See the hdutil command for more information:
    http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/hdiutil. 1.html

  • Need Help in creating Unix Shell Script for database

    Would be appreciable if some one can help in creating unix shell script for the Oracle DB 10,11g.
    Here is the condition which i want to implement.
    1. Create shell script to create the database with 10GB TB SPACE and 3 groups of redo log file(Each 300MB).
    2. Increase size of redolog file.
    3. Load sample schema.
    4. dump the schema.
    5. Create empty db (Script should check if db already exists and drop it in this case).
    6. Create backup using rman.
    7. restore backup which you have backed up.

    This isn't much of a "code-sharing" site but a "knowledge-sharing" site.  Code posted me may be from a questioner who has a problem / issue / error with his code.   But we don't generally see people writing entire scripts as responses to such questions as yours.  There may be other sites where you can get coding done "for free".
    What you could do is to write some of the code and test it and, if and when it fails / errors, post it for members to make suggestions.
    But the expectation here is for you to write your own code.
    Hemant K Chitale

  • Need help in Report From SQL Query

    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?

    user602513 wrote:
    Hi All,
    I am facing a problem with a report. I need your help.
    I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
    If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
    I tried also increase the page time out in httpd.conf, but no use.
    The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
    Please help me to find appropriate reasone for the failure?Do you get any errors or warnings or it is just the slow speed which is the issue?
    There could be a variety of reasons for the delayed processing of this report. That includes parameter settings for that page, cache settings, network configurations, etc.
    - explore best optimization for your query;
    - evaluate portal for best performance configuration; you may follow this note (Doc ID: *438794.1* ) for ideas;
    - third: for that particular page carrying that report, you can use caching wisely. browser cache is neither decent for large files, nor practical. instead, explore the page cache settings that portal provides.
    - also look for various log files (application.log and apache logs) if you are getting any warnings reflecting on some kind of processing halt.
    - and last but not the least: if you happen to bring up a portal report with more than 10000 rows for display then think about the usage of the report. Evaluate whether that report is good/useful for anything?
    HTH
    AMN

  • Need help in installation of SQL Developer in Win7

    Dear Frens,
    I got a task to validate the SQL developer(64 bit version) in Win7 environment. I followed the advice in this form and installed the 64 bit JDK first.
    It can be verified:
    C:\>java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
    Then SQL developer asked for the path of java.exe for the first time, and after configuring it to the correct path, I found it had problems creating the connection to the database when I tried to click database connection button. Please be noted, I do not have the win admin right for the PC.
    The error messages are listed below. Need some help from you guys.
    java.lang.NoClassDefFoundError: oracle/javatools/db/DBLog
         at oracle.jdeveloper.db.DatabaseConnectionStores.registerStoreProvider(DatabaseConnectionStores.java:388)
         at oracle.jdeveloper.db.DatabaseConnectionStores.<init>(DatabaseConnectionStores.java:74)
         at oracle.jdeveloper.db.DatabaseConnectionStores.getInstance(DatabaseConnectionStores.java:63)
         at oracle.jdeveloper.db.DatabaseActions.<init>(DatabaseActions.java:53)
         at oracle.jdeveloper.db.DatabaseActions.getConnectionEditorAction(DatabaseActions.java:79)
         at oracle.jdevimpl.db.DBConnWizard.invoke(DBConnWizard.java:38)
         at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:372)
         at oracle.ide.wizard.WizardManager$1.run(WizardManager.java:420)
         at oracle.ide.util.IdeUtil$3.run(IdeUtil.java:1079)
         at oracle.javatools.util.SwingUtils.invokeAfterRepaint(SwingUtils.java:520)
         at oracle.ide.util.IdeUtil.invokeAfterRepaint(IdeUtil.java:1092)
         at oracle.ide.wizard.WizardManager$2.run(WizardManager.java:428)
         at oracle.ide.util.IdeUtil$3.run(IdeUtil.java:1079)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
         at java.awt.EventQueue.access$000(EventQueue.java:84)
         at java.awt.EventQueue$1.run(EventQueue.java:602)
         at java.awt.EventQueue$1.run(EventQueue.java:600)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    Caused by: oracle.classloader.util.AnnotatedClassNotFoundException:
         Missing class: oracle.javatools.db.DBLog
         Dependent class: oracle.jdeveloper.db.DatabaseConnectionStores
         Loader: ide-global:11.1.1.0.0
         Code-Source: //DBG.ADS.DB.COM/SNG-USERS-U/VF05_USERS08/liustea/config/Desktop/sqldeveloper64-2.1.1.64.45-no-jre/sqldeveloper/jdev/extensions/oracle.jdeveloper.db.connection.jar
         Configuration: extension jar in \\DBG.ADS.DB.COM\SNG-USERS-U\VF05_USERS08\liustea\config\Desktop\sqldeveloper64-2.1.1.64.45-no-jre\sqldeveloper\jdev\extensions
    This load was initiated at ide-global:11.1.1.0.0 using the loadClass() method.
    The missing class is not available from any code-source or loader in the system.
         at oracle.classloader.PolicyClassLoader.handleClassNotFound(PolicyClassLoader.java:2190)
         at oracle.classloader.PolicyClassLoader.internalLoadClass(PolicyClassLoader.java:1733)
         at oracle.classloader.PolicyClassLoader.access$000(PolicyClassLoader.java:143)
         at oracle.classloader.PolicyClassLoader$LoadClassAction.run(PolicyClassLoader.java:331)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1692)
         at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:1674)
         ... 27 more
    Steven Liu

    ateeqrahman wrote:
    Hi,
    I am planning to install Oracle 10g on RHEL. Can anyone plss tell me if the kernel parameters are set as default or according to hardware/software specifications. What other parameters should i be careful of. I have a database of around 40GB which i have to export from Oracle 8.0.6 running on Win 2000 server.
    Which linux version you are using .
    For RHEL & SUSE , please refer to :
    http://www.oracle.com/technology/pub/articles/smiley_10gdb_install.html#rhel4
    Also check :
    http://www.akadia.com/services/ora_linux_install_10g.html
    On OEL ,
    http://kamranagayev.wordpress.com/2010/04/25/video-tutorial-installing-oel-and-oracle-10gr2/
    Regards
    Rajesh

  • Need Help in correcting the sql statement

    H Experts,
    I am not if I can post this query in this section, but as I am executing this statement on repository DB , I assumed to post here.
    I have a requirement to calculate the database sizes from the tables in repository.
    table 1 : MGMT$DB_TABLESPACES_ALL : has the information on all the tablespace information from each database. and it has information of all the databases.
    table 2: MGMT$DB_REDOLOGS_ALL : has the information on all the redolog files information from each database. and it has information of all the databases.
    Now to calculate the size of each database , we need to collect the sizes from both tables and then need to add.
    below is the sql i prepared and sql didn't return and systax error , but the final output is completely wrong. Seems like its multiplying the data somewhere and getting the wrong information.
    please help me in doing the required modifications.
    =================================================================================================
    select a.TARGET_NAME "DATABASE_NAME" ,sum(a.TABLESPACE_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE ALLOCATED SPACE(GB)",
    sum(a.TABLESPACE_USED_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE USED SPACE(GB)",
    sum(a.TABLESPACE_SIZE/1024/1024/1024)-sum(a.TABLESPACE_USED_SIZE/1024/1024/1024) "DATABASE FREE SPACE(GB)"
    from MGMT$DB_TABLESPACES_ALL a ,MGMT$DB_REDOLOGS_ALL b
    where a.TARGET_NAME=b.TARGET_NAME and a.TARGET_Name like '%d2oem%'
    group by a.target_name;
    ====================================================================================================
    Note: There are multiple records having the same TARGET_NAME value in both the tables.
    please Help me in correcting the sql statement

    H Experts,
    I am not if I can post this query in this section, but as I am executing this statement on repository DB , I assumed to post here.
    I have a requirement to calculate the database sizes from the tables in repository.
    table 1 : MGMT$DB_TABLESPACES_ALL : has the information on all the tablespace information from each database. and it has information of all the databases.
    table 2: MGMT$DB_REDOLOGS_ALL : has the information on all the redolog files information from each database. and it has information of all the databases.
    Now to calculate the size of each database , we need to collect the sizes from both tables and then need to add.
    below is the sql i prepared and sql didn't return and systax error , but the final output is completely wrong. Seems like its multiplying the data somewhere and getting the wrong information.
    please help me in doing the required modifications.
    =================================================================================================
    select a.TARGET_NAME "DATABASE_NAME" ,sum(a.TABLESPACE_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE ALLOCATED SPACE(GB)",
    sum(a.TABLESPACE_USED_SIZE/1024/1024/1024)+sum(b.LOGSIZE/1024/1024/1024/1024) "DATABASE USED SPACE(GB)",
    sum(a.TABLESPACE_SIZE/1024/1024/1024)-sum(a.TABLESPACE_USED_SIZE/1024/1024/1024) "DATABASE FREE SPACE(GB)"
    from MGMT$DB_TABLESPACES_ALL a ,MGMT$DB_REDOLOGS_ALL b
    where a.TARGET_NAME=b.TARGET_NAME and a.TARGET_Name like '%d2oem%'
    group by a.target_name;
    ====================================================================================================
    Note: There are multiple records having the same TARGET_NAME value in both the tables.
    please Help me in correcting the sql statement

  • Need help identifying servers and autoconfiguration scripts

    I have just started a new job and the previous admin left no info. We are preparing for a migration to Lync and Exchange 2013 upgrade
    I noticed that the OCS 2007 R2 client says automatic configuration  in the advanced server options
    I need to know how to locate the autoconfiguration script and which server my user is on.
    I have looked at both 2007 OCS servers but do not see my user and suspect there is another server with users on it.
    Where do I look? the autoconfig script should help me find what server , correct?
    Thanks in advance...
    David Sheetz MCP

    Hi,
    You can view the OCS accounts for each Server with the following steps:
    Open the Office Communications Server 2007 R2 snap-in.
    In the console tree, expand the forest node, and then navigate to the Standard Edition server or Enterprise pool.
    Expand the pool name for the Enterprise pool or the Standard Edition server, and then expand Users.
    If you want to migration from OCS 2007 R2 to Lync Server 2013, you can refer to the link below:
    http://technet.microsoft.com/en-us/library/jj205375.aspx
    Best Regards,
    Eason Huang
    Eason Huang
    TechNet Community Support

Maybe you are looking for

  • NVIDIA Drivers version

    Hi all. Is there a way to inventory NVIDIA drivers version? Thanx.

  • Some mails go automatically to the wastebasket and to spam

    Hello together, I have the problem that some read and sent mails are going automaticlly to the wastebasket or to the spam folder. Some are going lost. Powerbook G4   Mac OS X (10.4.8)  

  • Burning iTunes playlists onto a DVD

    I want to burn playlists from iTunes onto a DVD, primarily for backup purposes. But also, to give get them into another...PC...computer. I have iDVD 5, running Panther (10.3.9) I was told I could do this and it would work basically the same was as bu

  • Epson printer driver problem

    Printer model name: Stylus Photo R300M Date of Purchase: NA Serial Number: Computer Type: Other Mac Operating System: Mac OS X v10.3.9 Interface: USB Detailed Description: I have an Epson Stylus photo r300. I run mac os 10.3.9. Recently I had my OS c

  • Expressions in different compositions.

    I am using pre_composed object in different compositions (A,B,C). Each compositions have their own camera in it (active camera). I am applying the expression bellow to rotate my object with the camera. value+lookAt(comp("A").activeCamera.toWorld([0,0