GridPulse

as stimulating as black coffee and just as hard to sleep after.

Archive for October, 2007

Moving tables between tablespaces in Oracle

one comment

Well, sometimes you need to do it. My case is simple, a lot of tables created without specifying a tablespace, by a DBA-granted database user.

The procedure is quite straight forward, although it took me some time to figure it out. Because we were migrating to a new server, I considered it a good time to clean up the tablespaces, add some new indexes, partition some tables, so, the first step was to exp/imp the new data. So it’s tablespace time…

I created the new tablespaces, added the fat datafiles, and created the users. As the data was previously dumped, using the DBA user/s previously mentioned, and because a full dump takes about 4 hours, I was stuck using those dump files.

Because only a DBA user can import what another DBA user has previously exported, I had to grant my users DBA privileges. I imported the dump for the first user, giving him quota on his own tablespace, everything went OK. Moving on to importing the second user’s data I noticed something strange. The user’s tablespace was still empty, while the first user’s tablespace was filling up.

This was strange, as the second user didn’t have quota on the first user’s tablespace. I stopped the import, dropped the user and recreated. It took me 4 import attempts to figure out what was happening. Because the second user was a DBA, although he had no quota on the first user’s tablespace, he had unlimited tablespace system privilege. I revoked it and it magically worked.

So, the lesson I learned today is:

If you want to move tables from one tablespace/schema to another, using Oracle:

* export the data using exp
* create the new tablespace

* create the new user, assigning him the new tablespace, and correctly setting the quota to none on all other tablespaces and to unlimited on the target tablespace

* make sure he doesn’t have unlimited tablespace system privilege

* import using the new user using imp

Anyway, if you have a lot of data (in the millions of records), cleaning up your tablespaces, separating your indexes in another tablespace and partitioning your tables and indexes can improve performance by an order of magnitude.

Written by Bogdan

October 15th, 2007 at 7:46 pm

Posted in Development,RDBMS

How to deploy an artifact that uses classifiers and profiles with Maven

one comment

Sometimes, when one of your modules is used by different applications, but requires slight changes, you want to create different artifacts, that can be direct dependencies of those applications.

You can do this by using profiles and classifiers.

You can create your pom, the usual way, with profiles…more here, then apply classifiers to the package plugin inside your profile, like this:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>standalone</classifier>
</configuration>
</execution>
</executions>
</plugin>

This will produce an artifact with finalName

${artifactId}-${version}-${clasifier}

that will be accessible by specifying the classifier in your dependency.

Just remember to use executions because it will not work otherwise. It will build the artifacts, but will not deploy them.

Written by Bogdan

October 12th, 2007 at 4:18 pm

Posted in Development,Java

Improve your build system using Maven

leave a comment

Really!

I’ve been a Maven user since 2005, but only as a “user”, never creating build files, never really understanding the full picture.

I used to be a skeptic, but now I am fully converted. For the past 3 days I’ve been migrating the build process for a 15 module project from ant to Maven 2 and I have to admin that once you get past the dependency configuration, everything else is a breeze.

The build file size, maintaining every functionality, has decreased by two thirds, and is now more readable.

Everything from JiBX binding to build versioning is almost out of the box by using the plugin system. Plus, the Surefire plugin just works, no hassle there, running all tests with testng, although it’s slower than the direct testing I used to do with ant.

Anyway, it’s worth loosing two or three days, the benefits are huge.

Written by Bogdan

October 12th, 2007 at 11:52 am

Posted in Development,Java

Finished migrating

leave a comment

Finished migrating my stuff to WordPress.

It took me a while to decide what theme to use, and I found this nice one on hellobmw.com. As I only had a few lines to change in the header, the title and some meta I didn’t loose a lot of time, wich is a plus. A “thank you” goes to the creator of this theme. You can take a look at it on the LoseMyMind page.

The migration was quite straight-forward, even the post import from Blogger. I’m now waiting for Google to index my site again, so I can see what I missed.

Written by Bogdan

October 6th, 2007 at 2:22 pm

Posted in whatever