Monday, December 21, 2009

Windows XP Simple Disk Analyzer 1.0

I discovered this software, when i was wondering how my diskspace is shared among various softwares that are installed on my drive viz., C: D: E: .

I was getting 'Low Disk Space' notification and tried to uninstall unnecessary softwares but still i was getting this notification. This software has solved my chronic Low Disk Space problem by showing % percentage graph corresponding to various softwares / files on my disk. This was the exact software that i was looking. Please find the picture below -





About software :

Simple Disk Analyzer really honors its name because it´s maybe the most easy-to-use, single-task application ever. Most of its simplicity comes from the fact that this application can only do one task: analyze disks and folder to inform you how the space is used by subfolders and files.




Only three buttons are available at its main window: "Browse" to select the disk or folder you want to analyze, "Analyze" to put the application to work and "About" to get some information about the software.



Once the analysis is done the program will show you a report in the same window. The report uses a tree structure listing all files and subfolders, and one horizontal bar indicating the percentage of space used by them.



A downside of this application is that it won’t allow stopping the analysis once is triggered. Just assume you picked the wrong location to analyze and want to stop the process to pick the correct one. Well, you will have to wait until it finishes and start it all over again later.


Advantages:
It's available for free.

It's extremely simple to use.

It has a lightweight installation file.


Disadvantages:


It's not possible to stop the analysis once is started.

It's a single-task application.



Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.

NOTE: If you would like to share any useful info, please mail to the authors.


Download Link

Friday, November 27, 2009

Various Internet Explorer IE versions script error dialog boxes



Internet Explorer 3.x and 4.x display a rather confusing (from the user point of view anyway) error message for script errors:

Figure 1. Internet Explorer 3.x and 4.x default window.onerror dialog box

Internet Explorer 5 improves the situation somewhat by hiding the default error dialog box, and instead displaying a warning icon and text message in the status bar after the page loads:




Figure 2. Internet Explorer 5 default window.onerror status bar indicator

source: http://msdn.microsoft.com/en-us/library/ms976144.aspx

Inquisitive Internet Explorer 5 users can double-click the status bar to display an updated default error dialog box (note how it displays the first time the user encounters a script error on a Web page, but requires the user to check the check-box in order to always display it):



Figure 3. Internet Explorer 5 default window.onerror dialog box


In IE8, we’ve given the script error dialog a visual refresh (it needed it—compare IE7 vs. IE8 below). We think we’ve really improved the readability of the dialog, and made it simpler to see multiple script errors. We also listened to the number one customer request, which was to add copy/paste support to this dialog. As a result, Ctrl+C will copy all of the errors to the clipboard, whether the dialog is in its expanded state or not, and individual errors can be copied in the same manner after they’ve been selected. The dialog also supports an XML output to the clipboard if SHIFT is held while copying.




IE7 script error dialog next to the IE8 script error dialog.



Information copied from the script error dialog can be used as feedback to help web sites and support personnel to quickly find and diagnose errors, improving the usability of the site for all visitors.

http://blogs.msdn.com/ie/archive/2009/04/08/handling-script-errors-from-three-different-perspectives.aspx



Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.

NOTE: If you would like to share any useful info, please mail to the authors.

Tuesday, October 27, 2009

How to convert Java Project to Web Project in Eclipse Ganymede, Europa


Sometime we just need to convert our Java Project to Web Project in Eclipse IDE.

Here is some of the reasons you may need to convert Java Project to Web Project

1) Create / import a wrong project type
2) Initial java project migrate to java web project
3) Maven create a Java Project (eclipse:eclipse), but we need a web project feature.
4) Others…?
No mater what reasons we need to convert java project to web project. Eclipse does not provide a feature to convert it automatically. We have to do it manually.

Here is the steps to convert Java Project to Web Project in Eclipse

1) Create a empty dynamic web project and click on the .project file
2) Copy “web project” facet buildCommand and paste within “java project” .project buildSpec tag
<buildCommand>
  <name>org.eclipse.wst.common.project.facet.core.builder</name>
  <arguments>
  </arguments>
 </buildCommand>
3) Copy “web project” facet nature and paste within “java project” .project natures tag
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
P.S Be careful of the .project xml tag, make sure you paste into a correct location.
4) Save it.
5) Right click on Java Project, click properties.
6) Select Project Facets and click modify project button.
7) Click Dynamic Web Module and Java check box.






Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.


NOTE: If you would like to share any useful info, please mail to the authors.

Monday, October 26, 2009

Using Java 5.0 Generics With Wildcards, Extends and more

Using Generics With Wildcards and Extends


By John Zukowski


Java 2 Platform, Standard Edition 5.0 (J2SE 5.0) introduced generics to the Java programming language and
platform. In the simplest case and typical usage, generics allow for the identification of what you want
 to store in a collection. So instead of saying that your program has a List ofObjects, you can now
specify that you have a List of String objects or some other class type. Then, if you accidentally
try to add something to the List that is of the wrong type, the compiler notifies you of the error and it
can be fixed at compile time, rather than having to wait until you run the program and the program
reaches the point in code where the fetch operation produces a runtime casting exception.

This brings up a second benefit of generics. Iterators now become typesafe. The next()
 method of the Iterator interface returns the typesafe version of the next element of the collection.

 Most people don't fully understand the use of the extends keyword when using generics
A typical example shown to explain the use of extends has to do with drawing shapes. Instead, this
 tech tip will use an example that uses Swing components so that you do not have to create extra
new classes. In a very limited case, the class hierarchy for Swing button components is shown here,
with Object as the real root:


Component
|- Container
   |- JComponent
      |- AbstractButton
         |- JButton
         |- JMenuItem
            |- JCheckBoxMenuItem
            |- JMenu
            |- JRadioButtonMenuItem
         |- JToggleButton
            |- JCheckBox
            |- JRadioButton

One thing that all AbstractButton subclasses share in common is a getText() method. So in the spirit
of generics, you can define a method that takes a List of AbstractButton items and return a List
of the String labels of those buttons. Here's the first version of such a method:


public static List<String> getLabels(List<AbstractButton> list) {
    List<String> labelList = new ArrayList<String>(list.size());
    for (AbstractButton button: list) {
      labelList.add(button.getText());
    }
    return labelList;
  }



And here is how you might use the method. First, define a List of AbstractButton types, fill it up,
and call the method:
"Hola, Mundo" is the Spanish translation of "Hello, World," according to Google. The results of


List<AbstractButton> buttonList =
      new ArrayList<AbstractButton>();
  buttonList.add(new JButton("Hello"));
  buttonList.add(new JCheckBox("World"));
  buttonList.add(new JRadioButton("Hola"));
  buttonList.add(new JMenuItem("Mundo"));


  List labels = getLabels(buttonList);
  System.out.println(labels);



 the println() call is as follows:




[Hello, World, Hola, Mundo]

With a List of AbstractButtons, everything functions fine, but this breaks down when the List
is of something else, specifically a subclass. One would logically think that with a List of JButton
 items, everything would work fine, because JButton is a subclass of AbstractButton. Shouldn't you
 be able to call getLabels(List<AbstractButton>) with a List of a subclass of AbstractButton?


List<JButton> buttonList = ...
  // ... Fill list ...
  List<String> labels = getLabels(buttonList);


Well, that isn't the case. Because this is a compile-time check, and because the definition of getLabels()
 is defined to accept only anAbstractButton List, you cannot pass anything else to it. The
compilation-time error message follows:


GetList.java:13: getLabels(java.util.List<javax.swing.AbstractButton>)
  in GetList cannot be applied to (java.util.List<javax.swing.JButton>)


    List<String> labels = getLabels(buttonList);
                          ^
1 error



And this is where the extends keyword comes in handy. Instead of defining the getLabels() method to
accept only an AbstractButton list, define it to accept any List of AbstractButton subclasses:


public static List<String> getLabels(
      List<? extends AbstractButton> list) {


The wildcard ? here says that the method doesn't care what the exact class type is, as long as it is
a subclass of AbstractButton. Here's a complete example that puts all the pieces together:


import java.util.*;
import javax.swing.*;


public class GetList {
  public static void main(String args[]) {
    List<JButton> buttonList =
      new ArrayList<JButton>();
    buttonList.add(new JButton("Hello"));
    buttonList.add(new JButton("World"));
    buttonList.add(new JButton("Hola"));
    buttonList.add(new JButton("Mundo"));


    List labels = getLabels(buttonList);
    System.out.println(labels);


  }


  public static List<String> getLabels(
        List<? extends AbstractButton> list) {
    List<String> labelList = new ArrayList<String>(list.size());
    for (AbstractButton button: list) {
      labelList.add(button.getText());
    }
    return labelList;
  }
}




Now, when you are defining your own classes and methods with generics and are thinking of accepting
 an abstract class as the generic argument, or any superclass, remember to use wildcards so that the
same method works best with subclasses too.



For more information on generics, 


1. see two earlier tutorials by Gilad Bracha: a 2004 tutorial (PDF) and the generics
 lesson in the online Java Tutorial.





2. Who wants to really understand wildcards to read this paper by Bracha and Torgersen:
http://bracha.org/wildcards.pdf




4. The best on-line reference for programming with Java Generics: http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html


Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.


NOTE: If you would like to share any useful info, please mail to the authors.

Wednesday, September 30, 2009

Removing Hyperlinks using jQuery

<blockquote> <html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.3.2"); </script> <!--Author Ganesh T a.k.a Ganex. --> <script type="text/javascript"> $(document).ready(function() { //initialization code }); function disableLink(e) { e.preventDefault(); return false; } function removeLinks(){ $('.linked').bind('click', disableLink).addClass('nolink'); } function restoreLinks(){ $('.linked').unbind('click', disableLink).removeClass('nolink'); } function getTableInfo(testval){ alert(testval+" test"); } </script> <style> .nolink { text-decoration: none; color:gray; cursor:text} </style> </head> <body> <a href="javascript:getTableInfo('1');" class="linked"> Test 1 M</a> <a href="javascript:getTableInfo('2');" class="linked"> Test 2 M</a> <a href="javascript:getTableInfo('3');" class="linked"> Test 3 M</a> <a href="javascript:getTableInfo('4');" class="linked"> Test 4 M</a> <a href="javascript:getTableInfo('5');" class="linked"> Test 5 M</a> <a href="javascript:getTableInfo('6');" class="linked"> Test 6 M</a> <a href="javascript:getTableInfo('7');" class="linked"> Test 7 M</a> <input type="button" onclick="removeLinks()" name="test" value="Remove Links"/> <input type="button" onclick="restoreLinks()" name="test" value="Restore Links"/> </body> </html> </blockquote>


Showing Hiding Anchor Tags using jQuery. Remove anchor Tags Hide Anchor Tags using jquery. Anchor tag hiding Anchor Tag CSS attributes


Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.

NOTE: If you would like to share any useful info, please mail to the authors.

Common Oracle performance problems


By Mike Ault


In my 16 years of working with Oracle I have seen the database grow and change as new features are added and old ones removed or changed. However, even as things change, they remain the same in many respects. We still must index properly, set memory settings correctly and specify proper hardware.
You would think that by now everyone would have a pretty good idea what an average configuration for an Oracle small, medium and large database would be, but unfortunately these classifications also undergo mutation. It wasn’t too long ago that if you used several hundred megabytes of disks you had a large database. Now of course large databases are in the terabyte and larger size range. This makes setting tuning guidelines for Oracle databases somewhat of a moving target where the rules change almost as fast as you can derive them.
Given a changing environment for tuning Oracle is the only constant I will try to present in this paper the major issues I have found in the last few years while tuning several dozen different client databases. I will try to present a method or methods for determining set points that take into account this changing beast that is Oracle.
Major Issues of Concern
From a review of the tuning reports I have generated over the last couple of years I have come up with a list of 6 major areas that the DBA or tuning expert needs to pay attention to in an Oracle environment:
·        Non-use of bind variables
·        Improper Index usage
·        Improper memory configuration
·        Improper disk setup
·        Improper initialization parameter usage
·        Improper PGA setup
Each of the above areas can have a profound impact on the ability of an Oracle database to function properly. In the following sections we will cover how to measure the affect of these on your system, how to correct them once found and how to prevent them from being issues in the future. Each of the above can be, and probably is somewhere at this conference, a full hour topic, so we have a lot of ground to cover, let’s get started!
Non-Use of Bind Variables
You’ll hear it from PL/SQL tuners, you’ll hear from SQL tuners and you’ll hear from shared pool tuners, the biggest problem in many applications is the non-use of bind variables.
Why is this an issue? Well, Oracle uses a signature generation algorithm to assign a hash value to each SQL statement based on the characters in the SQL statement. Any change in a statement (generally speaking) will result in a new hash and thus Oracle assumes it is a new statement. Each new statement must be verified, parsed and have an execution plan generated and stored.
The activities needed to parse a statement and generate an execution plan are CPU intensive and generate recursive SQL against the data dictionary which may result in physical IO as well. The added statement and parse tree takes up space in the shared pool. I have seen several databases where the shared pool was over a gigabyte in size (one were it was 4 gig!) until bind variables were introduced, reducing the size to a couple of hundred megabytes at most.
A quick method of seeing whether code is being reused (a key indicator of proper bind variable usage) is to look at the values of reusable and non-reusable memory in the shared pool. A SQL for determining this comparison of reusable to non-reusable code is shown in figure 1.
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
ttitle 'Shared Pool Utilization'
spool sql_garbage
select 1 nopr,
to_char(a.inst_id) inst_id,
a.users users,
to_char(a.garbage,'9,999,999,999') garbage,
to_char(b.good,'9,999,999,999') good,
to_char((b.good/(b.good+a.garbage))*100,'9,999,999.999') good_percent
from (select
  a.inst_id,
  b.username users,
  sum(a.sharable_mem+a.persistent_mem) Garbage,
  to_number(null) good
from
   sys.gv_$sqlarea a,
   dba_users b
where
  (a.parsing_user_id = b.user_id and a.executions<=1)
group by a.inst_id, b.username
union
select distinct
  c.inst_id,
  b.username users,
  to_number(null) garbage,
  sum(c.sharable_mem+c.persistent_mem) Good
from
   dba_users b,
   sys.gv_$sqlarea c
where
  (b.user_id=c.parsing_user_id and c.executions>1)
group by c.inst_id, b.username
) a, (select
  a.inst_id,
  b.username users,
  sum(a.sharable_mem+a.persistent_mem) Garbage,
  to_number(null) good
from
   sys.gv_$sqlarea a,
   dba_users b
where
  (a.parsing_user_id = b.user_id and a.executions<=1)
group by a.inst_id,b.username
union
select distinct
  c.inst_id,
  b.username users,
  to_number(null) garbage,
  sum(c.sharable_mem+c.persistent_mem) Good
from
   dba_users b,
   sys.gv_$sqlarea c
where
  (b.user_id=c.parsing_user_id and c.executions>1)
group by c.inst_id, b.username
) b
where a.users=b.users
and a.inst_id=b.inst_id
and a.garbage is not null and b.good is not null
union
select 2 nopr,
'-------' inst_id,'-------------' users,
'--------------' garbage,'--------------' good,
'--------------' good_percent from dual
union
select 3 nopr,
to_char(a.inst_id,'999999'),
to_char(count(a.users)) users,
to_char(sum(a.garbage),'9,999,999,999') garbage,
to_char(sum(b.good),'9,999,999,999') good,
to_char(((sum(b.good)/(sum(b.good)+sum(a.garbage)))*100),'9,999,999.999') good_percent
from (select
  a.inst_id,
  b.username users,
  sum(a.sharable_mem+a.persistent_mem) Garbage,
  to_number(null) good
from
   sys.gv_$sqlarea a,
SEE CODE DEPOT FOR FULL SCRIPT
where
  (a.parsing_user_id = b.user_id and a.executions<=1)
group by a.inst_id,b.username
union
select distinct
  c.inst_id,
  b.username users,
  to_number(null) garbage,
  sum(c.sharable_mem+c.persistent_mem) Good
from
   dba_users b,
   sys.gv_$sqlarea c
where
  (b.user_id=c.parsing_user_id and c.executions>1)
group by c.inst_id,b.username
) a, (select
  a.inst_id,
  b.username users,
  sum(a.sharable_mem+a.persistent_mem) Garbage,
  to_number(null) good
from
   sys.gv_$sqlarea a,
   dba_users b
where
  (a.parsing_user_id = b.user_id and a.executions<=1)
group by a.inst_id,b.username
union
select distinct
  c.inst_id,
  b.username users,
  to_number(null) garbage,
  sum(c.sharable_mem+c.persistent_mem) Good
from
   dba_users b,
SEE CODE DEPOT FOR FULL SCRIPT
where
  (b.user_id=c.parsing_user_id and c.executions>1)
group by c.inst_id, b.username
) b
where a.users=b.users
and a.inst_id=b.inst_id
and a.garbage is not null and b.good is not null
group by a.inst_id
order by 1,2 desc
/
spool off
ttitle off
set pages 22
Figure 1: SQL Code to Show Shared verses Non-shared code
An example report is shown in Figure 2 for an instance with poor code reuse characteristics. The names have been changed to protect the innocent.
Date: 03/25/05                                              Page:   1
Time: 17:51 PM            Shared Pool Utilization           SYSTEM
                            whoville database
users                Non-Shared SQL Shared SQL     Percent Shared
-------------------- -------------- -------------- --------------
WHOAPP                  532,097,982      1,775,745           .333
SYS                       5,622,594      5,108,017         47.602
DBSNMP                      678,616        219,775         24.463
SYSMAN                      439,915      2,353,205         84.250
SYSTEM                      425,586         20,674          4.633
-------------        -------------- -------------- --------------
5                       541,308,815      9,502,046          1.725
Figure 2: Example report output for poor code reuse
As you can see from Figure 2 the majority owner in this application, WHOAPP is only showing 0.3 percent of reusable code by memory usage and is tying up an amazing 530 megabytes with non-reusable code! Let’s look at a database with good reuse statistics. Look at Figure 3.
Date: 11/13/05                                              Page:   1
Time: 03:15 PM            Shared Pool Utilization           PERFSTAT      
                            dbaville database                                 
                                                                          
users                Non-Shared SQL Shared SQL     Percent Shared         
-------------------- -------------- -------------- --------------         
DBAVILLAGE                9,601,173     81,949,581         89.513         
PERFSTAT                  2,652,827        199,868          7.006         
DBASTAGER                 1,168,137     35,468,687         96.812         
SYS                          76,037      5,119,125         98.536         
-------------        -------------- -------------- --------------         
4                        13,498,174    122,737,261         90.092  

Figure 3: Example of Good Sharing of Code
Notice in Figure 3 how the two application owners, DBAVILLAGE and DBASTAGER show 89.513 and 96.812 reuse percentage by memory footprint for code.
So what else can we look at to see about code reusage, the above reports give us a gross indication, how about something with a bit more usability to correct the situation? The V$SQLAREA and V$SQLTEXT views give us the capability to look at the current code in the shared pool and determine if it is using, or not using bind variables. Look at Figure 4.
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
set lines 140 pages 55 verify off feedback off
col num_of_times heading 'Number|Of|Repeats'
col SQL heading 'SubString - &&chars Characters'
col username format a15 heading 'User'
@title132 'Similar SQL'
spool rep_out\&db\similar_sql&&chars
select b.username,substr(a.sql_text,1,&&chars) SQL,
count(a.sql_text) num_of_times from v$sqlarea a, dba_users b
where a.parsing_user_id=b.user_id
group by b.username,substr(a.sql_text,1,&&chars) having count(a.sql_text)>&&num_repeats
order by count(a.sql_text) desc
/
spool off
undef chars
undef num_repeats
clear columns
set lines 80 pages 22 verify on feedback on
ttitle off

Figure 4: Similar SQL report code
Figure 4 shows a simple script to determine, based on the first x characters (input when the report is executed) the number of SQL statements that are identifical up to the first xcharacters. This shows us the repeating code in the database and helps us to track down the offending statements for correction.                                                                                                                
As you can see from Figure 5, the SQL text is pinpointed that needs fixing. Using a substring from the above SQL the V$SQLTEXT view can be used to pull an entire listing of the code.
Some may be asking: “What is a bind variable?” simply put, a bind variable is a variable inserted into the SQL code in the place of literal values. For example:
SELECT * FROM whousers WHERE first_name=’ANNA’;
Is not using bind variables. If we issued a second query:
SELECT * FROM whousers WHERE first_name=’GRINCH’;
Even though the queries are identical until the last bit where we specify the name, the Oracle query engine would treat them as two different queries. By using bind variables, as shown below, we allow Oracle to parse the statement once and reuse it many times.
SELECT * FROM whousers WHERE first_name=:whoname;
The colon in front of the variable “whoname” tells Oracle this is a bind variable that will be supplied at run time.  
So, the proper fix for non-bind variable usage is to re-write the application to use bind variables. This of course can be an expensive and time consuming process, but ultimately it provides the best fix for the problem. However, what if you can’t change the code? Maybe you have time, budget or vendor constraints that prevent you from being able to do the “proper” thing. What are your options?
Oracle has provided the CURSOR_SHARING initialization variable that will automatically replace the literals in your code with bind variables. The settings for CURSOR_SHARINGare EXACT (the default), FORCE, and SIMILAR.
·        EXACT – The statements have to match exactly to be reusable
·        FORCE – Always replace literals
·        SIMILAR – Perform literal peeking and replace when it makes sense
We usually suggest the use of the SIMILAR option for CURSOR_SHARING. You can tell if cursor sharing is set to FORCE or SIMILAR by either using the SHOW PARAMETER CURSOR_SHARING command or by looking at the code in the shared pool, if you see code that looks like so:
SELECT USERNAME FROM whousers WHERE first_name=:"SYS_B_0"
This tells you that CURSOR_SHARING is set to either FORCE or SIMILAR because of the replacement variable :”SYS_B_O”.
Improper Index Usage
In the good old days Oracle followed the rule based optimizer (RBO) and the rule based optimizer followed essentially one simple premise from which it’s rules were devised:
INDEXES GOOD! FULL TABLE SCANS BAD!
Unfortunately this simple rule basis led to many less than optimal execution plans so SQL tuners spent a lot of time doing things such as null value concatenation or 0/1 math (add zero, or multiple by 1) to eliminate index usage. Of course now we have the cost based optimizer (CBO) which always gives us the correct path…not!
In essence we now have to look for full table scans and examine the table size, available indexes and other factors to determine if the CBO has made the proper choice. In most cases where improper full table scans are occurring I have generally found that missing or improper indexes were the cause, not the optimizer.
Pre-9i determining full table scans was either done live by looking for full table scan related waits and backtracking to the objects showing the waits (as shown in Figure 6) or by periodically stripping the SQL from the V$SQLTEXT or V$SQLAREA views and performing explain plan commands on them into a table. The table was then searched for the plans that showed full table accesses. Neither of these were particularly user friendly.
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
rem fts_rep.sql
rem FUNCTION: Full table scan report
rem MRA
rem
col sid format 99999
col owner format a15
col segment_name format a30
col td new_value rep_date noprint
select to_char(sysdate,'ddmonyyhh24mi') td from dual;
@title80 'Full Table Scans &rep_date'
spool rep_out\&db\fts_rep_&rep_date
SELECT DISTINCT A.SID,
C.OWNER,
C.SEGMENT_NAME
FROM SYS.V_$SESSION_WAIT A,
SYS.V_$DATAFILE B,
SYS.DBA_EXTENTS C
WHERE A.P1 = B.FILE# AND
B.FILE# = C.FILE_ID AND
A.P2 BETWEEN C.BLOCK_ID AND
(C.BLOCK_ID + C.BLOCKS) AND
A.EVENT = 'db file scattered read';
spool off
ttitle off
Figure 6: Example Realtime report to obtain object undergoing full table scans
You will be happy to know that starting with Oracle9i there is a new view that keeps the explain plans for all current SQL in the shared pool, this view, appropriately named V$SQL_PLAN allows DBAs to determine exactly what statements are using full table scans and more importantly how often the particular SQL statements are being executed. An example report against the V$SQL_PLAN table is shown in Figure 7.
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
rem fts report
rem based on V$SQL_PLAN table
col operation format a15
col object_name format a32
col object_owner format a15
col options format a20
col executions format 999,999,999
set pages 55 lines 132 trims on
@title132 'Full Table/Index Scans'
spool rep_out\&&db\fts
select a.object_owner,a.object_name, rtrim(a.operation) operation,
a.options, b.executions from v$sql_plan a, v$sqlarea b
where
SEE CODE DEPOT FOR FULL SCRIPT
and a.operation IN ('TABLE ACCESS','INDEX')
and a.options in ('FULL','FULL SCAN','FAST FULL SCAN','SKIP SCAN','SAMPLE FAST FULL SCAN')
and a.object_owner not in ('SYS','SYSTEM','PERFSTAT')
group by object_owner,object_name, operation, options
order by object_owner, operation, options, object_name
/
spool off
set pages 20
ttitle off
Figure 7: Example SQL to get full table scan data from database
Notice that I didn’t limit myself to just full table scans, I also looked for expensive index scans as well. An example excerpt from this report is shown in Figure 8.
 
Date: 11/09/04                                                                             Page:   1
Time: 08:31 PM                            Full Table/Index Scans                            PERFSTAT
                                             whoemail database
 
HASH_VALUE OWNER  OBJECT_NAME               OPERATION     OPTIONS        EXECUTIONS    BYTES FTS_MEG
---------- ------ ------------------------- ------------- -------------- ---------- -------- -------
4278137387 SDM    DB_STATUS                 TABLE ACCESS  FULL               30,303  1048576   30303
1977943106 SDM    DB_STATUS                 TABLE ACCESS  FULL                1,863  1048576    1863
3391889070 SDM    FORWARD_RECIPIENTS        TABLE ACCESS  FULL               29,785  4194304  119140
1309516963 SDM    FORWARD_RECIPIENTS        TABLE ACCESS  FULL                3,454  4194304   13816
4017881007 SDM    GLOBAL_SUPPRESSION_LIST   TABLE ACCESS  FULL              168,020  1048576  168020
3707567343 SDM    ORGANIZATION2             TABLE ACCESS  FULL                6,008  1048576    6008
1705069780 SDM    SP_CAMPAIGN_MAILING       TABLE ACCESS  FULL                1,306 10485760   13060
1047433976 SDM    SS_LAST_SENT_JOB          TABLE ACCESS  FULL              572,896  1048576  572896
3556187438 SDM    SS_LAST_SENT_JOB          TABLE ACCESS  FULL              572,896  1048576  572896
3207589632 SDM    SS_SEND                   TABLE ACCESS  FULL               32,275 20971520  645500
 788044291 SDM    SS_SENDJOBSTATUSTYPE_NNDX INDEX         FAST FULL SCAN     25,655 20971520  513100
1417625610 SDM    SS_SENDJOBSTATUSTYPE_NNDX INDEX         FAST FULL SCAN     11,802 20971520  236040
2719565392 SDM    SS_SENDJOBSTATUSTYPE_NNDX INDEX         FAST FULL SCAN     11,379 20971520  227580
1533235337 SDM    SS_SENDJOBSTATUSTYPE_NNDX INDEX         FAST FULL SCAN     10,981 20971520  219620
3273441234 SDM    SS_SENDJOBSTATUSTYPE_NNDX INDEX         FAST FULL SCAN     10,594 20971520  211880
1823729862 SDM    SS_TASK_OWNER_NNDX        INDEX         FULL SCAN           3,992 10485760   39920
3673286081 SDM    SYSTEM_SEED_LIST          TABLE ACCESS  FULL               81,249  1048576   81249
   4712038 SDM    TRACK_OPEN_MRRJ_LOCK_NNDX INDEX         FULL SCAN          11,159 62914560  669540
3797121012 SDM    TRACK_OPEN_MRRJ_LOCK_NNDX INDEX         FULL SCAN          11,159 62914560  669540
1624438202 SDM    TRACK_RAW_OPEN            TABLE ACCESS  FULL               29,786 31457280  893580
4232130615 SDM    TRACK_RAW_OPEN            TABLE ACCESS  FULL               29,786 31457280  893580
3109457251 SDM    TRACK_RAW_OPEN            TABLE ACCESS  FULL               29,785 31457280  893550
3391889070 SDM    TRACK_RAW_OPEN            TABLE ACCESS  FULL               29,785 31457280  893550
1309516963 SDM    TRACK_RAW_OPEN            TABLE ACCESS  FULL                3,454 31457280  103620
3685251647 SDM    TR_M_TOP_DOMAINS          TABLE ACCESS  FULL                5,925 10485760   59250
2318926907 SDM    TR_R_CLICKSTREAM          TABLE ACCESS  FULL                1,155 10485760   11550
 804017134 SDM    TR_R_OPTOUT               TABLE ACCESS  FULL                2,375 10485760   23750
3707567343 SDM    USER_INFO                 TABLE ACCESS  FULL                6,008 10485760   60080
3328028760 SDM    VIRTUAL_MTA_LOOKUP_PK     INDEX         FAST FULL SCAN     43,265  1048576   43265
1150816681 SDM    VIRTUAL_MTA_LOOKUP_PK     INDEX         FAST FULL SCAN     20,193  1048576   20193

Figure 8: Example output from FTS Report.
Notice instead of trying to capture the full SQL statement I just grab the HASH value. I can then use the hash value to pull the interesting SQL statements using SQL similar to:
select sql_text
from v$sqltext
where hash_value=&hash
order by piece;
Once I see the SQL statement I use SQL similar to this to pull the table indexes:
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
set lines 132
col index_name form a30
col table_name form a30
col column_name format a30
select a.table_name,a.index_name,a.column_name,b.index_type
from dba_ind_columns a, dba_indexes b
where a.table_name =upper('&tab')
and a.table_name=b.table_name
and a.index_owner=b.owner
and a.index_name=b.index_name
order by a.table_name,a.index_name,a.column_position
/
set lines 80

Once I have both the SQL and the indexes for the full scanned table I can usually quickly come to a tuning decision if any additional indexes are needed or, if an existing index should be used. In some cases there is an existing index that could be used of the SQL where rewritten. In that case I will usually suggest the SQL be rewritten. An example extract from a SQL analysis of this type is shown in Figure 9.

SQL> @get_it
Enter value for hash: 605795936
 
SQL_TEXT
----------------------------------------------------------------
DELETE FROM BOUNCE WHERE UPDATED_TS < SYSDATE - 21
 
1 row selected.
 
SQL> @get_tab_ind
Enter value for tab: bounce
TABLE_NAME   INDEX_NAME                 COLUMN_NAME    INDEX_TYPE
------------ -------------------------- -------------- ----------
BOUNCE       BOUNCE_MAILREPRECJOB_UNDX  MAILING_ID     NORMAL
BOUNCE       BOUNCE_MAILREPRECJOB_UNDX  RECIPIENT_ID   NORMAL
BOUNCE       BOUNCE_MAILREPRECJOB_UNDX  JOB_ID         NORMAL
BOUNCE       BOUNCE_MAILREPRECJOB_UNDX  REPORT_ID      NORMAL
BOUNCE       BOUNCE_PK                  MAILING_ID     NORMAL
BOUNCE       BOUNCE_PK                  RECIPIENT_ID   NORMAL
BOUNCE       BOUNCE_PK                  JOB_ID         NORMAL
 
7 rows selected.

As you can see here there is no index on UPDATED_TS

SQL> @get_it
Enter value for hash: 3347592868
 
SQL_TEXT
----------------------------------------------------------------
SELECT VERSION_TS, CURRENT_MAJOR, CURRENT_MINOR, CURRENT_BUILD,
CURRENT_URL, MINIMUM_MAJOR, MINIMUM_MINOR, MINIMUM_BUILD, MINIMU
M_URL, INSTALL_RA_PATH, HELP_RA_PATH FROM CURRENT_CLIENT_VERSION
 
 
4 rows selected.

Here there is no WHERE clause, hence a FTS is required.

SQL> @get_it
Enter value for hash: 4278137387
 
SQL_TEXT
----------------------------------------------------------------
SELECT STATUS FROM DB_STATUS WHERE DB_NAME = 'ARCHIVE'
 
1 row selected.
 
SQL> @get_tab_ind
Enter value for tab: db_status
 
no rows selected
 
Yep, no indexes will cause a FTS everytime…
Figure 9: Example SQL Analysis

Of course even after you come up with a proposed index list you must thoroughly test them in a test environment as they may have other “side-effects” on other SQL statements, it would be a shame to improve the performance of one statement and shoot six others in the head.
Improper Memory Configuration
If you put too-small a carburetor on a car then even though the engine may be able to do 200 MPH, you are constraining it to much less performance. Likewise if you do not give enough memory to Oracle you will prevent it from reaching its full performance potential.
In this section we will discuss two major areas of memory, the database buffer area and the shared pool area. The PGA areas are discussed in a later section.
The Database Buffer Area
Just like the old adage you can’t fly anywhere unless you go through Atlanta, you aren’t going to get data unless you go through the buffer. Admittedly there are some direct-read scenarios, but for the most part anything that goes to users or gets into the database must go through the database buffers.
Gone are the days of a single buffer area (the default) now we have 2, 4, 8,, 16, 32 K buffer areas, keep and recycle buffer pools on top of the default area. Within these areas we have the consistent read, current read, free, exclusive current, and many other types of blocks that are used in Oracle’s multi-block consistency model.
The V$BH view (and it’s parent the X$BH table) are the major tools used by the DBA to track block usage, however, you may find that the data in the V$BH view can be misleading unless you also tie in block size data. Look at Figure 10.
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
rem vbh_status.sql
rem
rem Mike Ault -- Burleson
rem
col dt new_value td noprint
select to_char(sysdate,'ddmmyyyyhh24miss') dt from dual;
@title80 'Status of DB Block Buffers'
spool rep_out\&db\vbh_status&&td
select status,count(*) number_buffers from v$bh group by status;
spool off
ttitle off
clear columns
Figure 10: Simple V$BH Report
In the report in Figure 10 we see a simple version of a V$BH query. Figure 10 assumes only one buffer is in play, the default buffer, and doesn’t account for any of the multiple blocksize areas or the recycle or keep areas. By not accounting for other types of buffers that may be present the report in Figure 10 can overstate the number of free buffers available. Look at Figure 11.
     
                                                                           
STATU NUMBER_BUFFERS                                                      
----- --------------                                                      
cr             33931                                                       
free           15829                                                      
xcur          371374                                               

Figure 11: Simple V$BH report listing

From the results in Figure 11 we would conclude we had plenty of free buffers, however we would be mistaken. Look at the report in Figure 12.
            
STATUS           NUM                                                      
--------- ----------                                                       
32k cr          2930                                                      
32k xcur       29064                                                      
8k cr           1271                                                       
8k free            3                                                      
8k read            4                                                      
8k xcur       378747                                                      
free           10371               

Figure 12: Detailed V$BH Status report
As you can see, while there are free buffers, only 3 of them are available to the 8k, default area and none are available to our 32K area. The free buffers are actually assigned to a keep or recycle pool area (hence the null value for the blocksize) and are not available for normal usage. The script to generate this report is shown in Figure 13.
For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
set pages 50
@title80 'All Buffers Status'
spool rep_out\&&db\all_vbh_status
select
  '32k '||status as status,
  count(*) as num
from
 v$bh
where file# in(
   select file_id
     from dba_data_files
     where tablespace_name in (
       select tablespace_name
        from dba_tablespaces
        where block_size=32768))
group by '32k '||status
union
select
  '16k '||status as status,
   count(*) as num
from
 v$bh
where
  file# in(
   select file_id
    from dba_data_files
    where tablespace_name in (
      select tablespace_name
       from dba_tablespaces
       where block_size=16384))
group by '16k '||status
union
select
  '8k '||status as status,
  count(*) as num
from
  v$bh
where
  file# in(
   select file_id
    from dba_data_files
    where tablespace_name in (
      select tablespace_name
       from dba_tablespaces
       where block_size=8192))
group by '8k '||status
union
select
  '4k '||status as status,
  count(*) as num
from
 v$bh
where
 file# in(
  select file_id
   from dba_data_files
   where tablespace_name in (
     select tablespace_name
     from dba_tablespaces
     where block_size=4096))
group by '4k '||status
union
select
  '2k '||status as status,
  count(*) as num
from
  v$bh
where
 file# in(
  select file_id
   from dba_data_files
   where tablespace_name in (
    select tablespace_name
    from dba_tablespaces
    where block_size=2048))
group by '2k '||status
union
select
  status,
  count(*) as num
from
  v$bh
where status='free'
group by status
order by 1
/
spool off
ttitle off
Figure 13: Script to get all Buffer Pool Status
As you can see, the script is wee bit more complex than the simple V$BH script. No doubt there is a clever way to simplify the script using X and K$ tables, but then we would have to use the SYS user to run it and I prefer to use lower powered users when I go to client sites.
So, if you see buffer busy waits, db block waits and the like and you run the above report and see no free buffers it is probably a good bet you need to increase the number of available buffers for the area showing no free buffers. You should not immediately assume you need more buffers because of buffer busy waits as these can be caused by other problems such as row lock waits, itl waits and other issues.
Luckily Oracle10g has made it relatively simple to determine if we have these other types of waits. Look at Figure 14.
 For complete scripts, see my complete Oracle script collection at www.dba-oracle.com/oracle_scripts.htm.
-- Crosstab of object and statistic for an owner
--
col "Object" format a20
set numwidth 12
set lines 132
set pages 50
@title132 'Object Wait Statistics'
spool rep_out\&&db\obj_stat_xtab
select * from(
select DECODE(GROUPING(a.object_name), 1, 'All Objects',
      a.object_name) AS "Object",
sum(case when a.statistic_name = 'ITL waits'
then a.value else null end) "ITL Waits",
sum(case when a.statistic_name = 'buffer busy waits'
then a.value else null end) "Buffer Busy Waits",
sum(case when a.statistic_name = 'row lock waits'
then a.value else null end) "Row Lock Waits",
sum(case when a.statistic_name = 'physical reads'
then a.value else null end) "Physical Reads",
sum(case when a.statistic_name = 'logical reads'
then a.value else null end) "Logical Reads"
SEE CODE DEPOT FOR FULL SCRIPT
where a.owner like upper('&owner')
group by rollup(a.object_name)) b
where (b."ITL Waits">0 or b."Buffer Busy Waits">0)
/
spool off
clear columns
ttitle off

Figure 14: Object Statistic Crosstab Report

Figure 14 shows an object statistic cross tab report based on the V$SEGMENT_STATISTICS view. The cross tab report generates a listing showing the statistics of concern as headers across the page rather than listings going down the page and summarizes them by object. This allows us to easily compare total buffer busy waits to the number of ITL or row lock waits. This ability to compare the ITL and row lock waits to buffer busy waits lets us see what objects may be experiencing contention for ITL lists, which may be experiencing excessive locking activity and through comparisons, which are highly contended for without the row lock or ITL waits. An example of the output of the report, edited for length, is shown in Figure 15.

                                  
ITL Buffer Busy Row Lock Physical Logical
Object Waits       Waits    Waits     Reads Reads                    
-------------- ----- ----------- -------- ---------- -----------
BILLING 0 63636 38267 1316055 410219712
BILLING_INDX1 1 16510 55 151085 21776800
...
DELIVER_INDX1 1963 36096 32962 1952600 60809744
DELIVER_INDX2 88 16250 9029 18839481 342857488                      
DELIVER_PK 2676 99748 29293 15256214 416206384
DELIVER_INDX3 2856 104765 31710 8505812 467240320
...
All Objects 12613 20348859 1253057 1139977207 20947864752

243 rows selected.


Figure 15: Example Object Cross Tab Report

In the above report the BILLING_INDX1 index has a large number of buffer busy waits but we can’t account for them from the ITL or Row lock waits, this indicates that the index is being constantly read and the blocks then aged out of memory forcing waits as they are re-read for the next process. On the other hand, almost all of the buffer busy waits for the DELIVER_INDX1 index can be attributed to ITL and Row Lock waits.
In situations where there are large numbers of ITL waits we need to consider the increase of the INITRANS setting for the table to remove this source of contention. If the predominant wait is row lock waits then we need to determine if we are properly using locking and cursors in our application (for example, we may be over using the SELECT…FOR UPDATE type code.) If, on the other hand all the waits are un-accounted for buffer busy waits, then we need to consider increasing the amount of database block buffers we have in our SGA.

As you can see, this object wait cross tab report can be a powerful addition to our tuning arsenal.

By knowing how our buffers are being used and seeing exactly what waits are causing our buffer wait indications we can quickly determine if we need to tune objects or add buffers, making sizing buffer areas fairly easy.

But what about the Automatic Memory Manager in 10g? It is a powerful tool for DBAs with systems that have a predictable load profile, however if your system has rapid changes in user and memory loads then AMM is playing catch up and may deliver poor performance as a result. In the case of memory it may be better to hand the system too much rather than just enough, just in time (JIT).
As many companies have found when trying the JIT methodology in their manufacturing environment it only works if things are easily predictable.
The AMM is utilized in 10g by setting two parameters, the SGA_MAX_SIZE and the SGA_TARGET. The Oracle memory manager will size the various buffer areas as needed within the range between base settings or SGA_TARGET and SGA_MAX_SIZE using the SGA_TARGET setting as an “optimal” and the SGA_MAX_SIZE as a maximum with the manual settings used in some cases as a minimum size for the specific memory component.
 








Please check with Manuals. Author is NOT responsible for any misinformation / incorrect information or typographical errors.

NOTE: If you would like to share any useful info, please mail to the authors.

Ganex Improves .. Headline Animator