Monday, March 28, 2011

Estimating Database Table Size


Sql>analyze table PRODUCTcompute statistics;

Sql> select extent_id, bytes, blocks
from user_extents
where segment_name = 'PRODUCT'
and segment_type = 'TABLE'

0 1048576 128
1 1048576 128
2 1048576 128

Sql> select blocks, empty_blocks,
avg_space, num_freelist_blocks
from user_tables
where table_name = 'PRODUCT'

376 8 1021 0

the above shows us:
• we have 128*3(384) blocks allocated to the table
• 8 blocks are totally empty
• 376 block contains data (the other block is used by the system)
• we have an average of about 1k(1021, AVG_SPACE) free on each block used.

Therefore, our table ('FMT027T')

• consumes 376 block
• of which 376block * 8k blocksize - 8 block * 1k free = 3000k is used for our data.

Another Simple SQL is

select sum(bytes) from user_segments where segment_name = 'PRODUCT';

Faces UI field validation

To validate an individual UI field from Faces Side(Mostly for POJO Trees) and dis-allow user to submit the form with Save button, 2 things you need to do
In JSFF, for the UI component, add a Validator Method as below

                <af:inputText value="#{node.Email}" id="i21"

In ManagedBean, add the logic like this

    public void ValidatorEmail(FacesContext facesContext,
UIComponent uIComponent, Object object) {
FacesContext fc = FacesContext.getCurrentInstance();
String email = (String)object;
if (email != null && !email.contains("@")) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "The Email Id must contain @","The Email Id must contain @");

This wont allow to submit the form unless user rectifies the validation error, because the UIComponent's state is invalid.

Tuesday, March 15, 2011

adf-config.xml caching-rules

<caching-rules xmlns="">
<caching-rule id="cache-js">
<caching-rule id="cache-png">
<caching-rule id="cache-css">

Sunday, March 13, 2011

Increasing file upload size using af:inputFile

<description>Max size of a file that will be uploaded in ram (10MB)</description>
<description>Max size of a file that will be uploaded on HDD (100MB)</description>
<description>The path of the dir where the files will be uploaded</description>