Tuesday, August 24, 2010

Sql query to list rowcount for all table in schema

Some times we face problems that require to find no. of rows in all tables in schema .

Following are sql queries that list table name and their row count,

For Microsoft SQL Server:
SELECT distinct(t.name) AS table_name,i.rows
FROM sys.tables AS t
INNER JOIN sys.sysindexes AS i ON t.object_id = i.id
 

For Oracle
select table_name,num_rows counter
from dba_tables 
where owner = 'XXX'
order by table_name;

Tuesday, August 17, 2010

Hotdeployment of properties file

Hi,
     In last month we faced another Internationalization problem with properties file hot deployment. Hot deployment is commonly used to deploy updates for live web-application.
    The problem was when we hot deployed web-app the messages of  new screen are not pulled from corresponding properties file. ResourceBundle unable to find new keys ,leading to all labels are showing keys. But when we restarted server the messages are shown perfectly.
     After analyzing we realized that the properties file are not reloaded after hot deployment while all other classes are reloaded properly.This is because of ResourceBundle class, it caches properties file on read and returns retrieve strings from cache. When the class redeployed this cache remain untouched.
     The solution to this to clear this cache. we added static block in our class to clear ResourceBundle cache.
following is the code we currently using :