A blog by a system administrator and programmer.

Oracle moving index to another table space 
Tuesday, April 8, 2008, 05:04 PM - Programming
Posted by Freddy Chu
These days I am super busy. Nearly no time to write my blog. :(

There is so many people asking me how to move the index after created. As you know if you use plsql developer's GUI it will drop the constraint and add again with index. I don't know why it work like that but there is some simple solution.


Here also show you a simple procedure to move all index of a table from one tablespace to another tablespace.

create or replace procedure MOVE_INDEX_BETWEEN_TABLESPACE(from_ts in string,
to_ts in string,
tablename in string) is
cursor index_names is
select user_indexes.index_name
from user_indexes
where user_indexes.table_name like upper(tablename)
and user_indexes.tablespace_name = upper(from_ts);
index_name user_indexes.index_name%type;
open index_names;
fetch index_names
into index_name;
exit when index_names%notfound;
if index_name is not null and to_ts is not null then
end if;
end loop;

3 comments ( 238 views )   |  permalink   |   ( 3 / 958 )
Happy lunar new year~~ 
Sunday, February 10, 2008, 11:01 AM - General
Posted by Freddy Chu
This year I am lucky that I can have a good location to take photos. :D

For more photos please go to my gallery.

Fireworks 2008

4 comments ( 271 views )   |  permalink   |   ( 3 / 2003 )
Java disk usage 
Friday, January 11, 2008, 11:56 AM - Programming
Posted by Freddy Chu
It have been a long time for me to found a way to check the disk usage in Java.

Finially i get the solutions. It is in Java 6.0. java.io.File

There is 2 functions.

getTotalSpace() --- Returns the size of the partition named by this abstract pathname.
getUsableSpace() --- Returns the number of bytes available to this virtual machine on the partition named by this abstract pathname.

If your application is limited to use versions before 6.0. Then you can only keep using external commands.
Linux/Unix: df
Windows: fsutil volume diskfree c:

Alternative solutions for system independent solutions is to setup a snmp on the server you want to check and use java snmp client to query the result. That will be quite complex.

Useful links:
3 comments ( 244 views )   |  permalink   |   ( 3.1 / 1970 )
Happy New Year 2008 
Tuesday, January 1, 2008, 06:15 PM - General
Posted by Freddy Chu
Happy New Year to All :D

2 comments ( 307 views )   |  permalink   |   ( 2.9 / 2042 )
compile error of subversion 
Thursday, December 20, 2007, 06:27 PM - System
Posted by Freddy Chu
This problem usually exist in solaris 5.7

libtool[4766]: : is not an identifier
make: *** [subversion/svn/svn] Segmentation Fault. (core dumped)

Many people suggested to compile it as static link, then the problem will be solved. I have tried but without success. So that i start debug the compile code, lastly i found the problem is caused by ksh.


1. do configure as usual
2. replace all ksh to bash or sh in Makefiles and libtool
3. make

P.S. becareful of compile neon, db4, openssl, expat, apr, apr-util for solaris. It seems that gcc < 3.0 have some bugs in solaris system, you better compile them with shared flags
8 comments ( 228 views )   |  permalink   |   ( 3 / 7091 )
Compiler error in Solaris 
Monday, December 10, 2007, 10:36 PM - System
Posted by Freddy Chu
These days I have facing an error during compile DB4 in solaris 5.7.

when I am doing configure It shows
configure: error: C compiler cannot create executables

Here is the error in config.log.
configure:3855: found /usr/ucb/cc
configure:3866: result: cc
configure:3902: checking for C compiler version
configure:3909: cc --version >&5
/usr/ucb/cc: language optional software package not installed
configure:3912: $? = 1
configure:3919: cc -v >&5
/usr/ucb/cc: language optional software package not installed
configure:3922: $? = 1
configure:3929: cc -V >&5
/usr/ucb/cc: language optional software package not installed
configure:3932: $? = 1
configure:3955: checking for C compiler default output file name
configure:3982: cc -O -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS conftest.c >&5
/usr/ucb/cc: language optional software package not installed

I have googled for sometime but seems no any solutions. >"<

But suddently I think about tricky way. Changed the compiler

so that i export CC=gcc

It works lucky.

Do anybody know another way?
29 comments ( 1180 views )   |  permalink   |   ( 3 / 6020 )
syslog-ng concurrent connections exceeded 
Monday, November 19, 2007, 10:59 AM - System
Posted by Freddy Chu
These days I get a very funny warning in the syslog.

syslog-ng[4484]: Number of allowed concurrent connections exceeded; num='10', max='10'

I have googled it for a while, it seems is the default values of syslog-ng limited the concurrent connections of any stream device to 10.

It can simply sloved by increase the limit.

in syslog-ng.conf

unix-stream("/dev/log" max-connections(20));

10 comments ( 112 views )   |  permalink   |   ( 3 / 5897 )
Simple MySQL Replication HOWTO 
Thursday, November 1, 2007, 06:10 PM - System
Posted by Freddy Chu


* Slave server should be newer version than the master server. It is adviced that both servers are in same version
* Network port 3306 of both server should be avaliable
* log-bin is enabled


1. edit my.cnf to add log-bin and server-id, server-id should be unique and from 1 to 2^32 - 1.
server-id = 1

2. restart the mysql server both server if you have do many modification in step 1

3. create replicate user, if you are using MySQL before 4.0.2 replace "REPLICATION SLAVE" by "FILE"

4. lock all tables on master server


5. Copy all mysql files to the slave server

6. At master server run show master status, remember the file and position info

| File | Position | Binlog_do_db | Binlog_ignore_db |
| log-bin.002 | 189 | | |

7. At slave server run change master to use the account create in step 3 and info in step 6

8. run Slave start

9. unlock tables on master server


Now you will have a replicate MySQL server, just test to modify any records. :D
11 comments ( 216 views )   |  permalink   |   ( 3 / 5627 )
Mysql problems 
Saturday, October 27, 2007, 06:05 PM - System
Posted by Freddy Chu
Get Error 1033 "Incorrect information in file xxxx.frm" when run REPAIR

* Found a backup frm file if you can and overwrite the existing one
* If you do not have frm backup, you may need to find the original "create table" statement

1. Backup those table's frm, MYI, MYD first
2. use the original create table statement to create a new table with another name
3. overwrite the table's frm with the new table's frm
4. run REPAIR TABLE again

mysqldump: Got error: 1105: not found (Errcode: 24) when using LOCK TABLES

* this happens usually caused by open_files_limit too low
* edit my.cnf at [mysqld]" part

open_files_limit = 8192

* restart mysql server
11 comments ( 697 views )   |  permalink   |   ( 3 / 939 )
About my blog 
Thursday, October 25, 2007, 09:41 PM - General
Posted by Freddy Chu
It has been a long time that i want to have my own blog, but

I am really lazy....

I spent most of my in World of Warcraft in the past. I think i have spent almost around 2 years in the game. It is a good timing to leave the virtual world and put more time on work and study. :D

This blog is mainly about Unix servers and programming problems.

I will keep update it when i solve any interesting problems.

1 comment ( 123 views )   |  permalink   |   ( 2.9 / 2049 )

<<First <Back | 1 | 2 |