Thursday, December 18, 2014

Unknown table engine 'InnoDB'

In the name of Allah, Most Gracious, Most Merciful.

In this article i will be discussing solution for Mysql engine corruption. Some time it happens that 'InnoDB' engine become unavailable and you will get "Unknown table engine 'InnoDB'" error while accessing a table based on 'InnoDB' engine. You can see supported database engines by using following command.

mysql> show engines;

If 'InnoDB' engine is missing from this list then you need to do following steps to bring it back online. Login with root user and execute following.

$ service mysqld stop

Shutting down MySQL.   [  OK  ]

Now find the mysql log file location and remove the log files. If you don't know the location, you can check /var/lib/mysql and delete following files

$ cd /var/lib/mysql  
$ rm -f ib_logfile0 ib_logfile1

Now kill any mysql running processes. you can find the process id and use kill command to kill them.

$ ps aux | grep mysql
$ kill -9 xxx

replace xxx with process id of mysql. Once done, start mysql

$ service mysqld start
Starting MySQL...............................              [  OK  ]

mysql> show engines;

Now it should list InnDB engine.

I hope it will serve the purpose.


Tuesday, May 13, 2014

How to setup file-based swap space on CentOS

In the name of Allah, Most Gracious, Most Merciful

In this article i will be configuring file-based swap space on CentOS. We often need to have swap space for larger programs to run properly. You can have swap partition for this purpose and also file-based swap space. File-based swap space is a quick way to setup swap file system. This method is tested on CentOS 6.5 but will work on Redhat 6. 5 as well. Lets do it.

First we need to check current swap space configured on system. Use following command to check it. You should be logged in as root user or use sudo with these commands.

swapon -s

It will print all swap file system, either file-based or partitioned-based. If nothing comes out then it means no swap space is configured. Lets add a 2GB file-based swap space.

dd if=/dev/zero of=/swapfile bs=1024 count=2048K

2097152+0 records in
2097152+0 records out
2147483648 bytes (2.1 GB) copied, 7.90701 s, 272 MB/s


if=/dev/zero means read from /dev/zero file which will provide null characters
of=/swapfile means write /dev/zero characters to this file.
bs=1024 means read and write 1024 bytes at a time
count=2048K means copy this many input blocks.

Lets make /swapfile a swap file system.

mkswap -f /swapfile

Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=5c109315-3512-45db-8771-a0ecd7ac11e1


Lets change ownership of this file to root and grant read and write permission to everyone.

chown root:root /swapfile
chmod 666 /swapfile

Lets activate this swap space and verify it.

swapon -a /swapfile
swapon -s

Filename                Type            Size    Used    Priority
/swapfile               file            2097144 0       -1


This swap space will only available as long as system is up and running, and is cleared on system reboot.

Lets make is permanent, we need to add it to /etc/fstab. add following line to end of /etc/fstab

/swapfile swap swap defaults 0 0



I hope it will serve the purpose.

Monday, March 11, 2013

How to configure Samba in Oracle Solaris 10

In the name of Allah, Most Gracious, Most Merciful

Samba comes installed with Oracle Solaris 10. We only have to configure it according to our needs. Following are steps to properly configure samba according to our needs.

You can verify that samba packages are already installed in Oracle Solaris 10 by following command.

1. pkginfo -x | grep -i samba

SUNWsmbac    samba - A Windows SMB/CIFS fileserver for UNIX (client)
SUNWsmbar    samba - A Windows SMB/CIFS fileserver for UNIX (Root)
SUNWsmbau    samba - A Windows SMB/CIFS fileserver for UNIX (Usr)


2. You can check the location of samba config file by following command

pkgchk -l SUNWsmbar | grep conf-example

Pathname: /etc/samba/smb.conf-example

3. Check current state of samba

svcs -a | grep samba

disabled       Feb_22   svc:/network/samba:default

4. Try to enable samba

svcadm enable samba

maintenance    10:27:33 svc:/network/samba:default

It is not enabled, but it is in maintenance mode. You can check the errors encountered while enabling samba by following command.

tail /var/adm/messages

mysystem svc.startd[8]: [ID 652011 daemon.warning] svc:/network/samba:default: Method "/usr/sbin/smbd -D" failed with exit status 1

It means samba failed to start, it most likely due to missing config file.

5. Now copy the sample config file and modify it

cp /etc/samba/smb.conf-example /etc/samba/smb.conf

By default config file is readonly, so make is right able by following command.

chmod 0777 /etc/samba/smb.conf

vi /etc/samba/smb.conf

Add following section in smb.conf file.

[myshare]
comment = My Share
force user = oracle
path = /u01/app/oracle
writeable = no
guest ok = yes


now save file and exit vi.

6. Now change the rights on smb.conf file as before

chmod 0444 /etc/samba/smb.conf

7. Now try to disable samba

svcadm disable samba
svcs -a | grep samba

disabled       10:41:49 svc:/network/samba:default


8. Now try to enable samba again

svcadm enable samba
svcs -a | grep samba

online         10:42:04 svc:/network/samba:default


9. Now set password for oracle user to use "myshare".

smbpasswd -a oracle

10. Now on windows try to map drive

net use O: \\192.168.1.20\myshare

Configuration of samba completes. In-sha-Allah this will help and serve the purpose. For any corrections and improvements please suggest.