5/15/08

Try Asterisk on Ubuntu Hardy

I try install asterisk server on ubuntu hardy from repos. The 'asterisk-sounds-extra' is for testing sound[locate in /usr/share/asterisk/sounds/].

pnix@v400ast:~$ sudo aptitude install asterisk  asterisk-sounds-extra
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following NEW packages will be automatically installed:
asterisk-config asterisk-sounds-main build-essential debhelper dpkg-dev g++ g++-4.2
gettext html2text intltool-debian libc-client2007 libc6-dev libcompress-raw-zlib-perl
libcompress-zlib-perl libct3 libdigest-hmac-perl libdigest-sha1-perl libfile-remove-perl
libgsm1 libiksemel3 libio-compress-base-perl libio-compress-zlib-perl libio-stringy-perl
libmail-box-perl libmail-sendmail-perl libmailtools-perl libmime-types-perl
libobject-realize-later-perl libpq5 libpri1.0 libradiusclient-ng2 libstdc++6-4.2-dev
libtimedate-perl libtonezone1 libuser-identity-perl libvpb0 linux-libc-dev mlock
module-assistant odbcinst1debian1 patch po-debconf unixodbc vpb-driver-source
The following NEW packages will be installed:
asterisk asterisk-config asterisk-sounds-extra asterisk-sounds-main build-essential
debhelper dpkg-dev g++ g++-4.2 gettext html2text intltool-debian libc-client2007
libc6-dev libcompress-raw-zlib-perl libcompress-zlib-perl libct3 libdigest-hmac-perl
libdigest-sha1-perl libfile-remove-perl libgsm1 libiksemel3 libio-compress-base-perl
libio-compress-zlib-perl libio-stringy-perl libmail-box-perl libmail-sendmail-perl
libmailtools-perl libmime-types-perl libobject-realize-later-perl libpq5 libpri1.0
libradiusclient-ng2 libstdc++6-4.2-dev libtimedate-perl libtonezone1
libuser-identity-perl libvpb0 linux-libc-dev mlock module-assistant odbcinst1debian1
patch po-debconf unixodbc vpb-driver-source
0 packages upgraded, 46 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.5MB of archives. After unpacking 73.8MB will be used.
Do you want to continue? [Y/n/?] y
...
Building tag database... Done
pnix@v400ast:~$

After finish, try to connect to asterisk
pnix@v400ast:~$ sudo asterisk -rvvv
Asterisk 1.4.17~dfsg-2ubuntu1, Copyright (C) 1999 - 2007 Digium, Inc. and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
This package has been modified for the Debian GNU/Linux distribution
Please report all bugs to http://bugs.debian.org/asterisk
=========================================================================
== Parsing '/etc/asterisk/asterisk.conf': Found
== Parsing '/etc/asterisk/extconfig.conf': Found
Connected to Asterisk 1.4.17~dfsg-2ubuntu1 currently running on v400ast (pid = 5041)
Verbosity is at least 3
v400ast*CLI>

Well.. basic installation is very smooth. I try adding sip account and test dialplan to play 'welcome' sound and it working fine too. May be i will use this to be my production server instead of trixbox if I succeed on compiling rhino driver on ubuntu.

Fixing sendmail take a long time to start

I notice that my database box[FC6+Oracle10.2] take along time to startup. Sendmail and sm-client very very slow to start[ about 5 minutes ]. There's something wrong in /etc/hosts file. 'newalises' command take long time to update and finish with error below.

[root@ora10g ~]# newaliases
WARNING: local host name (ora10g) is not qualified; see cf/README: WHO AM I?
/etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
[root@ora10g ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.55 ora10g
[root@ora10g ~]#

To fix this, custom hostname[ora10g] need to append to localhost line in /etc/hosts.
[root@ora10g ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost ora10g
192.168.1.55 ora10g
[root@ora10g ~]# newaliases
/etc/aliases: 76 aliases, longest 10 bytes, 765 bytes total
[root@ora10g ~]#

5/9/08

Using Datapump on oracle 10g to export/import

This will be update version of this post if you are using oracle 10g or 11g.

Last month I post about export/import data in oracle using exp,imp utility. Actually oracle has something newer and better performance if you're using 10g or 11g.

Assume that we want to export one table from one oracle db and import it into another oracle db. So create the folder /home/oracle/dbbackup on two oracle db server to store <.dmp> file[that will be created when exporting and importing].

Next, we need to tell oracle to know this folder, create directory on both db by run command below in sqlplus
SQL> create directory dmpdir as '/home/oracle/dbbackup';

Directory created.

SQL>

Now on source database export table with command below.
[oracle@k8n ~]$ expdp username/password DIRECTORY=dmpdir DUMPFILE=filename.dmp TABLES=tablename

Export: Release 10.1.0.3.0 - Production on Friday, 09 May, 2008 10:54
...
[oracle@k8n ~]$

after finish you will have filename.dmp in /home/oracle/dbbackup, ftp it to the target box make sure you are using binary mode.
Then on target database import the table like this.
[oracle@dbp4 ~]$ impdp username/password DIRECTORY=dmpdir DUMPFILE==filename.dmp TABLES=tablename

Import: Release 10.2.0.1.0 - Production on Friday, 09 May, 2008 11:02:27
...
[oracle@dbp4 ~]$

That's it. Note that up there exporting from 10.1.0.3.0 and importing into 10.2.0.1.0 is ok but down version import[e.g. expdp with higher version and impdp with lower version]is not, you will get error like this
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31619: invalid dump file "/home/oracle/dbbackup/filename.dmp"

To fix this error, expdp command must append with 'version=10.target.version'.

more detail about expdp/impdp tool
expdp help=yes
impdp help=yes

5/6/08

Single user mode in fedora core

Again that electricity in area of Sukhumvit road, Bangkok down yesterday night. This time one database refuse to boot it freeze at "Starting system logger:". Look like there's no way to get a shell from any normal run level startup.

Not like ubuntu that has recovery mode in grub menu. This box is fedora core, I know there's a way to get in to single user mode by pass kernel parameter at grub boot menu [but can not remember how to at that time:(].

After some googling I found the way. To get single user mode in FC, at grub menu press a [to append kernel parameter]. Now add s to tell fedora kernel that you want single user mode. After finish, enter to continue booting.

Now you will get root shell and can figure out what wrong with your system then fix it. In my case now I just want Oracle to come up so i need atleast two service 'network' and 'oracle'. Try to bring it up by run these two command and pray.

sh-3.00# service network start
sh-3.00# service oracle start

Not too bad that this time network and oracle are come up successfully:). But why syslogd startup caused system freeze is still no idea:(.