This article is about consumer electronics, but could also apply to many of the products that we use in IT. As far as I am concerned, I would rather just go to a website to purchase IBM equipment with whatever config I want. Then i want to go back a year later, pull up my machine, and perhaps add an adapter or two to it.
Install Oracle 10g on AIX
Start with a gz file, uncompress it and then use cpio to unpack it:
gunzip 10gr2_aix5l64_database.cpio.gz cpio -idcmv < 10gr2_aix5l64_database.cpio
I had to use the 'c' flag because I got a cpio error when I tried without.
In a wierd coincidence, I found this on a site almost like my own:
Life After Coffee
This will make a 'Disk1' subdirectory, a painful reminder that this is just code from a CD that got shuffled over here:
#cd Disk1/rootpre #./rootpre.sh ./rootpre.sh output will be logged in /tmp/rootpre.out_09-11-19.10:54:06 Saving the original files in /etc/ora_save_09-11-19.10:54:06.... Copying new kernel extension to /etc.... Loading the kernel extension from /etc Oracle Kernel Extension Loader for AIX Copyright (c) 1998,1999 Oracle Corporation Successfully loaded /etc/pw-syscall.64bit_kernel with kmid: 0x4525300 Successfully configured /etc/pw-syscall.64bit_kernel with kmid: 0x4525300 The kernel extension was successfuly loaded. Configuring Asynchronous I/O.... Configuring POSIX Asynchronous I/O.... Checking if group services should be configured.... Nothing to configure.
Now create an oracle userid and a dba and oinstall group:
mkuser -a groups=dba,oinstall oracle mkdir /apps/oracle chown ora.dba /apps/oracle
The rest is a little tricky, you now have to set an x-environment. Since AIX stopped making machines where you could just beebop into the data center and log into CDE, you will probably be using something on your client PC to do this. I use cygwin. Setting up cygwin is almost a different post, but I set up the default for X11 and got an error that twm wasn't found. From my cygwin bash shell I went to /etc/X11/xinit and eventually just replaced my xinitrc by doing this:
echo "xterm" > xinitrc
It is ugly, but I get an x environment with a shell that works.
From that shell, I run 'xhost +' and then 'ipconfig' to get my ip.
From the AIX session, I create a new /apps filesystem, become the 'oracle' user, and then export my display:
# crfs -v jfs2 -g rootvg -m /apps -a size=5G File system created successfully. 5242516 kilobytes total disk space. New File System size is 10485760 # mount /apps # chown oracle.dba /apps # su - oracle $ export DISPLAY=10.32.32.95:0.0 $ xclock
I see a clock in my xterm, so I control-C in AIX to kill it. I now have my environment set up to run the installer:
$ cd /tmp/Disk1 $ ./runInstaller ************************************************************************** ****** Your platform requires the root user to perform certain pre-installation OS preparation. The root user should run the shell script 'rootpre.sh' be fore you proceed with Oracle installation. rootpre.sh can be found at the top level of the CD or the stage area. Answer 'y' if root has run 'rootpre.sh' so you can proceed with Oracle installation. Answer 'n' to abort installation and then ask root to run 'rootpre.sh'. ************************************************************************** ****** Has 'rootpre.sh' been run by root? [y/n] (n) y Starting Oracle Universal Installer... No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed. Preparing to launch Oracle Universal Installer from /tmp/OraInstall2009-11-19_11-11-29AM. Please wait ...$ Nov 19, 2009 11:11:36 AM java.util.prefs.FileSystemPreferences$2 run INFO: Created user preferences directory. Nov 19, 2009 11:11:38 AM java.util.prefs.FileSystemPreferences$3 run INFO: Created system preferences directory in java.home.
Now I am in the gui, but I don't feel like posting GUI screen shots, so I will just talk you through it, I change the install path to be under /apps/oracle. Ditto with the next question about the inventory directory:
/apps/oracle
/apps/oracle/oraInventory
I set the operating system group to 'dba'
I can't cut and paste from the gui window, but there checks give me one warning:
bos.adt.prof 5.3.0.1
bos.cifs_fs.rte 5.3.0.1 <---- this didn't install correctly with NIM, I had to move to
my local system and run installp.
I pulled out my media and installed them, no problem. The retry button doesn't work, so I had to hit back and forward on the gui to get it to really retry the tests and be successful. Looks like to install everything requires 3.46G.
After it all runs, I am asked to run as root:
# /apps/oracle/oraInventory/orainstRoot.sh # ./orainstRoot.sh Changing permissions of /apps/oracle/oraInventory to 775. Changing groupname of /apps/oracle/oraInventory to dba. The execution of the script is complete
and also:
# /apps/oracle/product/10.2.0/db_1/root.sh Running Oracle10 root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /apps/oracle/product/10.2.0/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Creating /usr/local/bin directory... Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed.
I am just going to start with the default instance:
cd /apps/oracle/product/10.2.0/db_1/dbs/
cp init.ora initoracle.ora
Default shared memory isn’t enough:
$ sqlplus “/ as sysdba”
SQL*Plus: Release 10.2.0.1.0 – Production on Thu Nov 19 12:26:24 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-00371: not enough shared pool memory, should be atleast 123232153 bytes
SQL>
Remove these:
shared_pool_size = 3500000 # SMALL # shared_pool_size = 5000000 # MEDIUM # shared_pool_size = 9000000 # LARGE
Replace with:
shared_pool_size = 123232153 # Required
$ sqlplus “/ as sysdba”
SQL*Plus: Release 10.2.0.1.0 – Production on Thu Nov 19 12:32:33 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 163577856 bytes
Fixed Size 2019328 bytes
Variable Size 150994944 bytes
Database Buffers 8388608 bytes
Redo Buffers 2174976 bytes
ORA-00205: error in identifying control file, check alert log for more info
I then become oracle and try to get into sqlplus:
. /usr/local/bin/oraenv
ORACLE_SID = [oracle] ?
ksh: dbhome: not found.
ORACLE_HOME = [] ? /apps/oracle/product/10.2.0/db_1
$ sqlplus “/ as SYSDBA”
SQL*Plus: Release 10.2.0.1.0 – Production on Thu Nov 19 12:05:34 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL>
oslevel -s gives bogus message; 70324,004
On AIX 6.1, we see the following error:
# oslevel -s
rpm_share: 0645-024 Unable to access directory /tmp/.workdir.487456.430278_1
rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result.
6100-02-05-0939
#
This may be something we can further debug, if oslevel is a shell script.
First of all, figure out where oslevel is:
# whereis oslevel oslevel: /usr/bin/oslevel
Next, figure out what it is:
# file /usr/bin/oslevel /usr/bin/oslevel: shell script - ksh (Korn shell)
Now, that we know its a shell, script, we put in a set -x. To do this to the beginning, you
can just put a -x after the ksh line:
Change:
#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos53L src/bos/usr/bin/oslevel/oslevel.sh 1.5.6.2 #
To this:
#!/bin/ksh -x # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos53L src/bos/usr/bin/oslevel/oslevel.sh 1.5.6.2 #
Then, run it again (I only show the end of the command):
+ [[ 1 = 1 ]] + [[ 0 = 1 ]] + [[ 0 = 1 ]] + [[ 0 = 1 ]] + print_current_spack rpm_share: 0645-024 Unable to access directory /tmp/.workdir.667776.684286_1 rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result. 6100-02-05-0939 + exit 0 + interrupted
Looks like we are looking for a function called ‘print_current_spack’, the set -x doesn’t descend
into functions, so take the original one out and add one into this function:
Before:
print_current_spack() { trap interrupted INT QUIT TERM typeset BUF typeset DVRMF typeset DSPNO typeset DTLNO
After:
print_current_spack() { set -x trap interrupted INT QUIT TERM typeset BUF typeset DVRMF typeset DSPNO typeset DTLNO
Now we see the next level of debugging show up at the top of the output:
# oslevel -s | more + trap interrupted INT QUIT TERM + typeset BUF + typeset DVRMF + typeset DSPNO + typeset DTLNO + get_known_spacks rpm_share: 0645-024 Unable to access directory /tmp/.workdir.536746.573476_1 rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result. + + /bin/grep _SP: /tmp/oslevel.0.577656/.oslevel.mlinfo + /bin/grep :-: + /usr/bin/awk -F: { print $1 }
So we just move on to ‘get_known_spacks’. In this case, I can’t find the output easily on the screen,
so I write to a file:
oslevel -s > /tmp/outfile 2>&1
print_current_rml (this may now be official spaghetti code):
+ typeset MVRMF + typeset SPNO + typeset TLNO + + print_current_rml rpm_share: 0645-024 Unable to access directory /tmp/.workdir.585812.594022_1 rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result. BUF=6100-02-00_SP + [[ ! -s /tmp/oslevel.0.684192/.oslevel.mlinfo ]] + + /usr/bin/awk -F: $1 ~ /_SP$/ { print $1 } /tmp/oslevel.0.684192/.oslevel.mlinfo + /usr/bin/sort -t- -r + /usr/bin/uniq
Next function = get_known_rmls:
+ trap interrupted INT QUIT TERM + get_known_rmls rpm_share: 0645-024 Unable to access directory /tmp/.workdir.557148.569454_1 rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result. + + /bin/grep _AIX_ML /tmp/oslevel.0.340030/.oslevel.mlinfo + grep :-: + /usr/bin/awk -F: { print $1 } + /usr/bin/uniq
print_min_rml:
+ trap interrupted INT QUIT TERM + typeset BUF + + print_min_rml rpm_share: 0645-024 Unable to access directory /tmp/.workdir.512036.557160_1 rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result. BUF=6120-00 + [[ ! -s /tmp/oslevel.0.553194/.oslevel.mlinfo ]] + + /usr/bin/awk -F: $1 ~ /_AIX_ML$/ { print $1 } /tmp/oslevel.0.553194/.oslevel.mlinfo + /usr/bin/uniq + /usr/bin/sort -r KWN_RML_LEVS=6100-02_AIX_ML 6100-01_AIX_ML 6100-00_AIX_ML 5300-08_AIX_ML
Now, it might be getting trickier:
+ trap interrupted INT QUIT TERM + typeset BUF + + print_min_rml + typeset ERROR=eval /usr/sbin/inuumsg 216 110 >&2; exit 1 + typeset BUF + [[ 1 -ne 1 ]] + + /usr/bin/lslpp -qLc bos.rte + LC_ALL=C rpm_share: 0645-024 Unable to access directory /tmp/.workdir.377012.446524_1 rpm_share: 0645-007 ATTENTION: init_baselib() returned an unexpected result. BUF=bos:bos.rte:6.1.2.1: : :C:F:Base Operating System Runtime: : : : : : :0:0:/:0920 + + echo bos:bos.rte:6.1.2.1: : :C:F:Base Operating System Runtime: : : : : : :0:0:/:0920 + awk -F: {split($3,lev,"."); print lev[1]lev[2]lev[3]"0"; exit(0)} + LC_ALL=C
Now, it gets more difficult. First we see that rpm_share is not something called directly, although some research shows that it is a different script. Set -x in it gets stripped out, so that doesn’t help.
Here is the source:
print_min_rml() { typeset ERROR='eval /usr/sbin/inuumsg 216 110 >&2; exit 1' typeset BUF [[ $recml -ne 1 ]] && return 0 # There is no RML information, lets print out # VRMF-00. BUF=$(LC_ALL=C /usr/bin/lslpp -qLc bos.rte) || $ERROR BUF=$(echo "$BUF" | LC_ALL=C awk -F: '{split($3,lev,"."); print lev[1]lev[2]lev[3]"0"; exit(0)}') [[ $? -ne 0 || -z $BUF ]] && $ERROR echo "${BUF}-00" return 0 } # end of print_min_rml()
Lets walks though it from the shell, one line at a time:
# BUF=$(LC_ALL=C /usr/bin/lslpp -qLc bos.rte) # echo $BUF bos:bos.rte:6.1.2.1: : :C:F:Base Operating System Runtime: : : : : : :0:0:/:
I include the echo to make sure we got something, so we move onto the next line:
echo "$BUF" | LC_ALL=C awk -F: '{split($3,lev,"."); print lev[1]lev[2]lev[3]"0"; exit(0)}' 6121
I would have done that mass off ugliness differently, but now we have BUF=6121
We are also at the end of this function, it is supposed to return 6.1.2.0-00, and does so, but also throws an error. Lets try to hard-code something to isolate it. This means stepping back a function:
get_known_rmls() { trap interrupted INT QUIT TERM typeset BUF # BUF=$(print_min_rml) BUF="6.1.2.0-00" if [[ ! -s $mlinfo ]]; then KWN_RML_LEVS=$BUF return 0
This works fine:
# oslevel -s 6100-02-05-0939
So know we know the problem must be in ‘print_min_rml’. When we removed the hard-coding, it still seemed to work, maybe it cleared out an unknown wierdness.
The easiest way to set up ssh without a password
Most people know how to create ssh public and private keys. If you hit enter when it asks for a password, you then have keys that don’t need a password to authenticate. As I show below, you really only need to do this once for each user if you own a whole farm of servers. Only worry about unique keys if you are giving them away to someone else or putting them on a server outside of your control. This may seem lax, but if you tighten up security too much in some places, you end up with unwieldy policies that people find ways to work around.
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa): Created directory '/home/username/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/username/.ssh/id_rsa. Your public key has been saved in /home/username/.ssh/id_rsa.pub. The key fingerprint is: 63:ef:3d:e0:83:86:57:5c:61:57:2c:5c:9f:a4:f2:c6 username@thishost
I like to start by making a line between /etc/ssh/ssh_known_hosts and /home/root/known_hosts. This way, when I accept a host as root, it works for everybody. My philosophy is that if root trusts a host to be what it says it is, everyone else can trust it too:
cd /etc/ssh ln -s /etc/ssh/ssh_known_hosts /home/root/.ssh/known_hosts
Next I use the same idea for users. Instead of making special keys for each server, I simply use the same one. This allows me to copy my user’s id_rsa.pub to authorized_keys:
scp root@trustedhost:/home/root/.ssh/id_rsa id_rsa scp root@trustedhost:/home/root/.ssh/id_rsa.pub id_rsa.pub cp id_rsa.pub authorized_keys
After that, just run a test to see if it works:
>ssh trustedhost pwd /home/root >ssh trustedhost ssh thishost pwd /home/root
Email 101 in Unix
This sends an email from a file:
mail -s “here is the subject” email@rigler.org,otheremail@rigler.org < /etc/motd This sends an email from a pipe: ls -l | mail -s "here is the subject" email@rigler.org,otheremail@rigler.org When you first install the system, if you have /etc/resolv.conf configured, email will figure out where to go. If you want to forward email sent to your unix account to a different account, just add the email address that you want to use to a file called ~/.forward
NIM boot hangs on led 0605
My NIM boot is hanging on 0605, this is a new spot, so I suspect there is a problem with it:
605 Configuration of physical network boot device failed. (from pimpworks.org )
First, I look and see what is installed into my spot and just compare it to an old spot that I know works:
nim -o showres '5300-11-spot'
I suspect that we are missing something for the virtual ethernet. I can compare this to the NIM server since it is also a virtual client:
root@aixd10:/etc/methods>lsdev -Cl ent0 -r Configure
/usr/lib/methods/cfgvioent
root@aixd10:/etc/methods>lsdev -Cl vio0 -r Configure
/usr/lib/methods/cfgbus_vdevice
In this case, it eventually worked, something just must have not been in the correct state. It would be interesting to build a spot that simply loads exactly what is needed for a mksysb,bos install, service mode work for our environment.
Bootp error during remote install with NIM (59661,004)
I get the following error when trying to do a remote NIM install with a new spot and lpp_source that I just created from 5.3 TL 11
oslevel -s: 5300-08-07-0920
(Allocated NIM resources)
5300-11-lpp lpp_source
5300-11-spot spot
nim_script nim_script directory containing customization scripts cre
boot boot represents the network boot resource
BOOTP: chosen-network-type = ethernet,auto,none,auto BOOTP: server IP = 10.32.18.39 BOOTP: requested filename = BOOTP: client IP = 10.32.16.130 BOOTP: client HW addr = fe f8 30 0 40 2 BOOTP: gateway IP = 10.32.18.39 BOOTP: device /vdevice/l-lan@30000002 BOOTP: loc-code U9133.55A.103878H-V4-C2-T1 icmp 3 : port unreachable ERROR: icmp 3 BOOTP: BOOTP request fail: 0 icmp 3 : port unreachable ERROR: icmp 3 BOOTP: BOOTP request fail: 1 icmp 3 : port unreachable ERROR: icmp 3 BOOTP: BOOTP request fail: 2 BOOTP ERROR: BOOTP request failed, QUIT !BA010004 !
We tried this, but it didn’t work:
nim -Fo resetnim -Fo deallocate -a subclass=all stopsrc -g nfs stopsrc -s portmap cd /etc rm -rf rmtab xtab cd /var/statmon rm -rf state sm sm.bak cd /etc mv exports exports.old touch exports startsrc -s portmap startsrc -g nfs
Next we decided to put bootp in debug mode:
#
1. Comment out the bootps entry from the /etc/inetd.conf file on the server.
2. Stop all running bootpd processes.
3. Restart inetd using the refresh -s inetd command.
4. Start bootpd from the command line, using the /usr/sbin/bootpd -s -d -d -d command.
bash-3.00# /usr/sbin/bootpd -s -d -d -d BOOTPD: bootptab mtime is Thu Nov 5 13:09:42 2009 BOOTPD: reading "/etc/bootptab" BOOTPD: bad hardware address for host "10.32.17.150" BOOTPD: read 2 entries from "/etc/bootptab" BOOTPD: dumped 2 entries to "/etc/bootpd.dump". BOOTPD: bootptab mtime is Thu Nov 5 13:09:42 2009 BOOTPD: Received boot request. BOOTPD: request from IP addr 10.32.16.100 BOOTPD: IP address not found: 10.32.16.100 BOOTPD: Finished processing boot request. BOOTPD: bootptab mtime is Thu Nov 5 13:09:42 2009 BOOTPD: Received boot request. BOOTPD: request from IP addr 10.32.16.130 BOOTPD: found 10.32.16.130 nad0019aixd22 BOOTPD: bootfile = /tftpboot/nad0019aixd22 BOOTPD: vendor magic field is 99.130.83.99 BOOTPD: RFC1048 vendor data ( bp_vend[64] ) 99.130.83.99.1.4.255.255.252.0.255.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.BOOTPD: sending RFC1048-style reply BOOTPD: The following addresses are included in the bootp reply BOOTPD: Client IP address (bp->bp_ciaddr) = 10.32.16.130 BOOTPD: Server IP address (bp->bp_siaddr) = 10.32.18.39 BOOTPD: Gateway IP address (bp->bp_giaddr) = 10.32.18.39 BOOTPD: Finished processing boot request. BOOTPD: bootptab mtime is Thu Nov 5 13:09:42 2009 BOOTPD: Received boot request. BOOTPD: request from IP addr 10.32.16.130 BOOTPD: found 10.32.16.130 nad0019aixd22 BOOTPD: bootfile = /tftpboot/nad0019aixd22 BOOTPD: vendor magic field is 99.130.83.99 BOOTPD: RFC1048 vendor data ( bp_vend[64] ) 99.130.83.99.1.4.255.255.252.0.255.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.BOOTPD: sending RFC1048-style reply BOOTPD: The following addresses are included in the bootp reply BOOTPD: Client IP address (bp->bp_ciaddr) = 10.32.16.130 BOOTPD: Server IP address (bp->bp_siaddr) = 10.32.18.39 BOOTPD: Gateway IP address (bp->bp_giaddr) = 10.32.18.39 BOOTPD: Finished processing boot request. BOOTPD: bootptab mtime is Thu Nov 5 13:09:42 2009 BOOTPD: Received boot request. BOOTPD: request from IP addr 10.32.16.104 BOOTPD: IP address not found: 10.32.16.104 BOOTPD: Finished processing boot request. BOOTPD: bootptab mtime is Thu Nov 5 13:09:42 2009 BOOTPD: Received boot request. BOOTPD: request from IP addr 10.32.16.104 BOOTPD: IP address not found: 10.32.16.104 BOOTPD: Finished processing boot request.
Ironically, just putting it in debug mode made it work, we took it back out of debug mode and it still worked.
Create a new LPP source for NIM
The easiest way to create a new resource for NIM is to use the smit menu system to get to the ‘Define a Resource Screen’ and fill it out. First type ‘smitty nim’ and then use up,down, and enter to
traverse the menu screens:
smitty nim Perform NIM Administration Tasks Manage Resources Define a Resource
Next select the resource type, use the down arrow to see more options, or type ‘/’ followed by lpp_source to go directly to what you want:
Manage Resources
---------------------------------------------------
Resource Type
Move cursor to desired item and press Enter. Use arrow keys
[MORE...1]
shared_home = /home directory shared by clients
tmp = parent directory for client /tmp directories
exclude_files = files to be excluded when creating a mksysb
lpp_source = source device for optional product images
[MORE...16]
---------------------------------------------------
You will now see a screen with fields that you can fill out using the arrow keys to move between choices. Hit enter when you are done:
################################################################ Type or select values in entry fields. Press Enter AFTER making all desired changes. [Entry Fields] * Resource Name [5300-11-lpp] * Resource Type lpp_source * Server of Resource [master] * Location of Resource [/export/lpp_source/5300-11-lpp] Architecture of Resource [] Source of Install Images [cd0] Names of Option Packages [] Show Progress [yes] Comments []
After you hit enter you will see:
COMMAND STATUS
Command: running stdout: yes stderr: no
Before command completion, additional instructions may appear below.
Preparing to copy install images (this will take several minutes)...
After a few seconds, you will see a scroll of images as they are copied from the DVD:
/ppc/devices.chrp.vdevice.5.3.10.0.I /ppc/devices.chrp.pciex.5.3.0.0.I /ppc/devices.chrp.pci.5.3.11.0.I /ppc/devices.chrp.base.1.3.0.110.I /ppc/bos.rte.streams.5.3.11.0.U /ppc/bos.rte.methods.5.3.11.0.U /ppc/bos.rte.man.5.3.11.0.U
The ones names with ‘I’ at the end are base install images and the ones named with ‘U’ are updates which can not be installed unless the base is already installed. Finally, it will finish:
/ppc/X11.loc.EN_GB.5.3.0.0.I /ppc/Java14.sdk.1.4.2.275.I Now checking for missing install images... All required install images have been found. This lpp_source is now ready. [BOTTOM]
If all went well, it will say, ‘OK’ at the top of the screen where it once said ‘Running’. Type F10 (or probably Esc-0) to exit.
Use the Oracle 11g version of Perl to connect to databases in AIX
I just got my connection from AIX into Oracle through Perl working, using DBD::Oracle. This is good news because it opens up the potential to do processing in our robust shared AIX environment on an LPAR licensed as an Oracle client, not a server. Instead of embedding stuff into Oracle’s extended SQL language just to get it to run on the server, we could now simply write in Perl. This could end up saving us quite a bit of money on Oracle licensing.
The configuration may seem trivial, but I ran into so many gotchas on this, that I just hacked into some Oracle scripts and essentially picked up their environment to run. It was compiled with an @INC path that didn’t exist, so I just created it and moved in all of their compiled Perl. It’s Perl 5.8.3 compiled in single thread mode which is different from the Perl that is compiled with Base AIX.
First, find your perl library wherever Oracle ended up putting it and move it to the location hardcoded in @INC:
(find where the Oracle lib directory is) tar -cvf /tmp/oraperl.tar lib mkdir -p /ade/aime_perl_build_latest/perl58/bin/AIX64 cd /ade/aime_perl_build_latest/perl58/bin/AIX64 tar -xvf /tmp/oraperl.tar
Next, find and copy the actual perl executable into /ade/aime_perl_build_latest/perl58/bin/AIX64.
I pick this path, simply because it is what @INC is hardcoded to for me:
# echo "print @INC" | ./perl /ade/aime_perl_build_latest/perl58/bin/AIX64/Opt/lib/5.8.3/aix-thread-multi-64all/ade/aime_perl_build_latest/perl58/bin/AIX64/Opt/lib/5.8.3/ade/aime_perl_build_latest/perl58/bin/AIX64/Opt/lib/site_perl/5.8.3/aix-thread-multi-64all/ade/aime_perl_build_latest/perl58/bin/AIX64/Opt/lib/site_perl/5.8.3/ade/aime_perl_build_latest/perl58/bin/AIX64/Opt/lib/site_perl.#
Next, I just made a simple test script:
#!/ade/aime_perl_build_latest/perl58/bin/AIX64/perl use DBI qw(:sql_types); my $dbh; my $address = " (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST= yourhostnamehere) (PORT=1521)) (CONNECT_DATA=(SERVICE_NAME= service.yourinc.com)) )"; my $mode = 0; $dbh= DBI->connect('dbi:Oracle:', "username@".$address , "password", {ora_session_mode => $mode}) or die "Could not connect\n"; print "Connect failed \n" unless $dbh; $dbh->{RowCacheSize} = 100; my $sth = $dbh->prepare("select * from tab",{ora_check_sql => 0 }); $sth->execute or die "\nError: Sql failed: \n"; my $returned=""; while (my @row = $sth->fetchrow_array) { $returned = $row[0]; print (" $row[0]\n"); } $sth->finish; $dbh->disconnect or die ("disconnect failed", $DBI::err);
That’s all there is to it, this connects and works just fine. You can probably do something similar at 10g, but don’t try with 9i, it looks like a pretty old version of Perl.
Having now conquered Perl, php is next on my wishlist: