How to Prepare AIX 6.1 for Oracle Install

June 22nd, 2009

First off, I’m not an Oracle DBA. But here are some of the things I did upon my DBA’s request, so that he can install Oracle.

1) Add user oracle and group dba. Edited the following files:

  • /etc/passwd
  • /etc/group
  • /etc/security/passwd

2) Edited the default ulimit and associated parameters.  In /etc/security/limits:

default:
fsize = -1
core = 2097151
cpu = -1
data = -1
rss = 65536
stack = 65536
nofiles = 20000

root:
fsize=-1
stack=-1
rss=-1

oracle:
fsize=-1
stack=-1
rss=-1

Hmm… I guess I am really trusting of the DBA.  At least this box is dedicated to Oracle.

3) Edit the kernel parameters. In /etc/tunables/nextboot, added the following:

vmo:
minfree = “1500″
maxfree = “2100″
minperm% = “5″
lru_file_repage = “0″

ioo:
j2_maxRandomWrite = “128″
j2_nPagesPerWriteBehindCluster = “128″
j2_nRandomCluster = “32″

4) Installed rsync.

5) Expanded /tmp and /oracle/home as needed.

AIX61# df | grep mnt

My /tmp file system was using /dev/hd3. Look at it and extend if needed. Here I extend by 1 physical partition (PP), which is 128 MB. Then I extend the /tmp file system too.

AIX61# lslv hd3
AIX61# extendlv hd3 1
AIX61# chfs -a size=+128M /tmp

6) Installed the fileset, rstc.basic, which is required by Oracle 11g.  Mounted AIX6.1 DVD on /mnt and ran this installp command:

AIX61# installp -ag -d /mnt/installp/ppc/ rsct.basic

How to install SSH on AIX 6.1 and turn off telnet

June 14th, 2009

One of my biggest gripes about AIX is how security un-conscious it is.  SSH now “comes with” AIX, but it’s on a separate cd.  Anyway, enough griping.  Here are the procedures.

Installing OpenSSH on AIX 6.1

1) Obtain the files. It’s downloadable here: http://sourceforge.net/projects/openssh-aix/.  Or you can find it on the expansion CD.  Or the Linux toolkit for AIX CD.

2)  Install.  If you’re using a CD, follow my directions for installing lsof from here (of course, replace openssh with lsof).  Otherwise, I have some installp examples here.

3) Start your SSH.

AIX61# startsrc -g ssh

4) Edit your /etc/hosts.allow file. Otherwise you’ll see an error that says this:

ssh_exchange_identification: Connection closed by remote host

5) Test it out.

Linux# ssh AIX61

How to Disable Telnet on AIX 6.1

1) Comment out telnet from /etc/inetd.conf.

2) Reload the configuration file

AIX61# refresh -s inetd

3) Test. You should get a nice error message like this:

Linux# telnet AIX6.1
Trying 10.1.1.10…
telnet: connect to address 10.1.1.10: Connection refused
telnet: Unable to connect to remote host: Connection refused

How to Add a Disk on AIX Logical Volume Manager (LVM)

May 12th, 2009

AIX, for all of its strange mainframe-ish ways, has some redeeming qualities. AIX’s disk management system would be one of them. It’s quite sophisticated given that it’s bundled in at no additional cost. But I digress.

For this “how-to”, I’ll walk through a simple scenario of adding a disk. In my case, it was adding a SAN disk on a DS4800 system. But this should work for a regular ol’ hard drive too.

1) Add the physical disk.

2) Rescan your hardware so that the OS is aware of your new disk.

AIX# cfgmgr

3) Check to see your disk. For the purpose of this example, let’s say the new disk is hdisk2.

AIX# lsdev -Cc disk
AIX# lspv

4) Associate your new disk to a volume group. In this case, let’s create a new group called ryanvg and put hdisk2 in there.

AIX# mkvg -y ryanvg hdisk2

5) Now you can look at the size of hdisk2. (This command won’t work if it’s not associated with a volume group).

AIX# lspv hdisk2

6) Create a log logical volume for jfs2. This needs to be part of ryanvg. Note: in the example below, the type is jfs2log and we’re giving it 1 physical partition (PP).

AIX# mklv -t jfs2log ryanvg 1

7) Look for your new logical volume (lv). Chances are that AIX named it loglv00.

AIX# lsvg
AIX# lsvg -l ryanvg

8) Create your production logical volume. Let’s make it, hmm… how about 30GB? At the risk of sounding narcissistic, I’ll name it ryanlv.

AIX# lsvg ryanvg
AIX# mklv -t jfs2 -y ryanlv ryanvg 30G

9) Lay down your file system on ryanlv.

AIX# mkfs -o log=/dev/loglv00 -V jfs2 /dev/ryanlv

10) Mount your filesystem.

AIX# mkdir /mountpoint
AIX# mount -o log=/dev/loglv00 /dev/ryanlv /mountpoint

11) Consider adding to /etc/filesystem, if everything comes up fine

How to Troubleshoot GRUB after Fedora Upgrade

May 3rd, 2009

I’ve recently upgraded my Fedora box from 7 to 10.  It all went quite well, except upon reboot.  I expected to see my nice GRUB menu, allowing me to select which kernel to boot.  Instead I got the command line prompt:

grub>

ugh.  Now what?

How to boot from GRUB command line

First things first.  Try to boot.  Then fix the menu.

0) Orient yourself.  Fortunately my version of grub (0.97) provides a nice tab completion feature.  This allows me to identify both commands and files.

1) Check your root disk.

grub> root
grub> cat /<TAB>

2)  If you can see files, you’re off to a good start.  Skip to step 3.  Otherwise you may need to search around for your root disk.  Try iterations of this:

grub> root (hd0,0)
grub> cat /<TAB>

Go along replacing (hd0,0) with (hd0,1) … (hd0,5).  Then try (hd1,0) and so forth.  For those familiar with Linux device naming schemes, (hd0,0) is the same as sda1 (or hda1).  In GRUB, (hd0,1) would be sda2 and (hd1,0) would be sdb1.  When you find a disk that you can read, go onto step 3.

3) Load your kernel and initrd.  Then boot.

grub> kernel /vmlinuz<TAB>
grub> initrd /initrd<TAB>
grub> boot

If you can’t find these files, look around with “cat /<TAB>”.  Try the /boot directory.

Upon successfully booting, go ahead and test your menu.lst file.

How to check your menu.lst file

Your menu.lst file holds the configuration for your menu.  It’s located in /boot/grub/menu.lst, and it’s often linked to grub.conf in the same directory.

grub> configfile /grub/menu.lst

This worked for me.

So, why doesn’t my menu.lst file load automatically?

Remember how I mentioned that my configuration file is located in /boot/grub/menu.lst?  My /boot directory is in a separate partition from my root (/) partition.  So upon mounting (hd0,2), which is where my /boot partition’s located, my config file is actually in a different place: /grub/menu.lst.  There’s no /boot directory anywhere.

Apparently, /boot/grub/menu.lst is hardcoded.  No problem. The solution is simple.  Boot the machine, and in the shell:

Fedora10# cd /boot
Fedora10# ln -s . /boot

I rebooted, and voila! Pretty menu once again!

Bugzilla Upgrade Error: DBD::mysql::db do failed: Incorrect table definition; there can be only one auto column and it must be defined as a key

January 17th, 2009

While upgrading Bugzilla, I also came across this error when I ran the checksetup.pl script.

Removing index 'groups_name_idx' from the groups table...

DBD::mysql::db do failed: Incorrect table definition; there can be only one auto column and it must be defined as a key [for Statement "ALTER TABLE groups DROP PRIMARY KEY"] at Bugzilla/Install/DB.pm line 1394

Bugzilla::Install::DB::_convert_groups_system_from_groupset() called at Bugzilla/Install/DB.pm line 262

Bugzilla::Install::DB::update_table_definitions('HASH(0x8bf49c8)') called at ./checksetup.pl line 195

What does this error mean?

This error means that the script was unable to DROP the PRIMARY KEY on the groups TABLE, because that field has auto_increment turned on.

How do I fix this?

Turn off auto_increment in the groups table.

1) Look at the groups table

Linux# mysql
mysql> use bugs;
mysql> desc groups;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| bit | bigint(20) | NO | | 0 | |
| name | varchar(255) | NO | | | |
| description | text | NO | | | |
| isbuggroup | tinyint(4) | NO | | 0 | |
| userregexp | tinytext | NO | | | |
| isactive | tinyint(4) | NO | | 1 | |
| id | mediumint(9) | NO | PRI | NULL | auto_increment |
+-------------+--------------+------+-----+---------+----------------+

2) Modify the ID field of the groups table.

mysql> alter table groups modify id mediumint(9) not null;

3) Verify the changes in the groups table

mysql> desc groups;
+-------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| bit | bigint(20) | NO | | 0 | |
| name | varchar(255) | NO | | | |
| description | text | NO | | | |
| isbuggroup | tinyint(4) | NO | | 0 | |
| userregexp | tinytext | NO | | | |
| isactive | tinyint(4) | NO | | 1 | |
| id | mediumint(9) | NO | PRI | | |
+-------------+--------------+------+-----+---------+-------+

4) Re-run the checksetup.pl command

Bugzilla Upgrade Error: DBD::mysql::db do failed: Duplicate entry ‘1-1-0-0′ for key 1 [for Statement “INSERT INTO user_group_map

January 17th, 2009

When upgrading Bugzilla from 2.16 to 3.20, I kept getting errors like these when I ran checksetup.pl.

DBD::mysql::db do failed: Duplicate entry '1-1-0-0' for key 1 [for Statement "INSERT INTO user_group_map (user_id, group_id, isbless, grant_type) VALUES (?, ?, ?, ?)"] at Bugzilla/Install/DB.pm line 1602

Bugzilla::Install::DB::_convert_groups_system_from_groupset() called at Bugzilla/Install/DB.pm line 262

Bugzilla::Install::DB::update_table_definitions('HASH(0xa2ee9a8)') called at ./checksetup.pl line 195

What does this error mean?

This means that a MySQL database INSERT command failed, because there exists a duplicate entry in that table.

How do I fix this?

When the upgrade’s trying INSERT a column into a table and it finds an existing duplicate, we can make one of two assumptions:

A) The original entry is correct
OR
B) The new entry is correct

If you choose (A), you should be using the INSERT IGNORE command.  This command keeps the original entry.  Otherwise, if you choose (B), you should use the REPLACE command.  This command, well… replaces the original entry with the new entry.  I, personally, chose the REPLACE command.

Umm… What Exactly do I Do?

Change the code from “INSERT” to “REPLACE”.  Based on the error above, that would be line 1602 of Bugzilla/Install/DB.pm.

I had to do this multiple times.  I ran checksetup.pl, edited the relevant code, and repeated until the upgrade completed without error.

How to Migrate and Upgrade Bugzilla on Red Hat Linux

January 17th, 2009

I have an old version of Bugzilla (2.16) on old hardware (Dell 2650).  Frankly, I’m a bit worried about this machine dying and taking out my Bugzilla install with it.  So this write-up will document my adventures of moving Bugzilla to a virtual RHEL5.2 server and upgrading Bugzilla from 2.16 to 3.2. Here are my specs for my new server:

  • VMWare ESX virtual machine
  • Red Hat Enterprise Linux 5.2
  • Bugzilla 3.2
  • Apache 2.2.3
  • MySQL 5.0
  • Perl v5.8.8

Useful Documentation

Bugzilla allows you to move the server and upgrade in one fell swoop.  Here’s some of the official documentation that I used:

Migration and Upgrade Steps

Here’s the overall process that I used:

1) Install a new Bugzilla instance following the guide above.  This includes installing the OS, Perl, MySQL (or other DB), and Apache.  You should be able to get most of these off of the standard distro.  Also, download the bugzilla files to /usr/local/bugzilla.

2) Disable access to your old Bugzilla server by turning off the web server.

Old_Server# /etc/init.d/httpd stop

3) Take a mysqldump of your old server.  Place the dump file somewhere accessible by the new server (i.e. an NFS folder).

Old_Server# mysqldump -u(user) -p (password) –database bugs > /nfs/bugzilla.sql

4) Create your database and restore your mysqldump

New_Server# mysql
mysql> create database bugs;
mysql> use bugs;
mysql> source /nfs/bugzilla.sql

5) Copy over localconfig file and data directory

6) Run the checksetup script, which should perform the upgrade.  Take care of the resulting errors.

New_Server# /usr/local/bugzilla/checksetup.pl

How to Assign a Multiple Ports to a VLAN

January 16th, 2009

Here’s the traditional way to assign a single port (interface Gi3/1 in this example) to a virtual LAN (VLAN 7 in this example):

Cisco IOS #config t
Cisco IOS(config) #int GigabitEthernet3/1
Cisco IOS(config-if) #switchport access vlan7
Cisco IOS(config-if) #end

Now, this is fine for a couple of ports, but it’d get really tedious really fast if you wanted to reassign a whole bunch — say 24 — ports.  The fast way around this is to use the interface range command.

Here are the commands for multiple contiguous ports (Gi3/1 through Gi3/24):

Cisco IOS #config t
Cisco IOS(config) #int range GigabitEthernet3/1 - 24
Cisco IOS(config-if) #switchport access vlan7
Cisco IOS(config-if) #end
Cisco IOS # show vlan