Thursday, December 2, 2010

An easy way to drop all existing objects from your Oracle Database..

If you are working with Oracle databases, there is a possibility that you come across this requirement where you need to drop all the existing objects such as Tables, Indexes, Triggers, etc. from your database. This is not going to be a big deal if you have system level privileges to the database as you can simply drop the user and then add him again so that it will simply do the trick. But if you are an ordinary user the aforementioned task often becomes tedious as you might want to drop those items one by one executing the appropriate queries.

But the following script makes the task easier as it produces a set of drop statements that can be used to drop all the objects existing in your database all at once. What you have to do is, simply run the following script using the console or your favourite query executer client(eg: executequery)and execute the drop statements produced by the script.

select 'drop '||object_type||' '|| object_name|| DECODE(OBJECT_TYPE,'TABLE',' CASCADE CONSTRAINTS;',';') from user_objects


After executing all the drop statements produced by the above script, just double check whether all the objects have been successfully dropped, by executing the following simple query.

select * from user_objects;

Wednesday, December 1, 2010

How to find invalid objects in your Oracle Database..

You can use the following Oracle script to observe the invalid objects that exist in your Oracle Database.

select object_name
from dba_objects
where object_type = 'object_type'
and status = 'INVALID';

The following example shows how to modify the above script to find out invalid TRIGGERs of the database.

select object_name
from dba_objects
where object_type = 'TRIGGER'
and status = 'INVALID';

Tuesday, November 30, 2010

How to setup JProfiler for Carbon products..

JProfiler is a popular profiling tool which helps developers monitor a huge number of parameters that are related to the execution of a particular program, such as memory usage, CPU usage, etc thereby providing the ability of identifying memory leaks, threading issues, etc.

The focus of this article is to provide you with an understanding of how to set up the environment for a WSO2 Carbon server to run a profile on it and observe the aforementioned parameters associated with its execution.

Here, I'm using WSO2 Data Service Server to demonstrate the above task on a Ubuntu 64-bit installed machine.

First, go to the bin folder of the distribution of WSO2 Data Service Server (or the intended Carbon Server) and open the server script which is used to run the server. i.e. wso2server.sh

Then, add the following line marked with red (which is automatically generated when you first install JProfiler on your machine) under the heading Execute The Requested Command, to the appropriate position as depicted below. 

NOTE: You need to replace "/home/djpro/Installations/" with the location in which the JProfiler is installed in your machine.


Configuring JProfiler locally, to create a new profile..

Step 1: Run the JProfiler application and click on the "Start Center" icon which is in the top left corner of the menu bar. Then the following window will pop up which will guide through the process of creating a new profiling session.


Step 2: Select "New Session" tab and then on the "New Session" button under the sub topic called "Main Configuration".

Step 3: Then, select the "Remote" radio button and enter the IP address(in this instance, it is 127.0.0.1) and the port(default is 8849) of the remote machine which runs JProfiler application. Then press "OK". Don't forget to enter an appropriate name for the session inside the "Session Name" text box.


Step 4: If you could successfully configure the JProfiler session up to this point, you will see the "Session Startup" window asking you to further edit start up attributes of the session.


Step 5: As the final step, run the desired Carbon server which has already been configured to be monitored and click on the "OK" button of the "Session Startup" window.



Now you should be able to successfully run the profiler session for your carbon product. :)

Saturday, November 27, 2010

Building WSO2 Carbon..

What is WSO2 Carbon?
Carbon is a modular platform built upon OSGi techonogy which is the base for each of the products of WSO2.

In this post, I'd like to discuss the methodology that requires to build wso2 carbon on your Ubuntu installed machine and a couple of tips to make the building and troubleshooting processes easy.

Intended platform :
Ubuntu

Check whether you've got the stuff :
Before you start the proceedings, you need to have some SVN client installed in your machine. I prefer subversion which you can download either by visiting their official site or using the following command on your console.


During this process it is intended to use Apache Maven as the build tool and you can download the latest distribution from the Maven site.

NOTE: Make sure you properly set up the environment for Maven before moving forward with the rest of the phases of this process.

Checking out the source code :
After you successfully installed subversion client you can checkout the source code of WSO2 carbon to the desired location of your machine using the following command.


Everything is ready??? Double check.. :)
If you have successfully checked out the source code from the wso2 repositary, you should be able to observe the following directory structure corresponds to the location to which you have checked out the source code in your machine.


Be careful.. :
When you go on with the task, you need to be mindful of the sequence which is required to follow while building WSO2 Carbon.

dependencies -> orbit -> core -> componenets -> features -> products

It is a must that you follow the aforementioned build sequence to ensure Carbon is built properly at the end of this process.

Let's build it :
Go to the desired directory from the console and use the following command to build the contents inside that particular directory.


Additionally, you can use the following set of commands to make the process much simpler depending upon the requirements

(i) To build Carbon in Offline mode:


(ii) To avoid building tests:


(iii) To carry out the build for only one product:


(iv)To make the process faster by introducing more threads to work on it:

NOTE: This is efficient when you do the build in Offline mode

At the end of the aforementioned process, you should be able to successfully build carbon.

If you encounter some error,
Step 1: Try taking a "svn update" from the repository and building it again.

Step 2: If that does not seem to work, drop a mail to carbon-dev@wso2.com to get support from the devs.

Saturday, October 2, 2010

A glimpse on "AB Learns To Blog"..

With the advancement of technology, various novel tools and techniques related to programming are frequently being introduced to the world. Hence, It is essential for software engineers, developers and other IT professionals to stay up-to-date with such new stuff in order to compete against the numerous challenges that are being created by the industry. The Techno-Hub is aiming towards unveiling and disseminating such information about those technologies among the people in the IT arena in the best possible manner. Not only that, Techno-Hub also contains details about various uncommon software installing mechanisms, troubleshooting mechanisms, etc that I experienced throughout my programming career.

With that short intro I would like to begin this journey and everybody is invited to guide me with your valuable ideas as they would greatly assist me in improving this blog as well as my career.