Errors in shrink

Windows 2008 Enterprise 64 bits - Oracle 11g (11.02.0 ) STD
In Enterprise Manager I have 14 recomendations from the segments superviser just for my DATA tablespace.
I selected all of them and I tried to shrink the segments and release space.
The procedure should automatically create a job which I intend to execute during the night.
But when I submit the job I have this message :
ORA-1830 Date format picture ends before converting entire input string ORA-06512 at line 2.
The job was not even created and I don't have an idea about why I have this error.
I'm not creating a command for this procedure. I'm just using Enterprise Manager options...
This is the first time I'm using this Enterprise Manager shrink routine...
Thanks in advance,
Eduardo

The error occurred because of an incorrect time zone.
The consultant who installed our Oracle has chosen a bad UTC region for us.
We only corrected this and everything is fine now.
Eduardo

Similar Messages

  • Error while shrinking a table

    Hi All,
    I am facing issue while shrinking a table PARAMETER_DETAIL which is a IOT partition table.
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
    PL/SQL Release 10.2.0.2.0 - Production
    CORE    10.2.0.2.0      Production
    TNS for Solaris: Version 10.2.0.2.0 - Production
    NLSRTL Version 10.2.0.2.0 - Production
    SunOS usa0300ux636 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Blade-T6320
    When i am firing the below query,
    alter table PARAMETER_DETAIL SHRINK space CASCADE;
    alter table PARAMETER_DETAIL SHRINK space CASCADE*
    ERROR at line 1:
    ORA-10635: Invalid segment or tablespace type
    I am getting this error.
    Moreover, I have checked in dba_segments, the output is
    SQL> l
    1 select unique SEGMENT_NAME,PARTITION_NAME,SEGMENT_TYPE,TABLESPACE_NAME from dba_segments where SEGMENT_NAME='PARAMETER_DETAIL'
    2* and OWNER='CDE'
    SEGMENT_NAME
    PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME
    PARAMETER_DETAIL
    PD_201107220130 INDEX PARTITION DATAFEED
    PARAMETER_DETAIL
    PD_201107211630 INDEX PARTITION DATAFEED
    PARAMETER_DETAIL
    PD_201107212030 INDEX PARTITION DATAFEED
    SEGMENT_NAME
    PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME
    PARAMETER_DETAIL
    PD_201107212100 INDEX PARTITION DATAFEED
    PARAMETER_DETAIL
    PD_201107210330 INDEX PARTITION DATAFEED
    PARAMETER_DETAIL
    PD_201107210630 INDEX PARTITION DATAFEED
    SEGMENT_NAME
    PARTITION_NAME SEGMENT_TYPE TABLESPACE_NAME
    PARAMETER_DETAIL
    PD_201107210830 INDEX PARTITION DATAFEED
    PARAMETER_DETAIL
    PD_201107211030 INDEX PARTITION DATAFEED
    1490 rows selected.
    SQL> select TABLESPACE_NAME,SEGMENT_SPACE_MANAGEMENT from dba_tablespaces;
    TABLESPACE_NAME SEGMEN
    SYSTEM MANUAL
    UNDOTBS MANUAL
    SYSAUX AUTO
    TEMP MANUAL
    USERS AUTO
    DATAFEED AUTO
    6 rows selected.
    Please help me out to shrink this table.
    Thanks

    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/schema.htm#ADMIN10161
    Shrink operations can be performed only on segments in locally managed tablespaces with automatic segment space management (ASSM). Within an ASSM tablespace, all segment types are eligible for online segment shrink except these:
    IOT mapping tables
    Tables with rowid based materialized views
    Tables with function-based indexesSince this is an IOT, any chance there is an IOT mapping table?
    Since this appears to be a data warehouse, any chance there are ROWID based materialized views or function-based indexes?
    Justin

  • Lots of system log messages from nsurlstoraged, also systemstatsd

    I'm running Yosemite (10.10.2) on an old Mini (details below).  I am not having particular problems with slowness, crashes, etc., but I'm seeing repeated messages in the System Log which seem to be errors:
    nsurlstoraged[300]: ERROR: shrinkDB - shrink of file system cache did not fully complete.  Result: 11
    systemstatsd[1286]: assertion failed: 14C1514: systemstatsd + 3283 [A886B71F-3A31-3324-9B30-5143FDF4ECCB]: 0xb
    For at least the past 2 days, the systemstatsd messages have the exact same values.  When the computer is in active use, I get 2 of them every 3 to 4 minutes.
    The nsurlstoraged messages are a little more frequent but don't have such a clear pattern.  Some other messages from that source which are interspersed with the above message include the following:
    nsurlstoraged[1263]: realpath() returned NULL for /var/root/Library/Caches/ocspd
    nsurlstoraged[1263]: The read-connection to the DB=/var/root/Library/Caches/ocspd/Cache.db is NOT valid.  Unable to determine schema version.
    nsurlstoraged[1263]: ERROR: unable to determine file-system usage for FS-backed cache at /var/root/Library/Caches/ocspd/fsCachedData. Errno=13
    Should I be concerned about resolving these, or can I just ignore them?  I did run the string of commands provided in the forum by Linc which are intended to reset the privileges on everything in my home directory to the default values, and I also ran the password reset process via the recovery partition to reset the ACLs.
    Just a few quick notes about my system:
    - the volume My Mac system (external) is not the system or boot disk.  It has most of my image files (including iPhoto libraries) plus the iTunes Media folder.  I did not run any commands there to reset file/directory permissions.
    - the volume Macintosh HD is the system disk and contains my home directory.
    - I am planning to upgrade from to 4 GB to 8 GB RAM.
    Thanks very much for any insight into these messages!
    Dave
    EtreCheck version: 2.1.8 (121)
    Report generated April 7, 2015 at 9:11:16 PM EDT
    Download EtreCheck from http://etresoft.com/etrecheck
    Click the [Click for support] links for help with non-Apple products.
    Click the [Click for details] links for more information about that line.
    Hardware Information: ℹ️
        Mac mini (Early 2009) (Technical Specifications)
        Mac mini - model: Macmini3,1
        1 2.26 GHz Intel Core 2 Duo CPU: 2-core
        4 GB RAM Upgradeable
            BANK 0/DIMM0
                2 GB DDR3 1067 MHz ok
            BANK 1/DIMM0
                2 GB DDR3 1067 MHz ok
        Bluetooth: Old - Handoff/Airdrop2 not supported
        Wireless:  en1: 802.11 a/b/g/n
    Video Information: ℹ️
        NVIDIA GeForce 9400 - VRAM: 256 MB
            Acer P191W 1440 x 900 @ 60 Hz
    System Software: ℹ️
        OS X 10.10.2 (14C1514) - Time since boot: one day 22:49:30
    Disk Information: ℹ️
        Hitachi HTS543225L9SA02 disk0 : (250.06 GB)
            EFI (disk0s1) <not mounted> : 210 MB
            disk0s2 (disk0s2) <not mounted> : 249.20 GB
            Recovery HD (disk0s3) <not mounted>  [Recovery]: 650 MB
        OPTIARC DVD RW AD-5670S
    USB Information: ℹ️
        Generic Mass Storage Device
        Logitech Trackball
        Newer Tech miniStack Classic 2 TB
            disk2s1 (disk2s1) <not mounted> : 210 MB
            disk2s2 (disk2s2) <not mounted> : 249.25 GB
            My Mac Time Machine (disk2s3) /Volumes/My Mac Time Machine : 1.50 TB (831.73 GB free)
        Canon iP4300
        Apple Computer, Inc. IR Receiver
        Apple Inc. BRCM2046 Hub
            Apple Inc. Bluetooth USB Host Controller
    Firewire Information: ℹ️
        OWC Mercury Elite Pro Quad USB 3 800mbit - 800mbit max
            EFI (disk1s1) <not mounted> : 210 MB
            Macintosh HD (disk1s2) / : 319.21 GB (96.14 GB free)
            Recovery HD (disk1s3) <not mounted>  [Recovery]: 650 MB
            My Mac system (external) (disk1s4) /Volumes/My Mac system (external) : 499.46 GB (174.98 GB free)
    Gatekeeper: ℹ️
        Mac App Store and identified developers
    Kernel Extensions: ℹ️
            /Applications/TechTool Pro 7.app
        [not loaded]    com.micromat.driver.spdKernel (1 - SDK 10.8) [Click for support]
        [not loaded]    com.micromat.driver.spdKernel-10-8 (1 - SDK 10.8) [Click for support]
            /Library/StartupItems/BRESINKx86Monitoring
        [not loaded]    com.bresink.driver.BRESINKx86Monitoring (9.0) [Click for support]
            /System/Library/Extensions
        [loaded]    com.microsoft.driver.MicrosoftKeyboard (8.2) [Click for support]
            /System/Library/Extensions/MicrosoftKeyboard.kext/Contents/PlugIns
        [loaded]    com.microsoft.driver.MicrosoftKeyboardBluetooth (8.2) [Click for support]
        [not loaded]    com.microsoft.driver.MicrosoftKeyboardUSB (8.2) [Click for support]
            /Users/[redacted]/Downloads/LCC Installer.app
        [not loaded]    com.Logitech.Control Center.HID Driver (3.5.1 - SDK 10.0) [Click for support]
    Startup Items: ℹ️
        Executor: Path: /Library/StartupItems/Executor
        Startup items are obsolete in OS X Yosemite
    Problem System Launch Agents: ℹ️
        [killed]    com.apple.CallHistoryPluginHelper.plist
        [killed]    com.apple.CallHistorySyncHelper.plist
        [killed]    com.apple.cmfsyncagent.plist
        [killed]    com.apple.coreservices.appleid.authentication.plist
        [killed]    com.apple.EscrowSecurityAlert.plist
        [killed]    com.apple.sbd.plist
        [killed]    com.apple.scopedbookmarkagent.xpc.plist
        [killed]    com.apple.telephonyutilities.callservicesd.plist
        [killed]    com.apple.xpc.loginitemregisterd.plist
        9 processes killed due to memory pressure
    Problem System Launch Daemons: ℹ️
        [killed]    com.apple.ctkd.plist
        [killed]    com.apple.ifdreader.plist
        [killed]    com.apple.nehelper.plist
        [killed]    com.apple.softwareupdate_download_service.plist
        [killed]    com.apple.xpc.smd.plist
        [killed]    org.cups.cupsd.plist
        6 processes killed due to memory pressure
    Launch Agents: ℹ️
        [loaded]    com.google.keystone.agent.plist [Click for support]
        [running]    com.micromat.TechToolProAgent.plist [Click for support]
        [loaded]    org.macosforge.xquartz.startx.plist [Click for support]
    Launch Daemons: ℹ️
        [loaded]    com.adobe.fpsaud.plist [Click for support]
        [loaded]    com.bombich.ccc.plist [Click for support]
        [running]    com.crashplan.engine.plist [Click for support]
        [loaded]    com.google.keystone.daemon.plist [Click for support]
        [running]    com.micromat.TechToolProDaemon.plist [Click for support]
        [failed]    com.nalpeiron.netpro.plist [Click for support]
        [loaded]    com.prosofteng.DriveGenius.locum.plist [Click for support]
        [loaded]    org.macosforge.xquartz.privileged_startx.plist [Click for support]
    User Launch Agents: ℹ️
        [failed]    com.adobe.ARM.[...].plist [Click for support]
        [failed]    com.amazon.cloud-player.plist [Click for support]
        [running]    com.amazon.music.plist [Click for support]
        [failed]    [email protected]
        [failed]    com.citrixonline.GoToMeeting.G2MUpdate.plist [Click for support] [Click for details]
        [failed]    com.google.GoogleContactSyncAgent.plist [Click for support]
        [failed]    com.plexapp.helper.plist [Click for support]
        [failed]    com.yahoo.YahooContactSyncAgent.plist [Click for support]
        [loaded]    net.jonstovell.keepMinasTirithdata(external)Spinning.plist [Click for support]
    User Login Items: ℹ️
        iTunesHelper    Application Hidden (/Applications/iTunes.app/Contents/MacOS/iTunesHelper.app)
        MiniUsage    Application  (/Applications/MiniUsage.app)
        Alfred    Application  (/Applications/Alfred.app)
        OpenDNS Updater    Application Hidden (/Applications/OpenDNS Updater.app)
        CrashPlan menu bar    Application  (/Applications/CrashPlan.app/Contents/Helpers/CrashPlan menu bar.app)
        OneDrive    Application  (/Applications/OneDrive.app)
    Internet Plug-ins: ℹ️
        Flip4Mac WMV Plugin: Version: 3.2.0.16   - SDK 10.8 [Click for support]
        FlashPlayer-10.6: Version: 17.0.0.134 - SDK 10.6 [Click for support]
        EPPEX Plugin: Version: 4.1.0.0 [Click for support]
        Flash Player: Version: 17.0.0.134 - SDK 10.6 [Click for support]
        Default Browser: Version: 600 - SDK 10.10
        JavaAppletPlugin: Version: 15.0.0 - SDK 10.10 Check version
        o1dbrowserplugin: Version: 5.40.2.0 - SDK 10.8 [Click for support]
        QuickTime Plugin: Version: 7.7.3
        googletalkbrowserplugin: Version: 5.40.2.0 - SDK 10.8 [Click for support]
        Silverlight: Version: 5.1.20125.0 - SDK 10.6 [Click for support]
        iPhotoPhotocast: Version: 7.0 - SDK 10.8
    User internet Plug-ins: ℹ️
        CitrixOnlineWebDeploymentPlugin: Version: 1.0.105 [Click for support]
        Picasa: Version: 1.0 [Click for support]
        Google Earth Web Plug-in: Version: 7.1 [Click for support]
    Safari Extensions: ℹ️
        feedly
        Add to Google Reader
        FlickrPlus
        Ultimate Status Bar
        Exposer
        Evernote Web Clipper
        InvisibleHand
        Turn Off the Lights
        The New York Times
        Procrastinate
        Better Facebook
        Save to Pocket
        Print Plus
    3rd Party Preference Panes: ℹ️
        Flash Player  [Click for support]
        Flip4Mac WMV  [Click for support]
        Microsoft Keyboard  [Click for support]
        TechTool Protection  [Click for support]
    Time Machine: ℹ️
        Skip System Files: NO
        Mobile backups: OFF
        Auto backup: NO - Auto backup turned off
        Volumes being backed up:
            My Mac system (external): Disk size: 499.46 GB Disk used: 324.48 GB
            Macintosh HD: Disk size: 319.21 GB Disk used: 223.07 GB
        Destinations:
            My Mac Time Machine [Local]
            Total size: 1.50 TB
            Total number of backups: 59
            Oldest backup: 2013-12-04 08:43:17 +0000
            Last backup: 2015-04-05 15:12:17 +0000
            Size of backup disk: Too small
                Backup size 1.50 TB < (Disk used 547.55 GB X 3)
    Top Processes by CPU: ℹ️
             4%    top
             2%    WindowServer
             2%    systemstatsd
             1%    Safari
             0%    MiniUsage
    Top Processes by Memory: ℹ️
        266 MB    CrashPlanService
        112 MB    Mail
        86 MB    Finder
        82 MB    Console
        69 MB    Safari
    Virtual Memory Information: ℹ️
        106 MB    Free RAM
        983 MB    Active RAM
        895 MB    Inactive RAM
        870 MB    Wired RAM
        17.28 GB    Page-ins
        506 MB    Page-outs
    Diagnostics Information: ℹ️
        Apr 6, 2015, 08:15:21 PM    /Users/[redacted]/Library/Logs/DiagnosticReports/com.apple.MailServiceAgent_201 5-04-06-201521_[redacted].crash
        Apr 5, 2015, 10:35:53 PM    /Users/[redacted]/Library/Logs/DiagnosticReports/QuickLookSatellite_2015-04-05- 223553_[redacted].crash
        Apr 5, 2015, 10:35:52 PM    /Users/[redacted]/Library/Logs/DiagnosticReports/QuickLookSatellite_2015-04-05- 223552_[redacted].crash
        Apr 5, 2015, 10:16:51 PM    Self test - passed
        Apr 5, 2015, 03:58:09 PM    /Library/Logs/DiagnosticReports/CrashPlanService_2015-04-05-155809_[redacted].c pu_resource.diag [Click for details]

    I switched over to an early 2008 20-inch iMac (booting from same external disk) and the "ERROR:shrink DB" and "assertion failed" messages are continuing, so I doubt that it is related to the hardware unless it's the external drive itself or the Firewire cable.
    Any help would be appreciated...

  • Newbie Automatic restore issues

    Hi:
    I have two issues with a program I am working on to do an automated restore, The restore takes a backup from production, and replaces the database entirely every day so we have offloaded current information: I avoid logical names because we don't want a
    database named production:
    FIRST ISSUE:
    I would like to be able to drop the database. When I drop it interactively, I always click the box close existing connections: The problem is what to do with an interactive connection: Is there any way with an automated restore replace to intrinsically drop
    the database? Although it's not something you normally want to do, it is something in this case that I HAVE to do to ensure the restore works and the with moves move the correctly named files.
    SECOND ISSUE
    When I run the following statement:
    USE [coll18_FinAidNoHR]
    DBCC SHRINKFILE (N'coll18_production_log' , 0, TRUNCATEONLY)
    GO
    I get the following error:
    Cannot shrink log file 2 (coll18_production_log) because the logical log file located at the end of the file is in use.
    (1 row(s) affected)
    DBCC execution completed. If DBCC printed error messages, contact your system administrator.
    Is there any way  to work around this without programming?

    As for question 2-thanks for all the info on DBCC SHRINKFILE I think the best decision is to do it as needed.The
    Restore is a knottier problem. I can't to a restore replace because I want to change the file names. I can't have the logical names.
    I run a prestep before my restore that does this common stuff:
    if exists (select * from sys.sysdatabases where name = 'FinAidNoHR')
    EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'FinAidNoHR'
    if exists (select * from sys.sysdatabases where name = 'FinAidNoHR')
    ALTER DATABASE [FinAidNoHR] SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
    if exists (select * from sys.sysdatabases where name = 'FinAidNoHR')
        drop DATABASE  [FinAidNoHR];
    The restore step fails with this error:
    Executed as user: CAMPUS\UCCTD10_SQL. Exclusive access could not be obtained because the database is in use. [SQLSTATE 42000] (Error 3101) 
    When I run an SP_WHO it DOES show the database open in a sleeping state on a remote machine that did not shut down the instance, but this DROP should have had the effect of an interactive drop with close existing connections checked.
    When I did other tests like selecting top 1000 rows from another test database,SP_WHO shows it open in the same way but the DROP works fine.
    Before I tear out what little hair I have left, can anybody tell me why it would  not drop the connection?
    (It was my boss's PC)

  • Infrastructure Maintenance

    Hi,
    I have two questions:
    1) I seem to remember from my 10gAS Admin class that I shouldn't perform any maintenance (regular analyzes, space maintenance, etc) on the infrastructure database. However, I can't find any documentation that confirms or denys this. I can find all sorts of information regarding middle tier performance monitoring/tuning, but nothing specifically regarding the infrastructure database. Is it going to 'break' things if I do run regular analyzes, install statspack and so on? If someone could give me a doc number or point me in the right direction it would be appreciated.
    2) Also, the log files from the various components can become very large and have filled up my $ORACLE_HOME filesystem. Is there something that handles these (automatically removes/shrinks them) that I have missed? Or do I just need to come up with a home-grown script or two that will take care of this for me.
    Any help would be appreciated.
    Thank you

    The infrastructure consists of several repositories that have been pre-tuned by Oracle.
    Specifically, I encourage you NOT to run statistics against the OiD repository unless the repository is at least Oracle database 10.2 or if you have a specific performance problem and Oracle Support tells you to rerun the stats.
    AFAIK there is no log file shrinker. Suggest you look through the logs for errors, and shrink them manually. Also look through the configs to understand why the logs are growing. (THe default settings have always seemed too-much-logging for me.)

  • Error ORA-10635 when shrink a table!!

    Hi all,
    I have a table created in a tablespace using ASSM and when i try to shrink this table i receive the error ORA-10635. I can do shrink on other tables that are on the same tablespace of that table that is giving me this error.
    Anyone can help please??
    Tks,
    Paulo.

    10635, 00000, "Invalid segment or tablespace type"
    // *Cause: Cannot shrink the segment because it is not in auto segment space
    // managed tablespace or it is not a data, index or lob segment.
    // *Action: Check the tablespace and segment type and reissue the statement                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Disk Utility - Unable to Shrink Disk Error

    hey guys,
    I have been trying to shrink my system partition but i keep getting an error.
    I had Vista installed on a boot camp partition, but i needed to reinstall it and i decided to start from scratch. I erased the vista partition and tried to recreate it. I ran boot camp assistant but that failed at creating a new partition.
    I ran disk utility to first try and shrink the system drive, then increase the size to full before i rerun the boot camp partition. however, i cannot shrink.
    this is the error i get.
    http://dl.getdropbox.com/u/734117/Screen%20shot%202009-10-25%20at%208.48.54%20AM .png
    I had only about 35 gigs free and i tried to create a 20 gig partition. after that error, i erased some data and now have just under 100 gigs free. but the drive still cannot shrink
    I was hoping to find a way to shrink the drive, or defragment without having to erase the entire disk and reinstall. i do not have the backup capabilities to move all my data at this point.
    Thanks for your help

    Hahmad wrote:
    How do i create a clone?
    first, you need an external drive. then use CCCloner http://www.bombich.com/index.html
    or Superduper http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html
    to clone the OS X partition to the external. make sure that the external is formatted with GUID partition scheme before cloning. if needed reformat it first with disk utility.

  • Segment Shrinking script erroring out due to Function based indexes, lobs,.

    DB version:10gR2
    Following is a script i made for freeing up(SHRINK ing and resetting HWM) the space in Tables and its indexes. Due to the existence of LOB Segments and Tables with Function based indexes, this script was erroring out. So i was wondering if there is a way to find out the segments which are eligible/not eligible for Shrinking so that i could make necessary changes to the below script.
    create or replace procedure freeup_space
    is
    type v_segment_type is table of varchar2(30) index by binary_integer;
    v_segment v_segment_type;
    begin
    select segment_name bulk collect into v_segment
                   from user_segments
                   where segment_type in ('TABLE')
                     and segment_name not like 'BIN%';
    for i in v_segment.first..v_segment.last loop
    execute immediate 'alter table ' || v_segment(i) ||' enable row movement';
    dbms_output.put_line('Table '||v_segment(i)||'''s row movement enabled');
    execute immediate 'alter table ' || v_segment(i) ||' shrink space cascade';
    execute immediate 'alter table ' || v_segment(i) ||' deallocate unused';
    end loop;
    end;
    /

    You can use USER_LOBS views to look for LOB columns in the segments and ALL_INDEXES.INDEX_TYPE tells if the index is function based index or not.
    Message was edited by:
    Pierre Forstmann

  • Screen shrinks; Remote server error message

    When Users other than me log on they get an error message after a few minutes. The screen shrinks to the upper left hand corner and red text appears in the center of the screen: "Unable to connect to remote server. Please ensure main computer is running and within the same local area network. Click to continue". I cannot figure out where this message is coming from. I do not connect to any remote servers, I have sharing off, and firewalls on. It only occurs for my non-administrator users.
    Any ideas what is triggering this message?

    I would suggest a complete reinstallation of the software. First uninstall the software using windows uninstaller and then comfirm if the folder c:\Program Files (x86)\Adobe\Photoshop Elements 5\ or c:\Program Files\Adobe\Photoshop Elements 5 whichever applicable has been deleted.  After this, install the PSE again

  • Database Shrink Error: 8985

    Hi All,
    Version: Microsoft SQL Server 2008 (SP3) - Enterprise Edition.
    While performing the DB Shrink, I get the following error on both the editions
    Enterprise and Developer. Recently I have upgraded the Service pack from SP2 to SP3. From then this issue has started.
    I have verified the log logical name and physical path which is available and its correct.
    The Command that I use to Shrink is below:
    USE XXX
    GO
    DBCC SHRINKFILE (XXX_Log, 0);
    GO
    Error Message: Could not locate file 'XXX_Log' for database 'XXX' in sys.database_files. The file either does not exist, or was dropped. [SQLSTATE
    42000] (Error 8985).  The step failed.
    Please suggest or help me to sort out this issue.

    Hi All,
    Version: Microsoft SQL Server 2008 (SP3) - Enterprise Edition.
    While performing the DB Shrink, I get the following error on both the editions
    Enterprise and Developer. Recently I have upgraded the Service pack from SP2 to SP3. From then this issue has started.
    I have verified the log logical name and physical path which is available and its correct.
    The Command that I use to Shrink is below:
    USE XXX
    GO
    DBCC SHRINKFILE (XXX_Log, 0);
    GO
    Error Message: Could not locate file 'XXX_Log' for database 'XXX' in sys.database_files. The file either does not exist, or was dropped. [SQLSTATE
    42000] (Error 8985).  The step failed.
    Please suggest or help me to sort out this issue.
    Firstly, make 100% sure that the log file name is correct. Once you have confirmed that then run a DBCC Consistency check against your database and then re-run the shrink command.
    I've had the exact same issue, after running a full DBCC against the database, the problem was resolved.

  • CSA MC DATABASE SHRINK ERROR

    HI ,
    I am facing a problem frequently in CSA MC when I Shrink the database in the Database maintanence .I am getting error
    Error: Shrink operation failed for database csamc52. See csamclog.txt for details .When I look in to CSAMC LOG The error is
    SQL: shrinking db
    [2008-10-08 02:26:11.643] [PID=4712] [Csamcmanager52]: DoFlushIfNeeded: Failed to sync events to database: 0x80004005
    [2008-10-08 02:27:43.782] [PID=4712] [Csamcmanager52]: DoFlushIfNeeded: Failed to sync events to database: 0x80004005
    Can any one revert on this ?

    You may try using the following steps:
    Open a CMD command window on the CSAMC50 server, and type :
    - net stop csagent ( stop CSA agent )
    - net stop crmdmgtd ( stop CiscoWorks )
    - osql -E
    Use csamc50
    go
    backup log csamc50 with no_log
    go
    dbcc shrinkfile (csamc50_log)
    go
    - net start crmdmgtd ( start CiscoWorks )
    - net start csagent ( Start CSA agent )

  • Can I recover my new hard drive shrinked after formatting errors?

    Hi, I wanted to install a 500 Gb WD drive in a G4, but forgot about the size limitation. I copied the OS and apps using Target mode to a 75 Gb volume, and the empty volume was 390 Gb in size. When I booted, the large volume was only recognized as 52. Never mind, I had a program called Drive Genius which is supposed to allow resizing drives without erasing the contents which I had already copied back to the smaller volume. So I ran the program on the drive to make two partitions below 300 Gb. But this program made unrecoverable errors, and one of the new partitions was dead and gone. I tried everything, from repairing to erasing the whole drive, and I am now left with a 128 Gb drive and unable to recover the rest of it. This program does really a mess, it's the second time I try this and second time it jams a drive. The last time I could reformat it, but not this time. Do you have any suggestions? ...Or just sympathy for the dead drive? Thanks!
    Paul
    I should add that there is an ACARD PCI 2x ATA 133 in the tower, so 300 Gb drives should be OK.

    I am a bit confused. If the drive is plugged into the PCI card then it should work with 500GB. If it is plugged into the G4's native bus (which I assume is an older G4 with the 128GB limitation) then regardless of the number or size of the partitions it will only see 128GB of a drive. So where's this thing plugged into now?
    I have only read about Drive Genius and resizing partitions. It's the kind of thing that I think if it works, great, but I want to have a backup of my drive before I try it.
    I am not sure what is left of the drive contents after all the partitioning and formatting. You could try using an application such as [Data Rescue II|http://www.prosofteng.com/products/data_rescue.php] or [FileSalvage|http://subrosasoft.com/OSXSoftware/index.php?mainpage=product_info&productsid=1]. Both have free trial versions that let you see if the software will help before you decide to buy.
    There is also this free tool which supposedly runs on OSX (Intel only? - not sure) and does recovery of popular media and Office files. [http://www.cgsecurity.org/wiki/TestDisk_Download] I have no idea if it works and maybe you're tired of testing software on this drive by now.

  • Error trying to shrink logs using management studio

    hi,
    i am trying to shrink my transaction logs.  my database is 4.4TB in size.  the trn logs are backed up every 15mins to nas so not quite sure how they blew up from 100gb to over 200gb in one night.
    when i try to shrink files i get.  cannot show requested dialog.  value of 4625504 is not
    valid for value.  value should be between minimum and maximum parameter name: vlaue.
    nothing in the event log......
    any help appreciated.
    thanks
    phill

    Hello,
    Try applying the latest service pack on SSMS or use a newer version of SSMS. My suggestion is based on the following Connect item:
    http://connect.microsoft.com/SQLServer/feedback/details/688397/ssms-database-shrink-dialog-displays-value-of-x-is-not-valid-for-value-value-should-be-between-minimum-and-maximum
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Package.......StatsPack...Error..

    Hi.. i m tuning my Oracle Database, for that i need to install Statspack package, when i compiled package... it returned following error.
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY STATSPACK:
    LINE/COL ERROR
    2045/3 PLS-00201: identifier 'SYS.DBMS_SHARED_POOL' must be declared
    2045/3 PL/SQL: Statement ignored
    HOw to solve above error..Please check the following Package, and do help me.
    Note: I m connected perfstat user, no as SYS user.
    create or replace package body STATSPACK as
    /* Define package variables.
    Variables prefixed with p_ are package variables.
    p_snap_id integer; /* snapshot id */
    p_instance_number number; /* instance number */
    p_instance_name varchar2(16); /* instance name */
    p_startup_time date; /* instance startup time */
    p_parallel varchar2(3); /* parallel server */
    p_version varchar2(17); /* Oracle release */
    p_dbid number; /* database id */
    p_host_name varchar2(64); /* host instance is on */
    p_name varchar2(9); /* database name */
    p_new_sga integer; /* Instance bounced since last snap? */
    tmp_int integer; /* initialise defaults */
    p_def_snap_level number default 5; /* default snapshot lvl */
    p_def_session_id number default 0; /* default session id */
    p_def_ucomment varchar2(160) default null;
    p_def_pin_statspack varchar2(10) default 'TRUE';
    p_def_last_modified date default SYSDATE;
    /* Below are the default threshold (_th) values for choosing SQL statements
    to store in the stats$sqlsummary table - these statements will typically
    be the statements using the most resources.
    p_def_num_sql number default 50; /* Num. SQL statements */
    p_def_executions_th number default 100; /* Num. executions */
    p_def_parse_calls_th number default 1000; /* Num. parse calls */
    p_def_disk_reads_th number default 1000; /* Num. disk reads */
    p_def_buffer_gets_th number default 10000; /* Num. buf gets */
    p_def_sharable_mem_th number default 1048576; /* Sharable memory */
    p_def_version_count_th number default 20; /* Child Cursors */
    p_def_all_init varchar2(10) default 'FALSE';
    cursor get_instance is
    select instance_number, instance_name
    , startup_time, parallel, version
    , host_name
    from v$instance;
    cursor get_db is
    select dbid, name
    from v$database;
    procedure SNAP
    (i_snap_level in number default null
    ,i_session_id in number default null
    ,i_ucomment in varchar2 default null
    ,i_num_sql in number default null
    ,i_executions_th in number default null
    ,i_parse_calls_th in number default null
    ,i_disk_reads_th in number default null
    ,i_buffer_gets_th in number default null
    ,i_sharable_mem_th in number default null
    ,i_version_count_th in number default null
    ,i_all_init in varchar2 default null
    ,i_pin_statspack in varchar2 default null
    ,i_modify_parameter in varchar2 default 'FALSE'
    is
    /* Takes a snapshot by calling the SNAP function, and discards
    the snapshot id. This is useful when automating taking
    snapshots from dbms_job
    l_snap_id number;
    begin
    l_snap_id := statspack.snap ( i_snap_level, i_session_id, i_ucomment
    , i_num_sql
    , i_executions_th
    , i_parse_calls_th
    , i_disk_reads_th
    , i_buffer_gets_th
    , i_sharable_mem_th
    , i_version_count_th
    , i_all_init
    , i_pin_statspack
    , i_modify_parameter);
    end SNAP;
    procedure MODIFY_STATSPACK_PARAMETER
    ( i_dbid in number default null
    , i_instance_number in number default null
    , i_snap_level in number default null
    , i_session_id in number default null
    , i_ucomment in varchar2 default null
    , i_num_sql in number default null
    , i_executions_th in number default null
    , i_parse_calls_th in number default null
    , i_disk_reads_th in number default null
    , i_buffer_gets_th in number default null
    , i_sharable_mem_th in number default null
    , i_version_count_th in number default null
    , i_all_init in varchar2 default null
    , i_pin_statspack in varchar2 default null
    , i_modify_parameter in varchar2 default 'TRUE'
    is
    /* Calls QAM with the modify flag, and discards the
    output variables
    l_snap_level number;
    l_session_id number;
    l_ucomment varchar2(160);
    l_num_sql number;
    l_executions_th number;
    l_parse_calls_th number;
    l_disk_reads_th number;
    l_buffer_gets_th number;
    l_sharable_mem_th number;
    l_version_count_th number;
    l_all_init varchar2(5);
    l_pin_statspack varchar2(10);
    begin
    statspack.qam_statspack_parameter( i_dbid
    , i_instance_number
    , i_snap_level
    , i_session_id
    , i_ucomment
    , i_num_sql
    , i_executions_th
    , i_parse_calls_th
    , i_disk_reads_th
    , i_buffer_gets_th
    , i_sharable_mem_th
    , i_version_count_th
    , i_all_init
    , i_pin_statspack
    , 'TRUE'
    , l_snap_level
    , l_session_id
    , l_ucomment
    , l_num_sql
    , l_executions_th
    , l_parse_calls_th
    , l_disk_reads_th
    , l_buffer_gets_th
    , l_sharable_mem_th
    , l_version_count_th
    , l_all_init
    , l_pin_statspack);
    /* As we have explicity been requested to change the parameters,
    independently of taking a snapshot, commit
    commit;
    end MODIFY_STATSPACK_PARAMETER;
    procedure QAM_STATSPACK_PARAMETER
    ( i_dbid in number default null
    , i_instance_number in number default null
    , i_snap_level in number default null
    , i_session_id in number default null
    , i_ucomment in varchar2 default null
    , i_num_sql in number default null
    , i_executions_th in number default null
    , i_parse_calls_th in number default null
    , i_disk_reads_th in number default null
    , i_buffer_gets_th in number default null
    , i_sharable_mem_th in number default null
    , i_version_count_th in number default null
    , i_all_init in varchar2 default null
    , i_pin_statspack in varchar2 default null
    , i_modify_parameter in varchar2 default 'FALSE'
    , o_snap_level out number
    , o_session_id out number
    , o_ucomment out varchar2
    , o_num_sql out number
    , o_executions_th out number
    , o_parse_calls_th out number
    , o_disk_reads_th out number
    , o_buffer_gets_th out number
    , o_sharable_mem_th out number
    , o_version_count_th out number
    , o_all_init out varchar2
    , o_pin_statspack out varchar2
    is
    /* Query And Modify statspack parameter procedure, allows query
    and/or user modification of the statistics collection parameters
    for an instance. If there are no pre-existing parameters for
    an instance, insert the Oracle defaults.
    l_instance_number number;
    l_dbid number;
    ui_all_init varchar2(5);
    l_params_exist varchar2(1);
    begin
    if ((i_dbid is null ) or (i_instance_number is null)) then
    l_dbid := p_dbid;
    l_instance_number := p_instance_number;
    else
    l_dbid := i_dbid;
    l_instance_number := i_instance_number;
    end if;
    /* Upper case any input vars which are inserted */
    ui_all_init := upper(i_all_init);
    if ( (i_modify_parameter is null)
    or (upper(i_modify_parameter) = 'FALSE') ) then
    /* Query values, if none exist, insert the defaults tempered
    with variables supplied */
    begin
    select nvl(i_session_id, session_id)
    , nvl(i_snap_level, snap_level)
    , nvl(i_ucomment, ucomment)
    , nvl(i_num_sql, num_sql)
    , nvl(i_executions_th, executions_th)
    , nvl(i_parse_calls_th, parse_calls_th)
    , nvl(i_disk_reads_th, disk_reads_th)
    , nvl(i_buffer_gets_th, buffer_gets_th)
    , nvl(i_sharable_mem_th, sharable_mem_th)
    , nvl(i_version_count_th, version_count_th)
    , nvl(ui_all_init, all_init)
    , nvl(i_pin_statspack, pin_statspack)
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack
    from stats$statspack_parameter
    where instance_number = l_instance_number
    and dbid = l_dbid;
    exception
    when NO_DATA_FOUND then
    insert into stats$statspack_parameter
    ( dbid
    , instance_number
    , session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    , last_modified
    values
    ( l_dbid
    , l_instance_number
    , p_def_session_id
    , p_def_snap_level
    , p_def_ucomment
    , p_def_num_sql
    , p_def_executions_th
    , p_def_parse_calls_th
    , p_def_disk_reads_th
    , p_def_buffer_gets_th
    , p_def_sharable_mem_th
    , p_def_version_count_th
    , p_def_all_init
    , p_def_pin_statspack
    , SYSDATE
    returning nvl(i_session_id, p_def_session_id)
    , nvl(i_snap_level, p_def_snap_level)
    , nvl(i_ucomment, p_def_ucomment)
    , nvl(i_num_sql, p_def_num_sql)
    , nvl(i_executions_th, p_def_executions_th)
    , nvl(i_parse_calls_th, p_def_parse_calls_th)
    , nvl(i_disk_reads_th, p_def_disk_reads_th)
    , nvl(i_buffer_gets_th, p_def_buffer_gets_th)
    , nvl(i_sharable_mem_th, p_def_sharable_mem_th)
    , nvl(i_version_count_th, p_def_version_count_th)
    , nvl(ui_all_init, p_def_all_init)
    , nvl(i_pin_statspack, p_def_pin_statspack)
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack;
    end; /* don't modify parameter values */
    elsif upper(i_modify_parameter) = 'TRUE' then
    /* modify values, if none exist, insert the defaults tempered
    with the variables supplied */
    begin
    update stats$statspack_parameter
    set session_id = nvl(i_session_id, session_id)
    , snap_level = nvl(i_snap_level, snap_level)
    , ucomment = nvl(i_ucomment, ucomment)
    , num_sql = nvl(i_num_sql, num_sql)
    , executions_th = nvl(i_executions_th, executions_th)
    , parse_calls_th = nvl(i_parse_calls_th, parse_calls_th)
    , disk_reads_th = nvl(i_disk_reads_th, disk_reads_th)
    , buffer_gets_th = nvl(i_buffer_gets_th, buffer_gets_th)
    , sharable_mem_th = nvl(i_sharable_mem_th, sharable_mem_th)
    , version_count_th = nvl(i_version_count_th, version_count_th)
    , all_init = nvl(ui_all_init, all_init)
    , pin_statspack = nvl(i_pin_statspack, pin_statspack)
    where instance_number = l_instance_number
    and dbid = l_dbid
    returning session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack;
    if SQL%ROWCOUNT = 0 then
    insert into stats$statspack_parameter
    ( dbid
    , instance_number
    , session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    , last_modified
    values
    ( l_dbid
    , l_instance_number
    , nvl(i_session_id, p_def_session_id)
    , nvl(i_snap_level, p_def_snap_level)
    , nvl(i_ucomment, p_def_ucomment)
    , nvl(i_num_sql, p_def_num_sql)
    , nvl(i_executions_th, p_def_executions_th)
    , nvl(i_parse_calls_th, p_def_parse_calls_th)
    , nvl(i_disk_reads_th, p_def_disk_reads_th)
    , nvl(i_buffer_gets_th, p_def_buffer_gets_th)
    , nvl(i_sharable_mem_th, p_def_sharable_mem_th)
    , nvl(i_version_count_th, p_def_version_count_th)
    , nvl(ui_all_init, p_def_all_init)
    , nvl(i_pin_statspack, p_def_pin_statspack)
    , SYSDATE
    returning session_id
    , snap_level
    , ucomment
    , num_sql
    , executions_th
    , parse_calls_th
    , disk_reads_th
    , buffer_gets_th
    , sharable_mem_th
    , version_count_th
    , all_init
    , pin_statspack
    into o_session_id
    , o_snap_level
    , o_ucomment
    , o_num_sql
    , o_executions_th
    , o_parse_calls_th
    , o_disk_reads_th
    , o_buffer_gets_th
    , o_sharable_mem_th
    , o_version_count_th
    , o_all_init
    , o_pin_statspack;
    end if;
    end; /* modify values */
    else
    /* error */
    raise_application_error
    (-20100,'QAM_STATSPACK_PARAMETER i_modify_parameter value is invalid');
    end if; /* modify */
    end QAM_STATSPACK_PARAMETER;
    procedure STAT_CHANGES
    /* Returns a set of differences of the values from corresponding pairs
    of rows in STATS$SYSSTAT, STATS$LIBRARYCACHE and STATS$WAITSTAT,
    based on the begin and end (bid, eid) snapshot id's specified.
    This procedure is the only call to STATSPACK made by the statsrep
    report.
    Modified to include multi-db support.
    ( bid IN number
    , eid IN number
    , db_ident IN number
    , inst_num IN number
    , parallel IN varchar2
    , lhtr OUT number, bfwt OUT number
    , tran OUT number, chng OUT number
    , ucal OUT number, urol OUT number
    , rsiz OUT number
    , phyr OUT number, phyrd OUT number
    , phyrdl OUT number
    , phyw OUT number, ucom OUT number
    , prse OUT number, hprse OUT number
    , recr OUT number, gets OUT number
    , rlsr OUT number, rent OUT number
    , srtm OUT number, srtd OUT number
    , srtr OUT number, strn OUT number
    , lhr OUT number, bc OUT varchar2
    , sp OUT varchar2, lb OUT varchar2
    , bs OUT varchar2, twt OUT number
    , logc OUT number, prscpu OUT number
    , tcpu OUT number, exe OUT number
    , prsela OUT number
    , bspm OUT number, espm OUT number
    , bfrm OUT number, efrm OUT number
    , blog OUT number, elog OUT number
    , bocur OUT number, eocur OUT number
    , dmsd OUT number, dmfc OUT number -- begin OPS
    , dfcms OUT number, dfcmr OUT number
    , dmsi OUT number, dmrv OUT number
    , dynal OUT number, dynares OUT number
    , pmrv OUT number, pmpt OUT number
    , npmrv OUT number, npmpt OUT number
    , scma OUT number, scml OUT number
    , pinc OUT number, picrnc OUT number
    , picc OUT number, picrcc OUT number
    , pbc OUT number, pbcrc OUT number
    , pcba OUT number, pccrba OUT number
    , pcrbpi OUT number
    , dynapres OUT number, dynapshl OUT number
    , prcma OUT number, prcml OUT number
    , pwrm OUT number, pfpim OUT number
    , pwnm OUT number
    , dpms OUT number, dnpms OUT number
    , glsg OUT number, glag OUT number
    , glgt OUT number, glsc OUT number
    , glac OUT number, glct OUT number
    , glrl OUT number
    , gcge OUT number, gcgt OUT number
    , gccv OUT number, gcct OUT number
    , gccrrv OUT number, gccrrt OUT number
    , gccurv OUT number, gccurt OUT number
    , gccrsv OUT number
    , gccrbt OUT number, gccrft OUT number
    , gccrst OUT number, gccusv OUT number
    , gccupt OUT number, gccuft OUT number
    , gccust OUT number -- end OPS
    ) is
    bval number;
    eval number;
    l_b_session_id number; /* begin session id */
    l_b_serial# number; /* begin serial# */
    l_e_session_id number; /* end session id */
    l_e_serial# number; /* end serial# */
    function LIBRARYCACHE_HITRATIO RETURN number is
    /* Returns Library cache hit ratio for the begin and end (bid, eid)
    snapshot id's specified
    cursor LH (i_snap_id number) is
    select sum(pins), sum(pinhits)
    from stats$librarycache
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num;
    bpsum number;
    bhsum number;
    epsum number;
    ehsum number;
    begin
    if not LH%ISOPEN then open LH (bid); end if;
    fetch LH into bpsum, bhsum;
    if LH%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for stats$librarycache');
    end if; close LH;
    if not LH%ISOPEN then open LH (eid); end if;
    fetch LH into epsum, ehsum;
    if LH%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for stats$librarycache');
    end if; close LH;
    return (ehsum - bhsum) / (epsum - bpsum);
    end LIBRARYCACHE_HITRATIO;
    function GET_PARAM (i_name varchar2) RETURN varchar2 is
    /* Returns the value for the init.ora parameter for the snapshot
    specified.
    cursor PARAMETER is
    select value
    from stats$parameter
    where snap_id = eid
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    par_value varchar2(512);
    begin
    if not PARAMETER%ISOPEN then open PARAMETER; end if;
    fetch PARAMETER into par_value;
    if PARAMETER%NOTFOUND then
    raise_application_error
    (-20100,'Missing Init.ora parameter '|| i_name);
    end if; close PARAMETER;
    return par_value;
    end GET_PARAM;
    function GET_SYSSTAT (i_name varchar2, i_beid number) RETURN number is
    /* Returns the value for the System Statistic for the snapshot
    specified.
    cursor SYSSTAT is
    select value
    from stats$sysstat
    where snap_id = i_beid
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    stat_value varchar2(512);
    begin
    if not SYSSTAT%ISOPEN then open SYSSTAT; end if;
    fetch SYSSTAT into stat_value;
    if SYSSTAT%NOTFOUND then
    raise_application_error
    (-20100,'Missing System Statistic '|| i_name);
    end if; close SYSSTAT;
    return stat_value;
    end GET_SYSSTAT;
    function BUFFER_WAITS RETURN number is
    /* Returns the total number of waits for all buffers in the interval
    specified by the begin and end snapshot id's (bid, eid)
    cursor BW (i_snap_id number) is
    select sum(wait_count)
    from stats$waitstat
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num;
    bbwsum number; ebwsum number;
    begin
    if not BW%ISOPEN then open BW (bid); end if;
    fetch BW into bbwsum;
    if BW%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for stats$waitstat');
    end if; close BW;
    if not BW%ISOPEN then open BW (eid); end if;
    fetch BW into ebwsum;
    if BW%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for stats$waitstat');
    end if; close BW;
    return ebwsum - bbwsum;
    end BUFFER_WAITS;
    function TOTAL_EVENT_TIME RETURN number is
    /* Returns the total amount of time waited for events for
    the interval specified by the begin and end snapshot id's
    (bid, eid) by foreground processes. This excludes idle
    wait events.
    cursor WAITS (i_snap_id number) is
    select sum(time_waited_micro)
    from stats$system_event
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num
    and event not in (select event from stats$idle_event);
    bwaittime number;
    ewaittime number;
    begin
    if not WAITS%ISOPEN then open WAITS (bid); end if;
    fetch WAITS into bwaittime;
    if WAITS%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for stats$system_event');
    end if; close WAITS;
    if not WAITS%ISOPEN then open WAITS (eid); end if;
    fetch WAITS into ewaittime;
    if WAITS%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for stats$system_event');
    end if; close WAITS;
    return ewaittime - bwaittime;
    end TOTAL_EVENT_TIME;
    function LATCH_HITRATIO return NUMBER is
    /* Returns the latch hit ratio specified by the begin and
    end snapshot id's (bid, eid)
    cursor GETS_MISSES (i_snap_id number) is
    select sum(gets), sum(misses)
    from stats$latch
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num;
    blget number; -- beginning latch gets
    blmis number; -- beginning latch misses
    elget number; -- end latch gets
    elmis number; -- end latch misses
    begin
    if not GETS_MISSES%ISOPEN then open GETS_MISSES (bid); end if;
    fetch GETS_MISSES into blget, blmis;
    if GETS_MISSES%NOTFOUND then
    raise_application_error
    (-20100,'Missing start value for STATS$LATCH gets and misses');
    end if; close GETS_MISSES;
    if not GETS_MISSES%ISOPEN then open GETS_MISSES (eid); end if;
    fetch GETS_MISSES into elget, elmis;
    if GETS_MISSES%NOTFOUND then
    raise_application_error
    (-20100,'Missing end value for STATS$LATCH gets and misses');
    end if; close GETS_MISSES;
    return ( ( elmis - blmis ) / ( elget - blget ) );
    end LATCH_HITRATIO;
    function SGASTAT (i_name varchar2, i_beid number) RETURN number is
    /* Returns the bytes used by i_name in the shared pool
    for the begin or end snapshot (bid, eid) specified
    cursor bytes_used is
    select bytes
    from stats$sgastat
    where snap_id = i_beid
    and dbid = db_ident
    and instance_number = inst_num
    and pool in ('shared pool', 'all pools')
    and name = i_name;
    total_bytes number;
    begin
    if i_name = 'total_shared_pool' then
    select sum(bytes)
    into total_bytes
    from stats$sgastat
    where snap_id = i_beid
    and dbid = db_ident
    and instance_number = inst_num
    and pool in ('shared pool','all pools');
    else
    open bytes_used; fetch bytes_used into total_bytes;
    if bytes_used%notfound then
    raise_application_error
    (-20100,'Missing value for SGASTAT: '||i_name);
    end if;
    close bytes_used;
    end if;
    return total_bytes;
    end SGASTAT;
    function SYSDIF (i_name varchar2) RETURN number is
    /* Returns the difference between statistics for the statistic
    name specified for the interval between the begin and end
    snapshot id's (bid, eid)
    cursor SY (i_snap_id number) is
    select value
    from stats$sysstat
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    begin
    /* Get start value */
    open SY (bid); fetch SY into bval;
    if SY%notfound then
    raise_application_error
    (-20100,'Missing start value for statistic: '||i_name);
    end if; close SY;
    /* Get end value */
    open SY (eid); fetch SY into eval;
    if SY%notfound then
    raise_application_error
    (-20100,'Missing end value for statistic: '||i_name);
    end if; close SY;
    /* Return difference */
    return eval - bval;
    end SYSDIF;
    function SESDIF (st_name varchar2) RETURN number is
    /* Returns the difference between statistics values for the
    statistic name specified for the interval between the begin and end
    snapshot id's (bid, eid), for the session monitored for that
    snapshot
    cursor SE (i_snap_id number) is
    select ses.value
    from stats$sysstat sys
    , stats$sesstat ses
    where sys.snap_id = i_snap_id
    and ses.snap_id = i_snap_id
    and ses.dbid = db_ident
    and sys.dbid = db_ident
    and ses.instance_number = inst_num
    and sys.instance_number = inst_num
    and ses.statistic# = sys.statistic#
    and sys.name = st_name;
    begin
    /* Get start value */
    open SE (bid); fetch SE into bval;
    if SE%notfound then
    eval :=0;
    end if; close SE;
    /* Get end value */
    open SE (eid); fetch SE into eval;
    if SE%notfound then
    eval :=0;
    end if; close SE;
    /* Return difference */
    return eval - bval;
    end SESDIF;
    function DLMDIF (i_name varchar2) RETURN number is
    /* Returns the difference between statistics for the statistic
    name specified for the interval between the begin and end
    snapshot id's (bid, eid)
    cursor DLM (i_snap_id number) is
    select value
    from stats$dlm_misc
    where snap_id = i_snap_id
    and dbid = db_ident
    and instance_number = inst_num
    and name = i_name;
    begin
    /* Get start value */
    open DLM (bid); fetch DLM into bval;
    if DLM%notfound then
    raise_application_error
    (-20100,'Missing start value for statistic: '||i_name);
    end if; close DLM;
    /* Get end value */
    open DLM (eid); fetch DLM into eval;
    if DLM%notfound then
    raise_application_error
    (-20100,'Missing end value for statistic: '||i_name);
    end if; close DLM;
    /* Return difference */
    return eval - bval;
    end DLMDIF;
    begin /* main procedure body of STAT_CHANGES */
    lhtr := LIBRARYCACHE_HITRATIO;
    bfwt := BUFFER_WAITS;
    lhr := LATCH_HITRATIO;
    chng := SYSDIF('db block changes');
    ucal := SYSDIF('user calls');
    urol := SYSDIF('user rollbacks');
    ucom := SYSDIF('user commits');
    tran := ucom + urol;
    rsiz := SYSDIF('redo size');
    phyr := SYSDIF('physical reads');
    phyrd := SYSDIF('physical reads direct');
    phyrdl := SYSDIF('physical reads direct (lob)');
    phyw := SYSDIF('physical writes');
    hprse := SYSDIF('parse count (hard)');
    prse := SYSDIF('parse count (total)');
    gets := SYSDIF('session logical reads');
    recr := SYSDIF('recursive calls');
    rlsr := SYSDIF('redo log space requests');
    rent := SYSDIF('redo entries');
    srtm := SYSDIF('sorts (memory)');
    srtd := SYSDIF('sorts (disk)');
    srtr := SYSDIF('sorts (rows)');
    logc := SYSDIF('logons cumulative');
    prscpu := SYSDIF('parse time cpu');
    prsela := SYSDIF('parse time elapsed');
    tcpu := SYSDIF('CPU used by this session');
    exe := SYSDIF('execute count');
    bs := GET_PARAM('db_block_size');
    bc := GET_PARAM('db_block_buffers') * bs;
    if bc = 0 then
    bc := GET_PARAM('db_cache_size')
    + GET_PARAM('db_keep_cache_size')
    + GET_PARAM('db_recycle_cache_size')
    + GET_PARAM('db_2k_cache_size')
    + GET_PARAM('db_4k_cache_size')
    + GET_PARAM('db_8k_cache_size')
    + GET_PARAM('db_16k_cache_size')
    + GET_PARAM('db_32k_cache_size');
    end if;
    sp := GET_PARAM('shared_pool_size');
    lb := GET_PARAM('log_buffer');
    twt := TOTAL_EVENT_TIME; -- total wait time for all non-idle events
    bspm := SGASTAT('total_shared_pool', bid);
    espm := SGASTAT('total_shared_pool', eid);
    bfrm := SGASTAT('free memory', bid);
    efrm := SGASTAT('free memory', eid);
    blog := GET_SYSSTAT('logons current', bid);
    elog := GET_SYSSTAT('logons current', eid);
    bocur := GET_SYSSTAT('opened cursors current', bid);
    eocur := GET_SYSSTAT('opened cursors current', eid);
    /* Do we want to report on cluster-specific statistics? Check
    in procedure variable "parallel".
    if parallel = 'YES' then
    dmsd := DLMDIF('messages sent directly');
    dmfc := DLMDIF('messages flow controlled');
    dmsi := DLMDIF('messages sent indirectly');
    dmrv := DLMDIF('messages received');
    dfcms := DLMDIF('flow control messages sent');
    dfcmr := DLMDIF('flow control messages received');
    dynal := DLMDIF('dynamically allocated enqueues');
    dynares := DLMDIF('dynamically allocated resources');
    pmrv := DLMDIF('gcs msgs received');
    pmpt := DLMDIF('gcs msgs process time(ms)');
    npmrv := DLMDIF('ges msgs received');
    npmpt := DLMDIF('ges msgs process time(ms)');
    scma := DLMDIF('gcs side channel msgs actual');
    scml := DLMDIF('gcs side channel msgs logical');
    pinc := DLMDIF('gcs immediate (null) converts');
    picrnc := DLMDIF('gcs immediate cr (null) converts');
    picc := DLMDIF('gcs immediate (compatible) converts');
    picrcc := DLMDIF('gcs immediate cr (compatible) converts');
    pbc := DLMDIF('gcs blocked converts');
    pbcrc := DLMDIF('gcs blocked cr converts');
    pcba := DLMDIF('gcs compatible basts');
    pccrba := DLMDIF('gcs compatible cr basts');
    pcrbpi := DLMDIF('gcs cr basts to PIs');
    dynapres := DLMDIF('dynamically allocated gcs resources');
    dynapshl := DLMDIF('dynamically allocated gcs shadows');
    prcma := DLMDIF('gcs recovery claim msgs actual');
    prcml := DLMDIF('gcs recovery claim msgs logical');
    pwrm := DLMDIF('gcs write request msgs');
    pfpim := DLMDIF('gcs flush pi msgs');
    pwnm := DLMDIF('gcs write notification msgs');
    dpms := SYSDIF('gcs messages sent');
    dnpms := SYSDIF('ges messages sent');
    glsg := SYSDIF('global lock sync gets');
    glag := SYSDIF('global lock async gets');
    glgt := SYSDIF('global lock get time');
    glsc := SYSDIF('global lock sync converts');
    glac := SYSDIF('global lock async converts');
    glct := SYSDIF('global lock convert time');
    glrl := SYSDIF('global lock releases');
    gcge := SYSDIF('global cache gets');
    gcgt := SYSDIF('global cache get time');
    gccv := SYSDIF('global cache converts');
    gcct := SYSDIF('global cache convert time');
    gccrrv := SYSDIF('global cache cr blocks received');
    gccrrt := SYSDIF('global cache cr block receive time');
    gccurv := SYSDIF('global cache current blocks received');
    gccurt := SYSDIF('global cache current block receive time');
    gccrsv := SYSDIF('global cache cr blocks served');
    gccrbt := SYSDIF('global cache cr block build time');
    gccrft := SYSDIF('global cache cr block flush time');
    gccrst := SYSDIF('global cache cr block send time');
    gccusv := SYSDIF('global cache current blocks served');
    gccupt := SYSDIF('global cache current block pin time');
    gccuft := SYSDIF('global cache current block flush time');
    gccust := SYSDIF('global cache current block send time');
    end if;
    /* Determine if we want to report on session-specific statistics.
    Check that the session is the same one for both snapshots.
    select session_id
    , serial#
    into l_b_session_id
    , l_b_serial#
    from stats$snapshot
    where snap_id = bid
    and dbid = db_ident
    and instance_number = inst_num;
    select session_id
    , serial#
    into l_e_session_id
    , l_e_serial#
    from stats$snapshot
    where snap_id = eid
    and dbid = db_ident
    and instance_number = inst_num;
    if ( (l_b_session_id = l_e_session_id)
    and (l_b_serial# = l_e_serial#)
    and (l_b_session_id != 0) ) then
    /* we have a valid comparison - it is the
    same session - get number of tx performed
    by this session */
    strn := SESDIF('user rollbacks') + SESDIF('user commits');
    if strn = 0 then
    /* No new transactions */
    strn := 1;
    end if;
    else
    /* No valid comparison can be made */
    strn :=1;
    end if;
    end STAT_CHANGES;
    function SNAP
    (i_snap_level in number default null
    ,i_session_id in number default null
    ,i_ucomment in varchar2 default null
    ,i_num_sql in number default null
    ,i_executions_th in number default null
    ,i_parse_calls_th in number default null
    ,i_disk_reads_th in number default null
    ,i_buffer_gets_th in number default null
    ,i_sharable_mem_th in number default null
    ,i_version_count_th in number default null
    ,i_all_init in varchar2 default null
    ,i_pin_statspack in varchar2 default null
    ,i_modify_parameter in varchar2 default 'FALSE'
    RETURN integer IS
    /* This function performs a snapshot of the v$ views into the
    stats$ tables, and returns the snapshot id.
    If parameters are passed, these are the values used, otherwise
    the values stored in the stats$statspack_parameter table are used.
    l_snap_id integer;
    l_snap_level number;
    l_session_id number;
    l_serial# number;
    l_ucomment varchar2(160);
    l_num_sql number;
    l_executions_th number;
    l_parse_calls_th number;
    l_disk_reads_th number;
    l_buffer_gets_th number;
    l_sharable_mem_th number;
    l_version_count_th number;
    l_all_init varchar2(5);
    l_pin_statspack varchar2(10);
    l_sql_stmt varchar2(3000);
    l_slarti varchar2(20);
    l_threshold number;
    l_total_sql number := 0;
    l_total_sql_mem number := 0;
    l_single_use_sql number := 0;
    l_single_use_sql_mem number := 0;
    l_text_subset varchar2(31);
    l_sharable_mem number;
    l_version_count number;
    l_sorts number;
    l_module varchar2(64);
    l_loaded_versions number;
    l_executions number;
    l_loads number;
    l_invalidations number;
    l_parse_calls number;
    l_disk_reads number;
    l_buffer_gets number;
    l_rows_processed number;
    l_address raw(8);
    l_hash_value number;
    l_version_count number;
    l_max_begin_time date;
    cursor GETSERIAL is
    select serial#
    from v$session
    where sid = l_session_id;
    PROCEDURE snap_sql IS
    begin
    /* Gather summary statistics */
    insert into stats$sql_statistics
    ( snap_id
    , dbid
    , instance_number
    , total_sql
    , total_sql_mem
    , single_use_sql
    , single_use_sql_mem
    select l_snap_id
    , p_dbid
    , p_instance_number
    , count(1)
    , sum(sharable_mem)
    , sum(decode(executions, 1, 1, 0))
    , sum(decode(executions, 1, sharable_mem, 0))
    from stats$v$sqlxs
    where is_obsolete = 'N';
    /* Gather SQL statements which exceed any threshold,
    excluding obsolete parent cursors
    insert into stats$sql_summary
    ( snap_id
    , dbid
    , instance_number
    , text_subset
    , sharable_mem
    , sorts
    , module
    , loaded_versions
    , executions
    , loads
    , invalidations
    , parse_calls
    , disk_reads
    , buffer_gets
    , rows_processed
    , command_type
    , address
    , hash_value
    , version_count
    , cpu_time
    , elapsed_time
    , outline_sid
    , outline_category
    select l_snap_id
    , p_dbid
    , p_instance_number
    , substr(sql_text,1,31)
    , sharable_mem
    , sorts
    , module
    , loaded_versions
    , executions
    , loads
    , invalidations
    , parse_calls
    , disk_reads
    , buffer_gets
    , rows_processed
    , command_type
    , address
    , hash_value
    , version_count
    , cpu_time
    , elapsed_time
    , outline_sid
    , outline_category
    from stats$v$sqlxs
    where is_obsolete = 'N'
    and ( buffer_gets > l_buffer_gets_th
    or disk_reads > l_disk_reads_th
    or parse_calls > l_parse_calls_th
    or executions > l_executions_th
    or sharable_mem > l_sharable_mem_th
    or version_count > l_version_count_th
    /* Insert the SQL Text for hash_values captured in the snapshot
    into stats$sqltext if it's not already there. Identify SQL which
    execeeded the threshold by querying stats$sql_summary for this
    snapid and database instance
    insert into stats$sqltext
    ( hash_value
    , text_subset
    , piece
    , sql_text
    , address
    , command_type
    , last_snap_id
    select st1.hash_value
    , ss.text_subset
    , st1.piece
    , st1.sql_text
    , st1.address
    , st1.command_type
    , ss.snap_id
    from v$sqltext st1
    , stats$sql_summary ss
    where ss.snap_id = l_snap_id
    and ss.dbid = p_dbid
    and ss.instance_number = p_instance_number
    and st1.hash_value = ss.hash_value
    and st1.address = ss.address
    and not exists (select 1
    from stats$sqltext st2
    where st2.hash_value = ss.hash_value
    and st2.text_subset = ss.text_subset
    IF l_snap_level >= 6 THEN
    /* Identify SQL which execeeded the threshold by querying
    stats$sql_summary for this snapid and database instance.
    Capture the plans which were used for the high-load SQL if
    don't already have this data.
    Omit capturing plan usage information for cursors which
    have a zero plan hash value.
    Currently this is captured in a level 6 (or greater)
    snapshot, however this may be integrated into level 5
    snapshot at a later date.
    hl - high load
    insert into stats$sql_plan_usage
    ( hash_value
    , text_subset
    , plan_hash_value
    , cost
    , snap_id
    , address
    , optimizer
    select hl.hash_value
    , hl.text_subset
    , hl.plan_hash_value
    , hl.cost
    , max(hl.snap_id)
    , max(hl.address)
    , max(hl.optimizer)
    from (select /*+ ordered use_nl(sq) index(sq) */
    ss.hash_value
    , ss.text_subset
    , sq.plan_hash_value
    , nvl(sq.optimizer_cost,-9) cost
    , ss.snap_id snap_id
    , ss.address
    , sq.optimizer_mode optimizer
    from stats$sql_summary ss
    , v$sql sq
    where ss.snap_id = l_snap_id
    and ss.dbid = p_dbid
    and ss.instance_number = p_instance_number
    and sq.hash_value = ss.hash_value
    and sq.address = ss.address
    and sq.plan_hash_value > 0
    ) hl
    where not exists (select /*+ no_unnest */
    from stats$sql_plan_usage spu
    where spu.hash_value = hl.hash_value
    and spu.text_subset = hl.text_subset
    and spu.plan_hash_value
    = hl.plan_hash_value
    and spu.cost = hl.cost
    group by hl.hash_value
    , hl.text_subset
    , hl.plan_hash_value
    , hl.cost
    , hl.optimizer;
    /* For all new hash_value, plan_hash_value, cost combinations
    just captured, get the optimizer plans, if we don't already
    have them. Note that the plan (and hence the plan hash value)
    comprises the access path and the join order (and not
    variable factors such as the cardinality).
    insert into stats$sql_plan
    ( plan_hash_value
    , id
    , operation
    , options
    , object_node
    , object#
    , object_owner
    , object_name
    , optimizer
    , parent_id
    , depth
    , position
    , cost
    , cardinality
    , bytes
    , other_tag
    , partition_start
    , partition_stop
    , partition_id
    , other
    , distribution
    , cpu_cost
    , io_cost
    , temp_space
    , snap_id
    select /*+ ordered use_nl(s) use_nl(sp.p) */
    new_plan.plan_hash_value
    , sp.id
    , max(sp.operation)
    , max(sp.options)
    , max(sp.object_node)
    , max(sp.object#)
    , max(sp.object_owner)
    , max(sp.object_name)
    , max(sp.optimizer)
    , max(sp.parent_id)
    , max(sp.depth)
    , max(sp.position)
    , max(sp.cost)
    , max(sp.cardinality)
    , max(sp.bytes)
    , max(sp.other_tag)
    , max(sp.partition_start)
    , max(sp.partition_stop)
    , max(sp.partition_id)
    , max(sp.other)
    , max(sp.distribution)
    , max(sp.cpu_cost)
    , max(sp.io_cost)
    , max(sp.temp_space)
    , max(new_plan.snap_id)
    from (select /*+ index(spu) */
    distinct
    spu.plan_hash_value
    , spu.hash_value
    , spu.address
    , spu.text_subset
    , spu.snap_id
    from stats$sql_plan_usage spu
    where spu.snap_id = l_snap_id
    and not exists (select /*+ nl_aj */ *
    from stats$sql_plan ssp
    where ssp.plan_hash_value
    = spu.plan_hash_value
    ) new_plan
    , v$sql s
    , v$sql_plan sp
    where sp.hash_value = new_plan.hash_value
    and sp.address = new_plan.address
    and s.hash_value = new_plan.hash_value
    and s.address = new_plan.address
    and s.hash_value = sp.hash_value
    and s.address = sp.address
    and s.child_number = sp.child_number
    group by
    new_plan.plan_hash_value
    , sp.id;
    END IF; /* snap level >=6 */
    END snap_sql;
    begin /* Function SNAP */
    /* Get instance parameter defaults from stats$statspack_parameter,
    or use supplied parameters.
    If all parameters are specified, use them, otherwise get values
    from the parameters not specified from stats$statspack_parameter.
    statspack.qam_statspack_parameter
    ( p_dbid
    , p_instance_number
    , i_snap_level, i_session_id, i_ucomment, i_num_sql
    , i_executions_th, i_parse_calls_th
    , i_disk_reads_th, i_buffer_gets_th, i_sharable_mem_th
    , i_version_count_th, i_all_init
    , i_pin_statspack
    , i_modify_parameter
    , l_snap_level, l_session_id, l_ucomment, l_num_sql
    , l_executions_th, l_parse_calls_th
    , l_disk_reads_th, l_buffer_gets_th, l_sharable_mem_th
    , l_version_count_th, l_all_init
    , l_pin_statspack);
    /* Generate a snapshot id */
    select stats$snapshot_id.nextval
    into l_snap_id
    from dual
    where rownum = 1;
    /* Determine the serial# of the session to maintain stats for,
    if this was requested.
    if l_session_id > 0 then
    if not GETSERIAL%ISOPEN then open GETSERIAL; end if;
    fetch GETSERIAL into l_serial#;
    if GETSERIAL%NOTFOUND then
    /* Session has already disappeared - don't gather
    statistics for this session in this snapshot */
    l_session_id := 0;
    l_serial# := 0;
    end if; close GETSERIAL;
    else
    l_serial# := 0;
    end if;
    /* The instance has been restarted since the last snapshot */
    if p_new_sga = 0
    then
    begin
    p_new_sga := 1;
    /* Get the instance startup time, and other characteristics */
    insert into stats$database_instance
    ( dbid
    , instance_number
    , startup_time
    , snap_id
    , parallel
    , version
    , db_name
    , instance_name
    , host_name
    select p_dbid
    , p_instance_number
    , p_startup_time
    , l_snap_id
    , p_parallel
    , p_version
    , p_name
    , p_instance_name
    , p_host_name
    from sys.dual;
    commit;
    end;
    end if; /* new SGA */
    /* Work out the max undo stat time, used for gathering undo stat data */
    select nvl(max(begin_time), to_date('01011900','DDMMYYYY'))
    into l_max_begin_time
    from stats$undostat
    where dbid = p_dbid
    and instance_number = p_instance_number;
    /* Save the snapshot characteristics */
    insert into stats$snapshot
    ( snap_id, dbid, instance_number
    , snap_time, startup_time
    , session_id, snap_level, ucomment
    , executions_th, parse_calls_th, disk_reads_th
    , buffer_gets_th, sharable_mem_th
    , version_count_th, serial#, all_init)
    values
    ( l_snap_id, p_dbid, p_instance_number
    , SYSDATE, p_startup_time
    , l_session_id, l_snap_level, l_ucomment
    , l_executions_th, l_parse_calls_th, l_disk_reads_th
    , l_buffer_gets_th, l_sharable_mem_th
    , l_version_count_th, l_serial#, l_all_init);
    /* Begin gathering statistics */
    insert into stats$filestatxs
    ( snap_id
    , dbid
    , instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    from stats$v$filestatxs;
    insert into stats$tempstatxs
    ( snap_id
    , dbid
    , instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , tsname
    , filename
    , phyrds
    , phywrts
    , singleblkrds
    , readtim
    , writetim
    , singleblkrdtim
    , phyblkrd
    , phyblkwrt
    , wait_count
    , time
    from stats$v$tempstatxs;
    insert into stats$librarycache
    ( snap_id
    , dbid
    , instance_number
    , namespace
    , gets
    , gethits
    , pins
    , pinhits
    , reloads
    , invalidations
    , dlm_lock_requests
    , dlm_pin_requests
    , dlm_pin_releases
    , dlm_invalidation_requests
    , dlm_invalidations
    select l_snap_id
    , p_dbid
    , p_instance_number
    , namespace
    , gets
    , gethits
    , pins
    , pinhits
    , reloads
    , invalidations
    , dlm_lock_requests
    , dlm_pin_requests
    , dlm_pin_releases
    , dlm_invalidation_requests
    , dlm_invalidations
    from v$librarycache;
    insert into stats$buffer_pool_statistics
    ( snap_id
    , dbid
    , instance_number
    , id
    , name
    , block_size
    , set_msize
    , cnum_repl
    , cnum_write
    , cnum_set
    , buf_got
    , sum_write
    , sum_scan
    , free_buffer_wait
    , write_complete_wait
    , buffer_busy_wait
    , free_buffer_inspected
    , dirty_buffers_inspected
    , db_block_change
    , db_block_gets
    , consistent_gets
    , physical_reads
    , physical_writes
    select l_snap_id
    , p_dbid
    , p_instance_number
    , id
    , name
    , block_size
    , set_msize
    , cnum_repl
    , cnum_write
    , cnum_set
    , buf_got
    , sum_write
    , sum_scan
    , free_buffer_wait
    , write_complete_wait
    , buffer_busy_wait
    , free_buffer_inspected
    , dirty_buffers_inspected
    , db_block_change
    , db_block_gets
    , consistent_gets
    , physical_reads
    , physical_writes
    from v$buffer_pool_statistics;
    insert into stats$rollstat
    ( snap_id
    , dbid
    , instance_number
    , usn
    , extents
    , rssize
    , writes
    , xacts
    , gets
    , waits
    , optsize
    , hwmsize
    , shrinks
    , wraps
    , extends
    , aveshrink
    , aveactive
    select l_snap_id
    , p_dbid
    , p_instance_number
    , usn
    , extents
    , rssize
    , writes
    , xacts
    , gets
    , waits
    , optsize
    , hwmsize
    , shrinks
    , wraps
    , extends
    , aveshrink
    , aveactive
    from v$rollstat;
    insert into stats$rowcache_summary
    ( snap_id
    , dbid
    , instance_number
    , parameter
    , total_usage
    , usage
    , gets
    , getmisses
    , scans
    , scanmisses
    , scancompletes
    , modifications
    , flushes
    , dlm_requests
    , dlm_conflicts
    , dlm_releases
    select l_snap_id
    , p_dbid
    , p_instance_number
    , parameter
    , sum("COUNT")
    , sum(usage)
    , sum(gets)
    , sum(getmisses)
    , sum(scans)
    , sum(scanmisses)
    , sum(scancompletes)
    , sum(modifications)
    , sum(flushes)
    , sum(dlm_requests)
    , sum(dlm_conflicts)
    , sum(dlm_releases)
    from v$rowcache
    group by l_snap_id, p_dbid, p_instance_number, parameter;
    /* Collect parameters every snapshot, to cater for dynamic
    parameters changable while instance is running
    if l_all_init = 'FALSE' then
    insert into stats$parameter
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    , isdefault
    , ismodified
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , value
    , isdefault
    , ismodified
    from v$system_parameter;
    else
    insert into stats$parameter
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    , isdefault
    , ismodified
    select l_snap_id
    , p_dbid
    , p_instance_number
    , i.ksppinm
    , sv.ksppstvl
    , sv.ksppstdf
    , decode(bitand(sv.ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE')
    from stats$x$ksppi i
    , stats$x$ksppsv sv
    where i.indx = sv.indx;
    end if;
    /* To cater for variable size SGA - insert on each snapshot */
    insert into stats$sga
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , value
    from v$sga;
    /* Get current allocation of memory in the SGA */
    insert into stats$sgastat
    ( snap_id
    , dbid
    , instance_number
    , pool
    , name
    , bytes
    select l_snap_id
    , p_dbid
    , p_instance_number
    , pool
    , name
    , bytes
    from v$sgastat;
    insert into stats$system_event
    ( snap_id
    , dbid
    , instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    select l_snap_id
    , p_dbid
    , p_instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    from v$system_event;
    insert into stats$bg_event_summary
    ( snap_id
    , dbid
    , instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    select l_snap_id
    , p_dbid
    , p_instance_number
    , e.event
    , sum(e.total_waits)
    , sum(e.total_timeouts)
    , sum(e.time_waited_micro)
    from v$session_event e
    where e.sid in (select s.sid from v$session s where s.type = 'BACKGROUND')
    group by l_snap_id, p_dbid, p_instance_number, e.event;
    insert into stats$sysstat
    ( snap_id
    , dbid
    , instance_number
    , statistic#
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , statistic#
    , name
    , value
    from v$sysstat;
    insert into stats$waitstat
    ( snap_id
    , dbid
    , instance_number
    , class
    , wait_count
    , time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , class
    , "COUNT"
    , time
    from v$waitstat;
    insert into stats$enqueue_stat
    ( snap_id
    , dbid
    , instance_number
    , eq_type
    , total_req#
    , total_wait#
    , succ_req#
    , failed_req#
    , cum_wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , eq_type
    , total_req#
    , total_wait#
    , succ_req#
    , failed_req#
    , cum_wait_time
    from v$enqueue_stat
    where total_req# != 0;
    insert into stats$latch
    ( snap_id
    , dbid
    , instance_number
    , name
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    from v$latch;
    insert into stats$latch_misses_summary
    ( snap_id
    , dbid
    , instance_number
    , parent_name
    , where_in_code
    , nwfail_count
    , sleep_count
    , wtr_slp_count
    select l_snap_id
    , p_dbid
    , p_instance_number
    , parent_name
    , "WHERE"
    , sum(nwfail_count)
    , sum(sleep_count)
    , sum(wtr_slp_count)
    from v$latch_misses
    where sleep_count > 0
    group by l_snap_id, p_dbid, p_instance_number
    , parent_name, "WHERE";
    insert into stats$resource_limit
    ( snap_id
    , dbid
    , instance_number
    , resource_name
    , current_utilization
    , max_utilization
    , initial_allocation
    , limit_value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , resource_name
    , current_utilization
    , max_utilization
    , initial_allocation
    , limit_value
    from v$resource_limit
    where limit_value != ' UNLIMITED'
    and max_utilization > 0;
    insert into stats$undostat
    ( begin_time
    , end_time
    , dbid
    , instance_number
    , snap_id
    , undotsn
    , undoblks
    , txncount
    , maxquerylen
    , maxconcurrency
    , unxpstealcnt
    , unxpblkrelcnt
    , unxpblkreucnt
    , expstealcnt
    , expblkrelcnt
    , expblkreucnt
    , ssolderrcnt
    , nospaceerrcnt
    select begin_time
    , end_time
    , p_dbid
    , p_instance_number
    , l_snap_id
    , undotsn
    , undoblks
    , txncount
    , maxquerylen
    , maxconcurrency
    , unxpstealcnt
    , unxpblkrelcnt
    , unxpblkreucnt
    , expstealcnt
    , expblkrelcnt
    , expblkreucnt
    , ssolderrcnt
    , nospaceerrcnt
    from v$undostat
    where begin_time > l_max_begin_time
    and begin_time + (1/(24*6)) <= end_time;
    insert into stats$db_cache_advice
    ( snap_id
    , dbid
    , instance_number
    , id
    , name
    , block_size
    , buffers_for_estimate
    , advice_status
    , size_for_estimate
    , estd_physical_read_factor
    , estd_physical_reads
    select l_snap_id
    , p_dbid
    , p_instance_number
    , id
    , name
    , block_size
    , buffers_for_estimate
    , advice_status
    , size_for_estimate
    , estd_physical_read_factor
    , estd_physical_reads
    from v$db_cache_advice
    where advice_status = 'ON';
    insert into stats$pgastat
    ( snap_id
    , dbid
    , instance_number
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , name
    , value
    from v$pgastat;
    insert into stats$instance_recovery
    ( snap_id
    , dbid
    , instance_number
    , recovery_estimated_ios
    , actual_redo_blks
    , target_redo_blks
    , log_file_size_redo_blks
    , log_chkpt_timeout_redo_blks
    , log_chkpt_interval_redo_blks
    , fast_start_io_target_redo_blks
    , target_mttr
    , estimated_mttr
    , ckpt_block_writes
    select l_snap_id
    , p_dbid
    , p_instance_number
    , recovery_estimated_ios
    , actual_redo_blks
    , target_redo_blks
    , log_file_size_redo_blks
    , log_chkpt_timeout_redo_blks
    , log_chkpt_interval_redo_blks
    , fast_start_io_target_redo_blks
    , target_mttr
    , estimated_mttr
    , ckpt_block_writes
    from v$instance_recovery;
    if p_parallel = 'YES' then
    insert into stats$dlm_misc
    ( snap_id
    , dbid
    , instance_number
    , statistic#
    , name
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , statistic#
    , name
    , value
    from v$dlm_misc;
    end if; /* parallel */
    /* Begin gathering Extended Statistics */
    IF l_snap_level >= 5 THEN
    snap_sql;
    END IF; /* snap level >=5 */
    IF l_snap_level >= 10 THEN
    insert into stats$latch_children
    ( snap_id
    , dbid
    , instance_number
    , latch#
    , child#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , latch#
    , child#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    from v$latch_children;
    insert into stats$latch_parent
    ( snap_id
    , dbid
    , instance_number
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    select l_snap_id
    , p_dbid
    , p_instance_number
    , latch#
    , level#
    , gets
    , misses
    , sleeps
    , immediate_gets
    , immediate_misses
    , spin_gets
    , sleep1
    , sleep2
    , sleep3
    , sleep4
    , wait_time
    from v$latch_parent;
    END IF; /* snap level >=10 */
    /* Record level session-granular statistics if a specific session
    has been requested
    if l_session_id > 0
    then
    insert into stats$sesstat
    ( snap_id
    , dbid
    , instance_number
    , statistic#
    , value
    select l_snap_id
    , p_dbid
    , p_instance_number
    , statistic#
    , value
    from v$sesstat
    where sid = l_session_id;
    insert into stats$session_event
    ( snap_id
    , dbid
    , instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    , max_wait
    select l_snap_id
    , p_dbid
    , p_instance_number
    , event
    , total_waits
    , total_timeouts
    , time_waited_micro
    , max_wait
    from v$session_event
    where sid = l_session_id;
    end if;
    commit work;
    RETURN l_snap_id;
    end SNAP; /* Function SNAP */
    begin /* STATSPACK body */
    /* Query the database id, instance_number, database name, instance
    name and startup time for the instance we are working on
    /* Get information about the current instance */
    open get_instance;
    fetch get_instance into
    p_instance_number, p_instance_name
    , p_startup_time, p_parallel, p_version
    , p_host_name;
    close get_instance;
    /* Select the database info for the db connected to */
    open get_db;
    fetch get_db into p_dbid, p_name;
    close get_db;
    /* Keep the package
    sys.dbms_shared_pool.keep('PERFSTAT.STATSPACK', 'P');
    /* Determine if the instance has been restarted since the previous snapshot
    begin
    select 1
    into p_new_sga
    from stats$database_instance
    where startup_time = p_startup_time
    and dbid = p_dbid
    and instance_number = p_instance_number;
    exception
    when NO_DATA_FOUND then
    p_new_sga := 0;
    end;
    end STATSPACK;
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY STATSPACK:
    LINE/COL ERROR
    2045/3 PLS-00201: identifier 'SYS.DBMS_SHARED_POOL' must be declared
    2045/3 PL/SQL: Statement ignored

    When i compiled the package, it compiled with following error.
    Warning: Package Body created with compilation errors.
    SQL> show error
    Errors for PACKAGE BODY STATSPACK:
    LINE/COL ERROR
    2045/3 PLS-00201: identifier 'SYS.DBMS_SHARED_POOL' must be declared
    2045/3 PL/SQL: Statement ignored
    SQL>

  • ORA 04030 Out of process memory error

    Dear experts,
    I know there are multiple discussions around this error and I have been reading through most of them in the past one week or so, but looks like we are running out of options or are missing the color altogether. Ok, we are getting ORA-04030 - out of process memory while allocating....while one of our batch process runs in the night. It simply tries to insert/update to a table. Our installation is 11.2.0.1.0 with no RAC configuration and on 64-bit AIX having 6 cores, 12 CPUs and 16 GB memory.
    We have checked the Workarea_Size_Policy is set to be as Auto so Oracle decides how much memory to allocate to PGA automatically on run-time based on the demand. And based on the AWR report it doesnt look like we are anywhere near the country having a PGA-deficit!! I am attaching the AWR report in a word document here for your reference.
    Also attached below are the configurations and the ulimit values.
    IKBTRN1> show parameter workarea;
    NAME                                 TYPE                             VALUE
    workarea_size_policy                 string                           AUTO
    oraipeikbtrn1:/home/oracle-> ulimit -a
    time(seconds)        unlimited
    file(blocks)         unlimited
    data(kbytes)         unlimited
    stack(kbytes)        4194304
    memory(kbytes)       unlimited
    coredump(blocks)     unlimited
    nofiles(descriptors) unlimited
    threads(per process) unlimited
    processes(per user)  unlimited
    Now, nothing seems to have contributed to the out of process memory issue from Oracle standpoint. I would be happy to be proved wrong here, if I am wrong.
    So, whats going wrong here? A possible memory leak which we cannot zero down to, a OS memory limit or something else?
    Seeking expert's advise on this, and also sincerely appreciate your time in looking at this.
    Thanks.
    P.S - I am pasting the whole AWR report since there is no 'upload file' option here that I can see.
    WORKLOAD REPOSITORY report for
    DB Name     DB Id     Instance     Inst num     Startup Time     Release     RAC
    IKBTRN1     54659199     IKBTRN1     1     06-Jun-11 02:06     11.2.0.1.0     NO
    Host Name     Platform     CPUs     Cores     Sockets     Memory (GB)
    oraipeikbtrn1.******.com     AIX-Based Systems (64-bit)     12     6          16.00
         Snap Id     Snap Time     Sessions     Cursors/Session
    Begin Snap:     5952     26-Aug-11 03:00:48     34     2.0
    End Snap:     5953     26-Aug-11 04:00:52     32     1.9
    Elapsed:          60.07 (mins)          
    DB Time:          1.93 (mins)          
    Report Summary
    Cache Sizes
         Begin     End          
    Buffer Cache:     1,056M     704M     Std Block Size:     8K
    Shared Pool Size:     3,456M     3,456M     Log Buffer:     7,184K
    Load Profile
    Load Profile
         Per Second     Per Transaction     Per Exec     Per Call
    DB Time(s):     0.0     2.0     0.02     0.02
    DB CPU(s):     0.0     0.5     0.00     0.00
    Redo size:     556.1     34,554.8          
    Logical reads:     151.4     9,407.6          
    Block changes:     1.9     119.8          
    Physical reads:     14.2     882.6          
    Physical writes:     9.5     590.4          
    User calls:     1.8     112.8          
    Parses:     1.5     93.7          
    Hard parses:     0.1     8.9          
    W/A MB processed:     -0.1     -6.9          
    Logons:     0.0     1.6          
    Executes:     1.9     115.4          
    Rollbacks:     0.0     0.0          
    Transactions:     0.0               
    Instance Efficiency Percentages (Target 100%)
    Buffer Nowait %:     100.00     Redo NoWait %:     100.00
    Buffer Hit %:     96.63     In-memory Sort %:     99.97
    Library Hit %:     95.68     Soft Parse %:     90.49
    Execute to Parse %:     18.74     Latch Hit %:     100.00
    Parse CPU to Parse Elapsd %:     57.23     % Non-Parse CPU:     86.28
    Shared Pool Statistics
         Begin     End
    Memory Usage %:     85.72     85.76
    % SQL with executions>1:     93.91     96.66
    % Memory for SQL w/exec>1:     89.07     87.04
    Top 5 Timed Foreground Events
    Event     Waits     Time(s)     Avg wait (ms)     % DB time     Wait Class
    DB CPU          29          24.66     
    db file scattered read     3,456     17     5     14.92     User I/O
    db file sequential read     4,304     17     4     14.77     User I/O
    direct path read temp     764     17     22     14.31     User I/O
    direct path write temp     259     5     21     4.70     User I/O
    Host CPU (CPUs: 12 Cores: 6 Sockets: )
    Load Average Begin     Load Average End     %User     %System     %WIO     %Idle
    1.39     1.37     0.2     0.2     0.2     99.6
    Instance CPU
    %Total CPU     %Busy CPU     %DB time waiting for CPU (Resource Manager)
    0.1     20.5     0.0
    Memory Statistics
         Begin     End
    Host Mem (MB):     16,384.0     16,384.0
    SGA use (MB):     4,704.0     4,352.0
    PGA use (MB):     196.1     188.4
    % Host Mem used for SGA+PGA:     29.91     27.71
    Main Report
    •     Report Summary
    •     Wait Events Statistics
    •     SQL Statistics
    •     Instance Activity Statistics
    •     IO Stats
    •     Buffer Pool Statistics
    •     Advisory Statistics
    •     Wait Statistics
    •     Undo Statistics
    •     Latch Statistics
    •     Segment Statistics
    •     Dictionary Cache Statistics
    •     Library Cache Statistics
    •     Memory Statistics
    •     Streams Statistics
    •     Resource Limit Statistics
    •     Shared Server Statistics
    •     init.ora Parameters
    Back to Top
    Wait Events Statistics
    •     Time Model Statistics
    •     Operating System Statistics
    •     Operating System Statistics - Detail
    •     Foreground Wait Class
    •     Foreground Wait Events
    •     Background Wait Events
    •     Wait Event Histogram
    •     Wait Event Histogram Detail (64 msec to 2 sec)
    •     Wait Event Histogram Detail (4 sec to 2 min)
    •     Wait Event Histogram Detail (4 min to 1 hr)
    •     Service Statistics
    •     Service Wait Class Stats
    Back to Top
    Time Model Statistics
    •     Total time in database user-calls (DB Time): 115.9s
    •     Statistics including the word "background" measure background process time, and so do not contribute to the DB time statistic
    •     Ordered by % or DB time desc, Statistic name
    Statistic Name     Time (s)     % of DB Time
    sql execute elapsed time     101.69     87.75
    DB CPU     28.58     24.66
    parse time elapsed     10.14     8.75
    hard parse elapsed time     9.92     8.56
    failed parse elapsed time     4.92     4.25
    hard parse (sharing criteria) elapsed time     4.27     3.68
    connection management call elapsed time     0.42     0.36
    PL/SQL compilation elapsed time     0.34     0.30
    PL/SQL execution elapsed time     0.18     0.15
    sequence load elapsed time     0.00     0.00
    repeated bind elapsed time     0.00     0.00
    DB time     115.88     
    background elapsed time     86.01     
    background cpu time     5.06     
    Back to Wait Events Statistics
    Back to Top
    Operating System Statistics
    •     *TIME statistic values are diffed. All others display actual values. End Value is displayed if different
    •     ordered by statistic type (CPU Use, Virtual Memory, Hardware Config), Name
    Statistic     Value     End Value
    NUM_LCPUS     0     
    NUM_VCPUS     0     
    AVG_BUSY_TIME     1,260     
    AVG_IDLE_TIME     360,705     
    AVG_IOWAIT_TIME     534     
    AVG_SYS_TIME     483     
    AVG_USER_TIME     679     
    BUSY_TIME     16,405     
    IDLE_TIME     4,329,811     
    IOWAIT_TIME     7,284     
    SYS_TIME     7,092     
    USER_TIME     9,313     
    LOAD     1     1
    OS_CPU_WAIT_TIME     503,900     
    PHYSICAL_MEMORY_BYTES     17,179,869,184     
    NUM_CPUS     12     
    NUM_CPU_CORES     6     
    GLOBAL_RECEIVE_SIZE_MAX     1,310,720     
    GLOBAL_SEND_SIZE_MAX     1,310,720     
    TCP_RECEIVE_SIZE_DEFAULT     16,384     
    TCP_RECEIVE_SIZE_MAX     9,223,372,036,854,775,807     
    TCP_RECEIVE_SIZE_MIN     4,096     
    TCP_SEND_SIZE_DEFAULT     16,384     
    TCP_SEND_SIZE_MAX     9,223,372,036,854,775,807     
    TCP_SEND_SIZE_MIN     4,096     
    Back to Wait Events Statistics
    Back to Top
    Operating System Statistics - Detail
    Snap Time     Load     %busy     %user     %sys     %idle     %iowait
    26-Aug 03:00:48     1.39                         
    26-Aug 04:00:52     1.37     0.38     0.21     0.16     99.62     0.17
    Back to Wait Events Statistics
    Back to Top
    Foreground Wait Class
    •     s - second, ms - millisecond - 1000th of a second
    •     ordered by wait time desc, waits desc
    •     %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
    •     Captured Time accounts for 78.2% of Total DB time 115.88 (s)
    •     Total FG Wait Time: 62.08 (s) DB CPU time: 28.58 (s)
    Wait Class     Waits     %Time -outs     Total Wait Time (s)     Avg wait (ms)     %DB time
    User I/O     8,949     0     56     6     48.74
    DB CPU               29          24.66
    System I/O     1,916     0     3     1     2.18
    Other     506     88     1     2     0.92
    Configuration     2     50     1     500     0.86
    Commit     37     0     1     18     0.56
    Application     20     0     0     17     0.29
    Network     4,792     0     0     0     0.01
    Concurrency     1     0     0     0     0.00
    Back to Wait Events Statistics
    Back to Top
    Foreground Wait Events
    •     s - second, ms - millisecond - 1000th of a second
    •     Only events with Total Wait Time (s) >= .001 are shown
    •     ordered by wait time desc, waits desc (idle events last)
    •     %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
    Event     Waits     %Time -outs     Total Wait Time (s)     Avg wait (ms)     Waits /txn     % DB time
    db file scattered read     3,456     0     17     5     59.59     14.92
    db file sequential read     4,304     0     17     4     74.21     14.77
    direct path read temp     764     0     17     22     13.17     14.31
    direct path write temp     259     0     5     21     4.47     4.70
    control file sequential read     1,916     0     3     1     33.03     2.18
    ADR block file read     38     0     1     28     0.66     0.92
    log buffer space     2     50     1     500     0.03     0.86
    log file sync     37     0     1     18     0.64     0.56
    enq: RO - fast object reuse     14     0     0     24     0.24     0.29
    local write wait     44     0     0     1     0.76     0.03
    SQL*Net message to client     4,772     0     0     0     82.28     0.01
    Disk file operations I/O     110     0     0     0     1.90     0.00
    ADR block file write     7     0     0     0     0.12     0.00
    SQL*Net message from client     4,773     0     15,396     3226     82.29     
    Streams AQ: waiting for messages in the queue     720     100     3,600     5000     12.41     
    Back to Wait Events Statistics
    Back to Top
    Background Wait Events
    •     ordered by wait time desc, waits desc (idle events last)
    •     Only events with Total Wait Time (s) >= .001 are shown
    •     %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
    Event     Waits     %Time -outs     Total Wait Time (s)     Avg wait (ms)     Waits /txn     % bg time
    control file sequential read     4,950     0     35     7     85.34     40.74
    control file parallel write     1,262     0     31     25     21.76     36.46
    log file parallel write     383     0     4     10     6.60     4.37
    db file parallel write     627     0     2     3     10.81     2.36
    change tracking file synchronous read     56     0     2     34     0.97     2.21
    os thread startup     17     0     1     88     0.29     1.74
    ADR block file read     135     0     1     7     2.33     1.04
    change tracking file synchronous write     56     0     1     15     0.97     0.98
    SGA: allocation forcing component growth     8     100     1     100     0.14     0.93
    db file sequential read     112     0     1     6     1.93     0.75
    process diagnostic dump     94     0     0     1     1.62     0.09
    ADR block file write     92     0     0     1     1.59     0.07
    LGWR wait for redo copy     11     0     0     1     0.19     0.01
    log file sync     2     0     0     3     0.03     0.01
    ADR file lock     92     22     0     0     1.59     0.01
    Parameter File I/O     24     0     0     0     0.41     0.01
    direct path write     6     0     0     1     0.10     0.00
    Disk file operations I/O     54     0     0     0     0.93     0.00
    rdbms ipc message     17,637     97     61,836     3506     304.09     
    Streams AQ: waiting for time management or cleanup tasks     5     60     11,053     2210602     0.09     
    DIAG idle wait     7,203     100     7,203     1000     124.19     
    PX Idle Wait     1,802     100     3,604     2000     31.07     
    pmon timer     1,212     99     3,603     2973     20.90     
    Space Manager: slave idle wait     726     99     3,603     4963     12.52     
    smon timer     12     100     3,600     300004     0.21     
    Streams AQ: qmn slave idle wait     128     0     3,583     27993     2.21     
    Streams AQ: qmn coordinator idle wait     256     50     3,583     13996     4.41     
    SQL*Net message from client     293     0     2     5     5.05     
    Back to Wait Events Statistics
    Back to Top
    Wait Event Histogram
    •     Units for Total Waits column: K is 1000, M is 1000000, G is 1000000000
    •     % of Waits: value of .0 indicates value was <.05%; value of null is truly 0
    •     % of Waits: column heading of <=1s is truly <1024ms, >1s is truly >=1024ms
    •     Ordered by Event (idle events last)
              % of Waits
    Event     Total Waits     <1ms     <2ms     <4ms     <8ms     <16ms     <32ms     <=1s     >1s
    ADR block file read     173     80.3     5.2     2.3     5.8     1.7          4.6     
    ADR block file write     99     96.0     3.0                    1.0          
    ADR file lock     102     100.0                                   
    Disk file operations I/O     165     100.0                                   
    LGWR wait for redo copy     11     90.9               9.1                    
    Parameter File I/O     24     100.0                                   
    SGA: allocation forcing component growth     8                                   100.0     
    SQL*Net break/reset to client     6     100.0                                   
    SQL*Net message to client     4992     100.0                                   
    SQL*Net more data from client     20     100.0                                   
    asynch descriptor resize     541     100.0                                   
    change tracking file synchronous read     56     83.9                         1.8     14.3     
    change tracking file synchronous write     56     80.4     7.1               1.8          10.7     
    control file parallel write     1262     80.3     1.7     .6     .6     .8     1.3     14.7     
    control file sequential read     6866     94.1     .9     .7     .7     .3     .4     2.9     
    db file parallel write     628     94.3     2.1     1.0     .8     .3     .3     1.3     
    db file scattered read     3457     72.6     7.2     5.4     6.9     5.7     .5     1.6     
    db file sequential read     4525     78.7     2.7     1.8     9.6     5.3     .4     1.5     
    direct path read temp     764     40.2     18.6     9.4     6.2     11.0     5.8     8.9     
    direct path sync     1     100.0                                   
    direct path write     6     83.3     16.7                              
    direct path write temp     259     .4          1.2     88.8          .4     9.3     
    enq: RO - fast object reuse     14     42.9     42.9          7.1               7.1     
    latch free     1     100.0                                   
    latch: cache buffers lru chain     2     100.0                                   
    latch: checkpoint queue latch     2     100.0                                   
    latch: messages     2     100.0                                   
    latch: object queue header operation     2     100.0                                   
    latch: redo allocation     1     100.0                                   
    latch: row cache objects     1     100.0                                   
    local write wait     44     100.0                                   
    log buffer space     2     50.0                              50.0     
    log file parallel write     383     92.4     .8          1.0               5.7     
    log file sync     39     82.1     2.6          2.6               12.8     
    os thread startup     17                                   100.0     
    process diagnostic dump     94     34.0     63.8     2.1                         
    reliable message     7     100.0                                   
    utl_file I/O     12     100.0                                   
    DIAG idle wait     7204                                   100.0     
    PX Idle Wait     1802                                        100.0
    SQL*Net message from client     5067     87.1     6.6     1.0     .5     .5     .1     .5     3.7
    Space Manager: slave idle wait     726     .6                                   99.4
    Streams AQ: qmn coordinator idle wait     256     49.2     .8                              50.0
    Streams AQ: qmn slave idle wait     128                                        100.0
    Streams AQ: waiting for messages in the queue     721                                        100.0
    Streams AQ: waiting for time management or cleanup tasks     5     40.0                              20.0     40.0
    class slave wait     17     100.0                                   
    pmon timer     1212     .9                                   99.1
    rdbms ipc message     17.6K     1.8     .4     .2     .2     .1     .1     21.0     76.2
    smon timer     12                                        100.0
    Back to Wait Events Statistics
    Back to Top
    I couldnt add the rest of the report here since it is telling me I have exceeded 30000 characters. If you want to see the full report, please email me at [email protected]

    Unless your database is strictly a DSS-type of database, your AWR report exposes loads of issues with it. And I think none of the time during the AWR window was spent on database. Look at the DB time (with all those multi cores) compared with the elapsed time of the AWR.
    As you are on 11g, why not make use of MEMORY_TARGET (a single parameter to manage both SGA and PGA)? If you are already on it, ignore this as I can't see it anywhere. If not, get rid of SGA_TARGET and PGA_AGGREGATE_TARGET and replace it with a single MEMORY_TARGET parameter. However you may have a minimum threshold set for different SGA pools so that they won't shrink beyond that point.
    Having said that, setting MEMORY_TARGET is not a guarantee to avoid ORA-4030. Just a single bad PL/SQL code could go and exploit the untunable part of your process memory and even go and blow up the physical memory. If you are using FORALL and BULK load, see if you can cut it down into few chunks rather than running as a single process.
    What does your V$PGASTAT say?

Maybe you are looking for

  • SUM from ALV grid

    Hey all, What i have to enable the sum button on the alv grid ... i guess from application bar....it is sign of sum... please give me option what i have to do.... points will be rewarded.....

  • Safari will not open for me. Keep quiting unexpectedly.

    I was on pinterest and clicked on a link that ended up closing out safari. Since then, I can't open Safari. It keeps saying Safari quits unexpectedly. I can't resolve the matter. Here's the error report: Process:           Safari [588] Path:         

  • Windows 7 and Palm Centro help needed please

    Can someone recommend an inexpensive blue tooth external adapter that is compatible with Windows 7, 64 bit so that I can sync my Palm Centro? Thank you. Post relates to: Centro (Verizon)

  • Maximize

    When I had a PC, there was a minimize/maximize button similar to the green one on my mac. When a window was maximized, it filled all of the screen except for the start bar. But with the min/max button on the mac, it just has two different sizes. Is i

  • Budgetory Control Issue

    Hello Dina I am trying to create a project specific purchase requisition (PR) from Oracle Purchasing responsibility with project details in distribution. At the end of process I put tick in the checkbox for reserve and then forward the same using app