Clearing SQL RAM utilistation.

Hi
I have an issue I am trying to resolve related to a number of SQL servers running on a vSphere platform. The issue is around our test platform in which we have a collection of SQL servers that are used occationally and fill up there designated max RAM configuration.
As an individual server this isn't really an issue. Its when I look at the Host RAM utilisation across the platform that I am trying to reduce. I would imagine there is a fare chance a decent chunk of this is locked up in SQL.
I know when SQL is restarted the RAM is cleared but I am after a way to do this on the fly without breaking connections from app servers etc. I also can't schedule a reboot or service restart as I cannot guarentee when the DB would be in use.
My plan was to schedule some sort of repeating task that would clear the RAM usage, once a week maybe that would bring the utilisation down a little bit. I have had a look around but cannot really fined anything.
Does anybody know of a method to do this? is it even possible without a service restart?
Thanks
Steve

SQL Server does not release RAM unless the OS issues a memory trim
because it is running low.
Just to clear a bit Windows OS never issues memory trim it just sets Low Memory Notification flag ON when there is Low notification. SQLOS has component QueryMemoryResourceNotification which monitors this flag. If it sees flag ON  SQLOS will respond
by sweeping its caches internally to reduce the process working set, and release memory back to Windows.
Again if OS feels a great memory pressure then memory allocated Via VirtualAlloc() function will be paged but if SQL Server service account has LPIM this cannot be paged out.
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP

Similar Messages

  • None of the changes I make to system preference or the dock will hold after restart. I've cleared the RAM, run disk repair and reinstalled the OS. Now what?

    None of the changes I make to system preference or the dock will hold after restart. I've cleared the RAM, run disk repair and reinstalled the OS. Now what?

    MobileMe closed on July 31, 2012.
    It is true that the only way to sync your Mac with iCloud is to upgrad.  You need to be running OS X Lion 10.7.2 or higher in order to sync your Mac with iCloud.  At this point, you can upgrade directly to OS X Mountain Lion from the version of OS X you are now running (10.6.8).   You can purchase and download the Mountain Lion upgrade from the Mac App Store for $19.99.  After upgrading you will see iCloud in System Preferences.  This guide explains how to sync your Mac with iCloud after upgrading: http://www.apple.com/icloud/setup/mac.html.
    Once all your devices are signed into the same iCloud account and you have turned on your iCloud data syncing, you will be able to keep them all in sync using iCloud.  You will still have to sync with iTunes to manage your iTunes media such as music, movies, podcasts, etc.  You will have the option to either continue backing up automatically with your computer when you sync with iTunes, or to back up your iOS devices automatically to iCloud every 24 hours (as long as they are connected to wifi and your chargers).

  • Do we have a command to clear sql command prompt

    do we have a command to clear sql command prompt ??

    I faced one issue, that would like to share with you guys.
    Oracle: 10gR2
    OS: Win XP / 2003 / 2000
    C:\Documents and Settings\mamohiuddin.MYPC>sqlplus "/as sysdba"
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 22 13:18:37 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to an idle instance.
    SQL> cl scr;
    C:\Documents and Settings\mamohiuddin.MYPC>
    Now a pop dialog box came and informed the following..
    Oracle SQL*PLUS has encountered a problem and needs to close. We are Sorry for the incovenience.
    Did you also face this issue ? If fixed how ? Is it Oracle problem or Windows Problem ?

  • JSP/Servlets functions: clear HTML tags, clear SQL code, validate E-mail

    Hello!
    I am looking for java functions, which:
    - clear HTML tags
    - clear SQL injection code
    - validate an e-mail address
    Probably there are java build-in functions for doing that.
    Maybe anyone could give me their names?
    I would be also grateful for any help, links or something.

    Hi,
    You could try using ,
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    instead of
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    -Amol

  • How do I clear up RAM on my Macbook Pro?

    I have been informed that clearing up my Activity Monitor on my Mac would help make my Mac run faster and work better. When I have nothing but the Activity Monitor open, this is what appears:
    I would like to delete/stop any that are not necessary for my computer. I do have a couple applications installed on my Mac that did not originally come on here, so I realize that I will need to keep those as well. Are there any that I can delete without causing my computer to crash or not work correctly?

    You are using pre-OS 10.9 RAM metrics to judge a computer running 10.10.
    Many people worry about this because they do not know that, starting with Mac OS10.9 Mavericks, Apple changed how the system uses RAM. The system will reserve all the free RAM it can and hold it for ready access, rapidily assigning it to new tasks coming online. It is a very fast and efficient system. It is now longer like how we judged RAM usage in the past. Adding RAM or "cleaning" RAM wont make much difference in the fact that "Memory Used" looks "funny" since the changes were implemented..
    The new metrics are "Memory Pressure" and "Swaps." Yours are fine--don't obsess over it. I have 12GB RAM in an iMac i7 and look how its RAM chart reads:
    I tripled the as-shipped RAM from 4GB to 12GB and the system still takes advantage of nearly all that. However, there are no swaps and the memory pressure is minimal. The computer runs very fast even with multiple apps open. There is not problem with your computer.

  • Azure SQL DB Basic Edition Preview: "Session Request Limit Reached" Stuck and Doesn't Clear - SQL DB Bug?

    Edit: I have updated the below to reflect that it took four hours for the database to unblock. This looks like a bug to me. SQL Server seemed to believe there were 30 running sessions with open requests nearly four hours after the client
    side connections were terminated (and thus in the process blocking SQL Server from accepting new connections).
    Problem
    I am running a preview "Basic" edition SQL DB and have hit a problem with Azure SQL DB blocking database access for an extended time period.
    I was running a test, which was running normally for several hours (loading small batches of data), then suddenly lots of connection timeouts (error type 1 below).  My workload was constant over the whole test - but if the server was suddenly under
    pressure, I accept this might happen - no problem with me so far. 
    Upon retrying, the errors then changed to request limit exceeded (error type 2 below).
    I am surprised I hit the limit in the first place, since the test code closes the SQL Connection on a timeout error and reopens.  (In C#, the code is wrapped in a using{} to ensure prompt connection closure).  Still, perhaps the amount of concurrent
    work on the server did momentarily hit this limit.  Perhaps fair enough on this point too.
    BUT:  Surprisingly, nearly four hours later, I was still unable to connect to the database - it was refusing new connections.  Either from my worker role or from the Azure Management Website.  The Management Window, upon trying to connect,
    failed with exactly the same text as error type 2 below.
    Further, sys.resource_stats (from the master db, which is still accessible) is reporting that there were 30 active sessions, 30 active workers (see extract below) for four afters after the test ended.  Even though during this time period the Azure Cloud
    Service that was generating the SQL requests was stopped too (so the client side of any open requests were long since dead).  Also,
    the CPU, Log Write and Phys Data Read columns in sys.resource_stats are all showing 0 for the four hours after the test ended.  This to me suggests a fault condition that isn't clearing server-side.
    Why was the database unavailable for four hours?  Why did Azure believe that there were 30 open requests? (each request was an insert of 1000 rows, each of 400 bytes, i.e. pretty small so no way should they take this long to process).
    PS.  To be clear, none of the above is a complaint.  I completely accept that the service in in preview, different SLA, etc.  I am writing to a) check that I haven't missed anything and b) if this is a bug, to report it.
    Appendix
    Error Type 1
    System.Data.SqlClient.SqlException:  Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
    Error Type 2
    SqlException: Resource ID : 1. The request limit for the database is 30 and has been reached. See 'http://go.microsoft.com/fwlink/?LinkId=267637' for assistance.
    Metrics
    The following is an extract from sys.resource_stats for the affected time period.  SQL Server seems to wrongly believe/report that there are 30 pending requests between 6:20 and 10:45.  It thus blocks any further requests during this time.  There
    were NO client connections during this time, either new or previously opened.
    start time
    end time
    sku
    session count
    worker count
    avg cpu
    avg phys data read
    avg log write
    07 Jun 11:15
    07 Jun 11:20
    Basic
      0
    0
    0
    0
    0
    07 Jun 10:50
    07 Jun 10:55
    Basic
      0
    0
    0.5
    0
    0
    07 Jun 10:40
    07 Jun 10:45
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 09:35
    07 Jun 09:40
    Basic
      30
    30
    0.02
    0
    0
    07 Jun 09:20
    07 Jun 09:25
    Basic
      30
    30
    0
    0
    0
    07 Jun 09:10
    07 Jun 09:15
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 08:40
    07 Jun 08:45
    Basic
      30
    30
    0
    0
    0
    07 Jun 08:20
    07 Jun 08:25
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 08:10
    07 Jun 08:15
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 07:55
    07 Jun 08:00
    Basic
      30
    30
    0
    0
    0
    07 Jun 07:25
    07 Jun 07:30
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 07:15
    07 Jun 07:20
    Basic
      30
    30
    0
    0
    0
    07 Jun 07:05
    07 Jun 07:10
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 06:55
    07 Jun 07:00
    Basic
      30
    30
    0
    0
    0
    07 Jun 06:45
    07 Jun 06:50
    Basic
      30
    30
    0.15
    0
    0
    07 Jun 06:20
    07 Jun 06:25
    Basic
      30
    30
    0.01
    0
    0
    07 Jun 06:15
    07 Jun 06:20
    Basic
      30
    30
    0.22
    0
    0
    07 Jun 06:10
    07 Jun 06:15
    Basic
      26
    26
    0.13
    0
    0
    07 Jun 06:05
    07 Jun 06:10
    Basic
      20
    20
    0.14
    0
    0
    07 Jun 06:00
    07 Jun 06:05
    Basic
      13
    13
    0.12
    0
    0
    07 Jun 05:55
    07 Jun 06:00
    Basic
      7
    7
    0.12
    0
    0
    07 Jun 05:50
    07 Jun 05:55
    Basic
      1
    1
    54.04
    0
    93.47
    07 Jun 05:45
    07 Jun 05:50
    Basic
      1
    0
    1.4
    0
    2.06
    07 Jun 05:40
    07 Jun 05:45
    Basic
      1
    1
    55.17
    0
    88.35
    07 Jun 05:35
    07 Jun 05:40
    Basic
      1
    0
    52.05
    0
    90.01
    07 Jun 05:30
    07 Jun 05:35
    Basic
      1
    1
    54.95
    0
    90.1
    07 Jun 05:25
    07 Jun 05:30
    Basic
      1
    1
    56.38
    0
    89.82
    07 Jun 05:20
    07 Jun 05:25
    Basic
      1
    0
    52.15
    0
    90.19
    07 Jun 05:15
    07 Jun 05:20
    Basic
      1
    0
    52.76
    0
    87.86

    Hi Chris,
    Thanks for testing the new Basic edition and for reporting this issue. Without some more investigation it is hard to tell what exactly has happened here.
    To be able to take a closer look I would need some more information from you. Could you please reach out to me via email (firstname DOT lastname AT microsoft DOT com)? I will then let you know what additional information we and will kick-off
    the investigation.
    Thanks,
    Jan

  • I followed the Clear CMOS Ram guidelines but I can't get into Setup!

    hey folks, thanks loads for the guildlines in the stickies, I followed the one for removing the battery to clear the CMOS RAM, and when it gets to the point where I press F1 to continue or DELETE to enter SETUP, whichever I press it just takes me to a blank screen with a flashing cursor in the top left corner (i think its the _ symbol or the -), and when I reboot I have to repeat the process of the monitor won't come on properly. If I just press DELETE to go into SETUP before the error comes up it does the same thing but theres a thick blue line at the bottom of the screen too.
    Any clues?
    Specs: 64MB NVidia GeForce 2 MX440 AGP 2x
    512MB 2100DDR RAM
    80GB HDD (Matrox i think?)
    AMD Athlon XP 1800+
    Mobo: K7N2 Delta2-LSR specs on here: http://msicomputer.co.uk/Products.aspx?product_id=703554&cat_id=77
    any help would me so appreciated as i'm at the end of my tether now!
    cheers
    alex

    Hello, thanks all for your reply.
    I did notice my card is 2x and technically the board is 4x/8x, I read up on the AGP thing and it seemed very likely that it would work anyway. Am I stupid for thinking that it would work?  Why would there be a checksum error because of that though?
    Anyway, in answer to the original question I needed to boot from CDROM so I could format and install Windows XP on my hard drive so I entered the setup and changed it to boot from the CDROM first, there was also a section I changed from Manual to Auto - I can't remember specifically what it was for, but they were exactly the same anyway, I think I left it on Auto as that always went for the most stable option and I really wanted to avoid any trouble (ugh!). Either way, like I say it didn't change any settings anyway so I don't see how it could be that.
    So I posted on Driverheaven.net here: http://www.driverheaven.net/showthread.php?t=102308
    They suggested I clear CMOS and thats where I am now!
    Thanks for the replies, any more ideas?

  • Clearing out RAM

    i'm doing graphics stuff (trigonometric line and point plotting in fullscreen IE) and was wondering if there's a way to clear out the memory when the program shuts down, as my computer runs veerrryy slow for a minute or two after i exit IE. i'm thinking i remember something like:
    public void shutdown()
    clear the shit out
    can someone please help me with this? it would be greatly appreciated.

    You could try setting every object that you have a reference to to null before you run gc(), but it's probably not going to get you that much. I think that IE caches a lot of Jave Runtime after it starts up, so that if you hit a java page again, it can start more quickly. For that reason, I don't think there's anything you can do short of restarting the browser.

  • SQL Server, RAM Usage, Networking Admin

    We have a VM Guest configured as follows: dedicated Sql 2008  Sp3 (x64) running on Windows 2008 R2 x64, 32GB RAM. Per Task Manager (if it is to be believed) the sql server process has allocated 20GB of RAM. The Networking Manager says
    that sql grabs every bit of memory you give it.  He has a hard time believing that sql really needs that much memory.
    a. I pointed out that we can cap the (buffer pool) memory and that sql, while reserving it, will not use the RAM unless it is actually needed. (In other words, that 20GB was needed at one point in time).
    b. I also pointed out that sql is not too quick to return the memory even it is no longer needed.
    c. I look for hard page faults on the server as an initial indication that RAM may be taxed.
    d. I told him there is no easy way to estimate the amount of RAM that a given sql server needs 
    In your opinion, are the statements a-d relatively factual or way off base?
    TIA,
    edm2
    P.S. Recently he indicated that if we raise the Sql RAM limit on a box then Sql will take it all and, despite, what is commonly said, large amounts of RAM costs lots of money.  Let us say this matter has been a point of contention between us for
    some time and we are still on opposite sides of the railroad track.

    Hello,
    Per Task Manager (if it is to be believed) the sql server process has allocated 20GB of RAM. The Networking Manager says that sql grabs every bit of memory you give it. He has a hard time believing that sql really needs that much memory.
    You're correct, don't trust task manager. If the server is not configured (max server memory) then yes, SQL Server will gobble up all available memory if it needs to (it on allocates memory if it already doesn't have room).
    a. I pointed out that we can cap the (buffer pool) memory and that sql, while reserving it, will not use the RAM unless it is actually needed. (In other words, that 20GB was needed at one point in time).
    You sir are 100% correct!
    b. I also pointed out that sql is not too quick to return the memory even it is no longer needed.
    Yes and no. SQL Server can and will respond to the windows low memory flag and give back memory if possible (for example, it won't give it back if using locked pages in memory [LPIM]). Low memory is different in versions of windows but it's always around
    100 MB which IMHO is way too late. Couple that with the fact it's a VM and it's memory could already be paged out by the host and no one would ever know means a crash could happen.
    c. I look for hard page faults on the server as an initial indication that RAM may be taxed.
    That would be true for a physical system. While it still sort of is true for a VM, we have no way of knowing if the host has that memory paged which would also cause issues (slowness, etc). Still doesn't hurt to watch though :)
    d. I told him there is no easy way to estimate the amount of RAM that a given sql server needs
    SQL Server will always happily take as much memory as you give it, to a point. If at one point it used 20 GB that's a good start. SQL Server wants everything to be in memory, because that has the fastest access time. So take into account the sizes of your
    databases, any CLR or items that run outside of the database (or are hosted), all of the queries that want to live in cache as well so they only have to be compiled once, etc.
    In your opinion, are the statements a-d relatively factual or way off base?
    See above :)
    P.S. Recently he indicated that if we raise the Sql RAM limit on a box then Sql will take it all and, despite, what is commonly said, large amounts of RAM costs lots of money. Let us say this matter has been a point of contention between us for
    some time and we are still on opposite sides of the railroad track.
    I feel you. Things to look for inside of SQL Server for memory pressure are lazy writes/second, free list stalls, a large increase in general IO of the server (could just mean the workload changed, tbh), etc. Also, depending on how the Guest is setup and
    the Host is configured will have a lot to do with performance. For example, if the guest can cross numa nodes and ends up accessing tons of foreign memory, if dynamic memory for the guest is used and constantly swapped. None of those will manifest itself in
    the counters but will surely have a negative impact on SQL Server.
    So, to be fair to you, you're correct in that (Depending on how the Host/Guest is configured) adding more RAM may or may not help (or make things worse if the memory is all paged on the host). To be fair to him, SQL Server on a physical box magically makes
    things run faster since they'll mostly be in memory.
    Sean Gallardy | Blog |
    Twitter

  • Clearing RAM after rendering

    I find that, after I've exported a complex project from Motion, my entire system is extremely sluggish. I can tell that this is because Motion has used up every bit of RAM it has and is needing to seek everything it needs for other programs from the hard drive once again.
    Is there an easy way to "clear" all the Motion stuff from the RAM? The only way I know of to get things running smoothly again is to just reboot the computer.
    I've looked at pricing for upgrading my memory, and that just isn't in my budget at this point.

    Well, I had just got around to a similar project. I exported another complex clip then cleared the RAM. It doesn't seem that there was any improvement to the sluggish system. I'll need to reboot.

  • Clearing RAM without restarting computer?

    My little Ram chips start to get cloggy on a regular basis. Is there a way I can clear the RAM without doing a restart?
    Ben

    Thank you Kenichi,
    Most helpful.
    Ben

  • Poor RAM management in Photoshop CS4 - need help!

    I have done numerous hours of research over the years only to give up and come back to this subject later on. I will try again!
    I must ask: is there ANY way to get Photoshop CS4 to automatically flush used RAM after closing image files? I'm tired and annoyed of CS4 eating more and more RAM without freeing anything after an image has been closed. An image shouldn't still eat up memory when it isn't even open anymore. It seems to be terrible RAM management of the program itself and how Adobe has forgotten to write that little snippit of code to clear the RAM after an image has been closed.
    I know this is not because of:
    Cache levels
    Setting too large of a saved history state; purging history cache or any kind of cache still never frees RAM
    A lack of updates; I have been up to date with CS4 very punctually as they were released
    The computer I am on; this poor RAM management has been around since CS2 and it's the same on the last 4 computers I have used
    Does CS5 still do this too?

    Your historically conditioned to believe software apps should swap data a standard way. The way your using the system is probably not the most effective processing for your workflow.
    -  I have hundreds of TIFFS that take 60-120MB each in processing, and 8gb  of RAM. The more total RAM actually usable that I can use the better.  How the heck can using less of what is actually available RAM enhance my  workflow? Standard are standards for a reason. The ink industry for  printing is non-standardized and people waste $3-5 billion+ a year only  increasing on unused ink that is still remaining in their cartridges, because there is no standard way of manufacturing ink, filling cartridges, or monitoring how much ink is actually left in a cartridge. I'd love for more standards in more markets. Unless natively stable, all other programs on my computer work flawlessly with said demonized traditional methods and standards, even in high bandwidth applications a hell of a lot more intensive than  Photoshop CS4 will EVER be. Currently people keep disregarding the fact that in my situation CS DOESNT FREE THE RAM.  CS4 is balloon. Balloon inflate. Never deflate even when emptied. Overflow into other rooms of critical OS space where balloon shouldn't be when it fill the room full. How many analogies must I give? Must I use sign language? Binary?
    You don’t have enough experience with these topics. This is actually a
    true statement. Most companies with systems large and small have to
    think about what it costs to process specific jobs. If one in a thousand
    jobs swap, a decision must be made to know how much it would cost to
    retrofit a very expensive environment to keep that one job swap from
    occurring. Most times it is better to let the swap happen for this
    non-mission critical item than pay $50,000 to upgrade all systems.
    I said NON EMERGENCY SITUATIONS.  Emergencies are once in a while. You're repeating what I said like a parrot, but in different longer sentences with more words telling me I don't get what I'm talkinga bout. You're missing the full picture of what I am actually saying. That 1 in 1000 overflow would be exactly true in my situation with 7GB used, but it's not. Why not? Because the CS4 balloon will not deflate itself or reuse the empty space inside the balloon when it's needed, and the OS isn't given back any of the empty space to work with to know it doesn't need to page anything. In turn CS4 is going to try and scratch too when the OS is telling it that is has no more RAM left when indeed it does, but its hiding it in its own reserve balloon from itself. If a company needed just 700MB more room and either they spend $50k to upgrade to that, or get CS4 to release some space once in awhile, they'd sure as hell bother Adobe or write their own mod to force CS4 to release unused allocated RAM to get it.
    Self inflicted only because I want to push the limit of what is actually usable on my machine, not some 'safe zone' with high tolerance. My system is tuned for a fine line of performance and I know what it can hande. I know what it uses and it does not spike usage for random OS operations. It can handle 7GB to 7.2GB of RAM of freely used RAM to one active program if it needs that big of a workspace to work. If CS4 isn't going to reuse the hollow areas in that balloon, then that's not my fault. My OS can handle the fine tuning, and CS4 is what cannot, obviously, since it can see that much RAM but not use the last %10 correctly.

  • Grouping Rules in PL/SQL Help needed

    Hi I have a requirement where I wan to group based on the below scenario
    I have a Table_A
    Table_A strcuture:
    create table table_a
    code number,
    name varchar2 (100),
    city varchar2 (100),
    dept varchar2 (100));;
    insert into table_a
    values
    1,'ABC','EA','A');
    insert into table_a
    values
    1,'ABC','EA1','A');
    insert into table_a
    values
    2,'BCD','EA2','A');
    insert into table_a
    values
    2,'ABC','EA3','A'');
    insert into table_a
    values
    3,'KBC','EA,'A');
    insert into table_a
    values
    3,'ABC','EA,'A');
    wan to group the above table data based on name,city,dept
    I wan the data  as
    1           ABC             EA1    A
                 BCD            EA2     A
    2           BCD            EA2     A
                 ABC            EA3     A
    3           KBC            EA      A
                 BCD            EA      A
    Kindly any help will be needful for me

    This is more of a presentation layer problem I would not handle it in SQL. For example if the presentation layer is SQL Plus you can use BREAK command, like this.
    SQL> select * from table_a;
          CODE NAME       CITY       DEPT
             1 ABC        EA         A
             1 ABC        EA1        A
             2 BCD        EA2        A
             2 ABC        EA3        A
             3 KBC        EA         A
             3 ABC        EA         A
    6 rows selected.
    SQL> break on code
    SQL>
    SQL> select * from table_a order by code;
          CODE NAME       CITY       DEPT
             1 ABC        EA         A
               ABC        EA1        A
             2 BCD        EA2        A
               ABC        EA3        A
             3 KBC        EA         A
               ABC        EA         A
    6 rows selected.
    But if you still wish to do it in SQL the right way is to use ROW_NUMBER like this.
    SQL> clear breaks
    breaks cleared
    SQL>
    SQL> select * from table_a;
          CODE NAME       CITY       DEPT
             1 ABC        EA         A
             1 ABC        EA1        A
             2 BCD        EA2        A
             2 ABC        EA3        A
             3 KBC        EA         A
             3 ABC        EA         A
    6 rows selected.
    SQL> select decode(rno, 1, code) code
      2       , name
      3       , city
      4       , dept
      5    from (
      6           select row_number() over(partition by code order by name) rno
      7                , t.*
      8             from table_a t
      9         )
    10  /
          CODE NAME       CITY       DEPT
             1 ABC        EA         A
               ABC        EA1        A
             2 ABC        EA3        A
               BCD        EA2        A
             3 ABC        EA         A
               KBC        EA         A
    6 rows selected.

  • SQL*Plus report: hide accept value in report

    HI all,
    I have created an SQL Report of an APEX-Application. The output is stored in a HTML file.
    All works fine but one think I want to hide in the HTML report.
    I try to describe what the problem is.
    I prompt the user to put in the application_id of the apex application:
                           accept v_application_Id char prompt 'Appliaction-ID:'
    In the HTML file the following output is shown:
    Report created on:
    25-Jun-2013, 10:06:04
    alt 8: where application_id = &&v_application_id
    neu 8: where application_id = 680
    Workspace
    WORKSPACE
    APPLICATION_ID
    APPLICATION_NAME
    ALIAS
    OWNER
    Q0Q0AUFTRAGSVERWALTUNG
    680
    Q0Q0AUFTRAGSVERWALTUNG
    F680317
    Q0Q0AUFTRAGSVERWALTUNG_ADMIN
    How can I hide the two lines
    alt 8: where application_id = &&v_application_id
    neu 8: where application_id = 680
    from the report?
    I have searched  this forum and toke a look into the documentation but I have nothing found.
    Could anyone please help me?
    Oracle 11g R2
    This is the SQL script what I run in SQL*Plus.
    -- start script
    accept v_application_Id char prompt 'Appliaction-ID:'
    spool C:\a\APEX.html
    set termout off
    SET MARKUP HTML ON SPOOL ON HEAD "<TITLE>SQL*Plus APEX-Report</title> -
    <STYLE TYPE=’TEXT/CSS’><!--BODY {bgcolor: ffffaa background: ffffc6} --></STYLE>"
    clear break
    clear buffer
    clear compute
    clear column
    clear sql
    set feedback off
    set serveroutput on
    -- Report Header
    ttitle left ' ' skip 1
    select TO_CHAR(sysdate,'dd-Mon-yyyy, hh24:mm:ss')  "Report created on:"
    from dual;
    -- Workspace
    ttitle left col 15 '<font face="Arial" size="+2" color="#0000FF">Workspace</font>' skip 1
    set linesize 300
    set pagesize 500
    set serveroutput on
    column workspace format a35
    column application_id format 99999999
    column application_name format a35
    column alias format a35
    column owner format a35
         select
             WORKSPACE,
             APPLICATION_ID ,
             APPLICATION_NAME,
             ALIAS,
             OWNER
         from apex_applications
         where application_id = &&v_application_id;
    ttitle off
         select
             APPLICATION_GROUP,
             APPLICATION_GROUP_ID,
             HOME_LINK,
             PAGE_TEMPLATE,
             ERROR_PAGE_TEMPLATE
         from apex_applications
         where application_id = &&v_application_id;
    set termout on
    set markup html off head '' body '' entmap off spool off pre off
    set feedback on
    set linesize 80
    set pagesize 50
    ttitle off
    set termout on
    set serveroutput off
    spool off
    set echo on
    -- End Script
    best regards
    ben
    Oracle 11g R2

    Hi, Ben,
    The SQL*Plus command to stop those messages is
    SET VERIFY OFF
    Put this command anywhere before the first use of a substitution variable, e.g. before the SPOOL command.
    Those "OLD" and "NEW" messages will stay suppressed until you either end the SQL*Plus session, or issue a SET VERIFY ON command.
    If you use SQL*Plus often, then, when you have a few minutes, look up the SET command in the SQL*Plus manual,
    SET System Variable Summary
    and read a little about each option.  You probably won't remember everything, but you probably will remember what kinds of things can be controlled by the SET command, and have a better idea of where to start looking in the future when you have a different problem.

  • Learning SQL Query with JCheckBox and JButton

    Hello,
    I am learning how to access a very simple Access table. I am able to connect to the database and return a simple query. As I make it more complicated is where I have confused myself. The program is suppose to allow the user to pick any field they want to query using JCheckBox. After they have checked the fields off, the run query button is hit and outputs the results in a JOPtion Pane with a JTable. I am trying to do a test run and I can't make the query at least output something. If I can get any clues to the right direction would be appreciated. Thanks.
    package mypackage25;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class QueryAddressBook extends JFrame
        private JLabel selectQueryLabel;
        private JCheckBox firstName, lastName,
                       telephone, addressI, addressII, city,
                       state, zip;
        private JPanel selectQueryPanel, checkBoxPanel, executePanel;
        private JButton runQueryButton, clearSQLButton;
        private Connection connection;
        private Statement statement;
        private ResultSet resultSet;
        public QueryAddressBook()
          super("Query an Address Book");
          //Driver and Connection
          try
          //Driver for MicrosoftAccess
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          //Inform the user that the Driver was loaded successfully
          System.out.println("Driver Loaded");
          //Connect to specific database(i.e. MyAddress3) in Access
          Connection connection=DriverManager.getConnection("jdbc:odbc:MyAddress3");
          //Inform User
          System.out.println("Database connected");
          }//end try
          catch(ClassNotFoundException cnfe)
            cnfe.printStackTrace();
          }//end catch
          catch(SQLException sqle)
            sqle.printStackTrace();
          }//end catch
          //get content pane and set its layout
          Container container=getContentPane();
          container.setLayout(new BorderLayout());
          //GUI Components
          selectQueryLabel=new JLabel("Select Fields to be Queried");
          firstName=new JCheckBox("First Name");
          lastName=new JCheckBox("Last Name");
          telephone=new JCheckBox("Telephone");
          addressI=new JCheckBox("Address I");
          addressII=new JCheckBox("Address II");
          city=new JCheckBox("City");
          state=new JCheckBox("State");
          zip=new JCheckBox("Zipcode");
          //register listeners for JCheckBoxes
          CheckBoxHandler handler=new CheckBoxHandler();
          firstName.addItemListener(handler);
          lastName.addItemListener(handler);
          telephone.addItemListener(handler);
          addressI.addItemListener(handler);
          addressII.addItemListener(handler);
          city.addItemListener(handler);
          state.addItemListener(handler);
          zip.addItemListener(handler);
          //set up selectQueryPanel
          selectQueryPanel=new JPanel();
          selectQueryPanel.setLayout(new FlowLayout());
          selectQueryPanel.add(selectQueryLabel);
          //set up CheckBox Panel
          checkBoxPanel=new JPanel();
          checkBoxPanel.setLayout(new FlowLayout());
          checkBoxPanel.add(firstName);
          checkBoxPanel.add(lastName);
          checkBoxPanel.add(telephone);
          checkBoxPanel.add(addressI);
          checkBoxPanel.add(addressII);
          checkBoxPanel.add(city);
          checkBoxPanel.add(state);
          checkBoxPanel.add(zip);
          //set up execute panel
          executePanel=new JPanel();
          executePanel.setLayout(new FlowLayout());
          //set up buttons
          runQueryButton=new JButton("Run Query");
          clearSQLButton=new JButton("Clear SQL");
          runQueryButton.addActionListener
            new ActionListener()
              public void actionPerformed(ActionEvent event)
                if(event.getSource().equals(runQueryButton))
                  runSQLQuery();
          executePanel.add(runQueryButton);
          executePanel.add(clearSQLButton);
          container.add(selectQueryPanel, BorderLayout.NORTH);
          container.add(checkBoxPanel, BorderLayout.CENTER);
          container.add(executePanel, BorderLayout.SOUTH);
          setSize(800,150);
          setVisible(true);
        public static void main(String args[])
          QueryAddressBook dwgui=new QueryAddressBook();
          dwgui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }//end main
        //private inner class for ItemListener event handling
        private class CheckBoxHandler implements ItemListener
          public void itemStateChanged(ItemEvent event)
          }//end method itemStateChanged
        }//end private inner class CheckBoxHandler
        private void runSQLQuery()
          String output="";
          try
            statement=connection.createStatement();
            resultSet=statement.executeQuery("select firstName from address");
            while(resultSet.next())
              output+=resultSet.getString(1)+"\n";
            JOptionPane.showMessageDialog(null,output);
            System.out.println(output);
          }//end try
          catch(SQLException sqle)
            sqle.printStackTrace();
          }//end catch
        }//end runSQLQuery
    }//end class

    At present your query string is
    "Select firstName from Address"
    Instead of using the above hardcoded string, try to build the
    query String using logic that checks which check boxes are selected
    by the user.
    Example..
    String query = "SELECT ";
    if (firstName.isSelected()) {
    query = query + " firstName";
    Be sure, you add the comma properly between two fields :-)

Maybe you are looking for