Query to find Memory used by each session in the database

Hi All,
Is there any query to find the memory utilised by each session in the database.I am in 9i database.
Regards
Vijay

Memory using sessions script,
SET LINESIZE 145
SET PAGESIZE 9999
COLUMN sid FORMAT 99999 HEADING 'SID'
COLUMN serial_id FORMAT 999999 HEADING 'Serial#'
COLUMN session_status FORMAT a9 HEADING 'Status' JUSTIFY right
COLUMN oracle_username FORMAT a12 HEADING 'Oracle User' JUSTIFY right
COLUMN os_username FORMAT a9 HEADING 'O/S User' JUSTIFY right
COLUMN os_pid FORMAT 9999999 HEADING 'O/S PID' JUSTIFY right
COLUMN session_program FORMAT a18 HEADING 'Session Program' TRUNC
COLUMN session_machine FORMAT a8 HEADING 'Machine' JUSTIFY right TRUNC
COLUMN session_pga_memory FORMAT 9,999,999,999 HEADING 'PGA Memory'
COLUMN session_pga_memory_max FORMAT 9,999,999,999 HEADING 'PGA Memory Max'
COLUMN session_uga_memory FORMAT 9,999,999,999 HEADING 'UGA Memory'
COLUMN session_uga_memory_max FORMAT 9,999,999,999 HEADING 'UGA Memory MAX'
prompt
prompt ----------------------------------------------------
prompt | User Sessions Ordered by Current PGA Size |
prompt ----------------------------------------------------
SELECT
s.sid sid
, s.serial# serial_id
, lpad(s.status,9) session_status
, lpad(s.username,12) oracle_username
, lpad(s.osuser,9) os_username
, lpad(p.spid,7) os_pid
, s.program session_program
, lpad(s.machine,8) session_machine
, sstat1.value session_pga_memory
, sstat2.value session_pga_memory_max
, sstat3.value session_uga_memory
, sstat4.value session_uga_memory_max
FROM
v$process p
, v$session s
, v$sesstat sstat1
, v$sesstat sstat2
, v$sesstat sstat3
, v$sesstat sstat4
, v$statname statname1
, v$statname statname2
, v$statname statname3
, v$statname statname4
WHERE
p.addr (+) = s.paddr
AND s.sid = sstat1.sid
AND s.sid = sstat2.sid
AND s.sid = sstat3.sid
AND s.sid = sstat4.sid
AND statname1.statistic# = sstat1.statistic#
AND statname2.statistic# = sstat2.statistic#
AND statname3.statistic# = sstat3.statistic#
AND statname4.statistic# = sstat4.statistic#
AND statname1.name = 'session pga memory'
AND statname2.name = 'session pga memory max'
AND statname3.name = 'session uga memory'
AND statname4.name = 'session uga memory max'
ORDER BY session_pga_memory DESC
Thanks

Similar Messages

  • How to find the memory used by specific session in oracle

    Hi,
    Would require your help to find memory used by specific session/connection in oracle using any query.
    **Regards**
    **Vijay Salian**

    Hi Girish,
    which column we have to look at the at in the below ouptut to find the actual memory used by oracle session in our case as mentioned dedicated in ourcase????
    SID Oracle User O/S User Session Program Machine PGA Memory PGA Memory Max UGA Memory UGA Memory MAX
    3 oracle oracle@alex (LGWR) alex 5,526,516 5,526,516 77,956 77,956
    9 oracle oracle@alex (ARC0) alex 4,500,080 4,500,080 77,956 77,956
    10 oracle oracle@alex (ARC1) alex 4,500,080 4,500,080 77,956 77,956
    11 SYSTEM oracle sqlplus@alex (TNS alex 3,403,988 4,780,244 77,956 1,400,476
    2 oracle oracle@alex (DBW0) alex 2,488,624 2,488,624 77,956 77,956
    4 oracle oracle@alex (CKPT) alex 1,359,484 1,359,484 77,956 77,956
    17 SCOTT oracle sqlplus@alex (TNS alex 577,512 708,584 339,812 339,812
    5 oracle oracle@alex (SMON) alex 499,704 499,704 77,956 77,956
    8 oracle oracle@alex (QMN0) alex 475,596 541,132 274,348 274,348
    19 SCOTT oracle sqlplus@alex (TNS alex 454,964 454,964 143,420 143,420
    6 oracle oracle@alex (RECO) alex 237,024 237,024 77,956 77,956
    1 oracle oracle@alex (PMON) alex 228,512 228,512 77,956 77,956
    7 oracle oracle@alex (CJQ0) alex 228,512 228,512 77,956 77,956
    13 rows selected.
    Regards
    Vijay

  • How to find out total memory used by each database ?

    I have two databases in one unix server.
    1) I need to know total memory used by each database.
    2) secondly, I want to know the detail used in each database.
    thanks

    For a database using dedicated shared servers, we can say total memory = 1 * SGA + sum (PGA) for all dedicated server processes (this excludes the size of the Oracle binary)
    For SGA, see
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14231/create.htm#sthref401
    or
    ipcs -mob | grep <oracle account> gives the SGA sizes for the 2 databases.
    for PGA,
    see PGA_USED_MEM column http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2022.htm#sthref3837
    it's difficult to rely on Unix top/ps command because some Unix will add the shared memory to each dedicated server connection, some not.

  • The find function used to automatically scroll to the next word, now it doesn't. How do I fix it?

    The find function used to automatically scroll to the instance of the word I was looking for. Now it doesn't. How do I fix this?
    == This happened ==
    Every time Firefox opened
    == a few months ago

    Hmm... you're right. I don't have access to that Google Doc, but our support.mozilla.com weekly metrics are on Google Docs, and I see the same issue there.
    https://spreadsheets.google.com/ccc?key=0Aibg4PvTbjUKcGlBLWEtZFhDTDJwN3ZCNXBUdTBIS0E&hl=en#gid=0
    It may be specific to Google spreadsheets (and whether or not you have permission to edit the doc). I'm currently trying to find out if that's a Firefox bug, or a Google bug. If you use the '''Ctrl-F''' keyboard shortcut, Google's Find feature takes over, so they obviously want people using their Find utility.

  • DI 11.5.3 created inactive repository sessions on the database server

    The cusotmer complaint that many inactive sessions have been created on their DI repository database. As a result, the database has to be bounced every 3 or 4 days to clean those sessions. They use DI 11.5.3 on HP-UX. The database is Oracle 10g. What would cause this issue? The improper close of the Desinger window? Or something wrong with the job design?
    Thanks,
    Larry

    what is the process or application to which these sessions belong, Designer is not the only application which will open repo connection. WebAdmin also open connection to repository, it actually opens multiple connection
    I think you can get the application and process which have opened session to the database from v$sessions table

  • What the steps are useful for us while designing the database by Performanc

    Dear Experts
    Plz tell me.
    What the steps are useful for us while designing the database by Performance point of view.
    Like Proper indexing and table assing to specific tbalespace etc

    Oracle manuals would do the best for you. There is no step by step rules for tuning the database , had this be true , then Oracle must've write a programme , application or sql script to achive it . I would advise you to go through oracle performance and tuning guide .
    Hare Krishna
    Alok

  • How to find memory used by page tables

    Is there a way to find out how much memory is currently being used by page tables? I am new to Solaris ;-)
    I want to quantify the advantages of Intimate Shared Memory (in the context of a large Oracle database with lots of concurrent users). I want to contrast this against Linux which does not have a method of allowing different processes to share page tables that map onto shared memory. Thus, with a large number of concurrent connections where each connection creates a new process that maps onto the Oracle shared memory, a significant amount of memory can be consumed just by the page table entries.

    Yes, a very recent acquisition :-) ......I'm busy working my way through it, just taught myself about mdb today but I still can't figure how to get the amount of memory being used by page tables only. The dcmd ::memstat can give me the total amount of memory being used by the kernel but I would like some more detail than that.
    On Linux you can simply look at /proc/meminfo and it contains a wealth of information. I was hoping Solaris would be similar....but isn't that always the case when doing something new? We hope it's like what we already know :-) Below is an example from Linux showing that 1860 kB have been to store page table entries.
    [root@makalu ~]# cat /proc/meminfo | grep PageTables
    PageTables: 1860 kB
    [root@makalu ~]#
    Edited by: BrettSchroeder on Mar 12, 2008 1:37 PM

  • Air - Sqlite with Adobe Air insert data in memory, but do not record on the database file

    I have the code:
    var statement:SQLStatement = new SQLStatement();
    statement.addEventListener(SQLEvent.RESULT, insertResult);
    statement.addEventListener(SQLErrorEvent.ERROR, insertError);
    statement.sqlConnection = sqlConnection;
    statement.text = "insert into table values('"+TINome.text+"','"+TISerial.text+"') ";
    statement.execute();
    This run without error and the data is inserted (i dont know where), but when i see into database with firefox sqlite manager, the database is empty! But the Air continue run for a time like the data was recorded on the database file. I dont know what is happen with it.
    Help please!

    Toplink In Memory was developed by our project to solve this problem. It allows us to run our test either in memory or against the database.
    In memory, we basically stub out the database. This allows us to speed up our tests about 75x (In memory we run 7600 tests in 200 secs, it takes about 5 hours against the database). However, it throws away things like transactions, so you can't test things like rollback.
    In database mode, it just uses toplink, Another benefit of it though is that it watches all the objects created allowing an automatic cleanup of created test objects - keeping your database clean and preventing test interactions.
    We used HSQL running in memory previously, it worked fine. However, we needed to write scripts to translate our Oracle SQL into HSQL. Also, we had to override things like the data function in HSQL, and a few of our queries behaved unexpectedly in HSQL. We later abandoned it, as it became a lot of maintenance. It was about 10x faster than running against Oracle.
    Interestingly, we install oracle on all our developers machines too, tests run way faster locally, and developers feel way more comfortable experimenting with a local instance than with a shared instance.
    You can find the toplink in memory stuff at:
    http://toplink-in-mem.sourceforge.net/
    I provide all support for it. Doc is sketchy but I'm happy to guide you through stuff and help out where I can with it.
    - ted

  • How to clean the dead sessions in the database?

    Hi,
    sqlldr user/passwd@dbtns DIRECT=TRUE SKIP_UNUSABLE_INDEXES=TRUE SKIP_INDEX_MAINTENANCE=FALSE control="test.ctl"
    3M records
    The OS shutdown when i sqlldr, and start another sqlldr into the same table
    but the table is locked.
    sqlldr failed
    SQL*Loader-951: Error calling once/load initialization
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
    how to use ORACLE system maintenance procedure to clear the database dead session?
    Which procedure?
    I don't want to use the solution:
    alter system kill session

    HI..
    What is the status of the session in V$sesison view.Does the session exist.
    COLUMN username FORMAT A15
    col osuser for a15
    col module for a15
    COLUMN machine FORMAT A30
    col program for a20
    COLUMN logon_time FORMAT A20
    SELECT NVL(s.username, '(oracle)') AS username,
           s.osuser,
           s.sid,
           s.serial#,
           p.spid,
           s.status,
           s.module,
           s.terminal,
           s.machine,
           s.program,
           TO_CHAR(s.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time
    FROM   v$session s,
           v$process p
    WHERE  s.paddr  = p.addr
    and AND    s.status = 'ACTIVE'
    ORDER BY s.username, s.osuser;Anand

  • NO ONE KNOWs??? EJB3.0: how to use column default value in the database??

    hi,
    This seems to be easy but I didn't find good answers... pls help...
    I have a table XYZ with a column:
    FriendlyName VARCHAR(30) NOT NULL DEFAULT 'my home'
    When I want to persist an entity object XYZ, I don't want to specify its field FriendlyName---in my program, l leave the field value to be null and I want to rely on the database to default its value to 'my home'
    however, i can't seem to do that because every time, i got the error msg saying the field "FriendlyName" can NOT be null.
    Is there a way for me to rely on the database to give the field its default value without specifying it in my entity class? (I am using ejb3.0 persistence+hibernate+mysql)
    thanks for ur input....

    That looks nice, when you don't include columns in
    inserts statements the dbms takes the default
    The question is: does hibernate understand and works
    with that?
    Let us knowWell, probably not. I did try that, somehow I got the following error msg. I did go through the log carefully, nothing really meaningful is there:
    javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3708)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3481)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1271)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
         at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:118)
         at $Proxy66.saveControlPoint(Unknown Source)
         at com.mycompany.struts.action.CustomerActivateControlPointAction.execute(CustomerActivateControlPointAction.java:102)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:413)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:225)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:255)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1029)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1029)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:249)
         at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
         at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.handle(CometEngine.java:220)
         at com.sun.enterprise.web.connector.grizzly.comet.CometAsyncFilter.doFilter(CometAsyncFilter.java:74)
         at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.invokeFilters(DefaultAsyncExecutor.java:162)
         at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.interrupt(DefaultAsyncExecutor.java:140)
         at com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:79)
         at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:103)

  • Determining the used and free space on the database

    Hi,
    I am trying to analyse the total used and free space on all the tablespaces in a database. The query which I am using is as below:
    SELECT /* + RULE */ df.tablespace_name "Tablespace",
    df.bytes / (1024 * 1024) "Size (MB)",
    SUM(fs.bytes) / (1024 * 1024) "Free (MB)",
    Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",
    Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"
    FROM dba_free_space fs,
    (SELECT tablespace_name,SUM(bytes) bytes
    FROM dba_data_files
    GROUP BY tablespace_name) df
    WHERE fs.tablespace_name (+) = df.tablespace_name
    GROUP BY df.tablespace_name,df.bytes
    UNION ALL
    SELECT /* + RULE */ df.tablespace_name tspace,
    fs.bytes / (1024 * 1024),
    SUM(df.bytes_free) / (1024 * 1024),
    Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),
    Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)
    FROM dba_temp_files fs,
    (SELECT tablespace_name,bytes_free,bytes_used
    FROM v$temp_space_header
    GROUP BY tablespace_name,bytes_free,bytes_used) df
    WHERE fs.tablespace_name (+) = df.tablespace_name
    GROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_used
    ORDER BY 4 DESC;
    Is this query alright? Or are any changes required in it?
    Thanks in advance.

    SET LINESIZE 85
    SET PAGESIZE 200
    column tablespace_name format a18
    column file_name format a25
    column Allocated_kb format 999,999,999
    column free_kb format 999,999,999
    column Percent_Free format 999
    SELECT
    df.tablespace_name,
    df.file_name,
    df.bytes/1024 Allocated_kb,
    free.free_kb,
    Round(free.free_kb/(df.bytes/1024)*100) Percent_Free
    FROM
    dba_data_files df,
    (SELECT file_id, SUM(bytes)/1024 free_kb
    FROM dba_free_space GROUP BY file_id) free
    WHERE
    df.file_id=free.file_id
    ORDER BY
    Percent_Free;

  • How to open MSWORD using JAVA/JNI and write the database entries into WORD

    Hi..
    I am searching for java codes that uses JAVA NATIVE INTERFACE (JNI) for opening MSWORD 2003.
    To be brief.
    I created HTML form called Employee_data.
    if i click on Submit button a word document should be opened.This should be using JNI.
    I have also created a servlet in jsp to process the form data and store it into database(mysql).;
    Please help me to find the codes to open MSWORD on submit click and to write the database entries into word file.Can i get the full code for that.This is so urgent.
    Thanks in advance.

    Hi Suresh,
    The easest solution I can think of is to copy the math equation from the PowerPoint then paste in the Word document directly, there's actually no way to convert it to plain text, some equation is very complext, String variable is not suitable in this case.
    For example, this code works fine:
    var powerPoint = new Application { WindowState = PpWindowState.ppWindowMinimized };
    var oPresSet = powerPoint.Presentations;
    Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(@"C:\test.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
    var strObj = oPres.Slides[1].NotesPage.Shapes[2].TextFrame2.TextRange.MathZones.get_MathZones();
    strObj.Copy();
    Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
    wordApp.Visible = true;
    Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Add();
    doc.Range(0, 0).Paste();
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Using only 1 connection to the database

    I have to use TopLink to connect to an Access database using the JDBC-ODBC bridge (please don't ask). The problem is that I can only create 1 connection to the database (as the bridge doesn't allow concurrent connections).
    How can I tell TopLink to share the only connection I have for reading and writing?
    I have tried setting the number of connection to 1 and using exclusive read but it allways create 1 to read and one to write...
    help?
    jeremie

    The database session "type" would need to be the same, and you need to go with the "lowest common denominator", which would clearly be Access here... There wouldn't be any advantage to letting TopLink support ServerSession and DatabaseSession combos, we'd always be waiting on the Access database anyways...

  • Losing connetion pools when killing off sessions on the database

    Hi,
    We are using webLogic version 6.1 as our app. We are currently experiencing a problem with the connection pools to our databases.
    Problem: We have some jobs that run on our databases through connections pools via webLogic. When we kill the session of the job on the database side, all the connections using that connection pool from webLogic to that database is lost. We tried to re-target the connection pool through the console but this fails to work, thus requiring a bounce to the webLogic system.
    Is there an explanation for this, moreover is there a solution to resolve this as this seems unacceptable in a live production situation.
    Thanks and regards
    William Sung
    Coporate Investment Banks & Markets
    44 (0)20 7779 1357

    William Sung wrote:
    Hi,
    We are using webLogic version 6.1 as our app. We are currently experiencing a problem with the connection pools to our databases.
    Problem: We have some jobs that run on our databases through connections pools via webLogic. When we kill the session of the job on the database side, all the connections using that connection pool from webLogic to that database is lost. We tried to re-target the connection pool through the console but this fails to work, thus requiring a bounce to the webLogic system.
    Is there an explanation for this, moreover is there a solution to resolve this as this seems unacceptable in a live production situation.
    Thanks and regards
    William Sung
    Coporate Investment Banks & Markets
    44 (0)20 7779 1357Hi. What DBMS is this, and what JDBC driver are you using? Also, show me the pool
    definition. I may be able to help the situation, but I don't think that killing DBMS sessions
    out from under applications is anything anyone should do in a production system.
    Joe

  • How to find what are triggers are present in the database?

    Hi All
    Can any one tell me how to find what all triggers present in the database.
    Thanks in Advance

    Hi All
    Can any one tell me how to find what all triggers
    present in the database.
    Thanks in AdvanceYou should visit Pythia, the Oracle of Delphi, near Thermopile in Greece. She might be able to give you an answer. Pythia was an early leader in executive decision support systems and is not to be confused with the Oracle Corp. of Redmond, CA. Pythia also has a group of helpful colleagues in Toronto. Rumor is that they're also making predictions by inhaling laurel vapors. SQL, as you know, stands for "Said Quixotically on Laurel".

Maybe you are looking for

  • Bex Analyser : Date Format error.

    Hi All, We are facing date format error, while running the query in Bex analyzer. We have one column in report i.e Net Payment Date, so when we run the query in analyzer the single date like "5-6-2010 is getting swapped like 6-5-10 & year also showin

  • Array of Strings?

    How can I make an array of strings?

  • Cant get full screen...

    I am running a mac mini on an LG 42" plasma TV and have tried all the various screen resolutions. My problem is that I have videos which are 624x368 (close enough to accurate 16:9 widescreen video) and these display as a full frame image (no black ba

  • ConcurrentModificationException in drawing code

    Hi all, I'm getting a ConcurrentModificationException and I'm having a bit of a hard time figuring out how to prevent it - I can't even really understand why it happens yet. I'm running a simulation of moving bodies in some world, and am using a Swin

  • Is it possible to automate software instrument parameters in a MIDI region? And alias the region with the automation?

    I am trying to track down a detail about how automation works in Logic Pro X. What I want to know is: 1. Can I draw control-point curves (and smoothly bend them) in a MIDI region to automate a software instrument parameter (and/or smart controls)? 2.