Thursday, August 19, 2010

Oracle on OpenSolaris, part 2

If this is going to be a sandbox, it needs more toys. Oracle requires certain packages. The installer still uses Motif. I'm ambivalent about installing a full Gnome desktop, but I'll want X and VNC. And compilers and GNU make.

All actions are performed in the oracle zone as root, until the point where I su to the newly created oracle user. I'll omit the command prompts and responses this time.

Packages

pkg install SUNWxorg-server
pkg install SUNWxorg-client-programs
pkg install SUNWxwopt
pkg install SUNWxwfsw
pkg install SUNWxvfb
pkg install SUNWxorg-graphics-ddx
pkg install SUNWxorg-headers
pkg install FSWxorg-fonts
pkg install SUNWmfrun
pkg install SUNWxvnc

pkg install SUNWman
pkg install SUNWgmake
pkg install SUNWbinutils
pkg install SUNWgcc
pkg install SUNWgzip
pkg install SUNWunzip
pkg install SUNWwget
pkg install SUNWbtool
pkg install SUNWzfs-auto-snapshot
pkg install pkg:/sunstudioexpress

Where's my manpage index? Grrr. This ought to be a post-install action for SUNWman.

catman -w

Oracle user and group

I suppose these will become reserved IDs when Oracle Corp gets around to releasing Solaris 11. I'm going to skip the oinstall and oper groups.
mkdir -c /export/home

groupadd -g 300 dba
useradd -m -d /export/home/oracle -g dba -u 300 -s /usr/bin/bash oracle
passwd oracle

mkdir /db/oracle
mkdir /db/oraInventory
chown oracle:dba /db/oracle
chown oracle:dba /db/oraInventory
chmod 755 /db/oracle
chmod 755 /db/oraInventory

System Parameter(s)

Prior to Solaris 10, there was some /etc/system tweaking to be done. Each version of Unix has it's own set of required system-level tweaks and accompanying reboots for Oracle.

In Solaris 10+, there's only one key parameter to change, and it's handled through projects, a more fine-grained approach to resource management.

The box has 8GB of memory. The default max shared memory is 25% or 2GB.  Starting a database with 2GB of memory configured will cause a ORA-27102: out of memory error.  I'll up the limit to 4GB.

Get our current project ID
oracle@oracle:~$ id -p
uid=300(oracle) gid=300(dba) projid=100(user.oracle)

We'll need be root to make these changes to the oracle user. Confirm the current shared memory limit
root@oracle:~$ prctl -n project.max-shm-memory -i project 100
project: 100: user.oracle
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
project.max-shm-memory
privileged 2.00GB - deny -
system 16.0EB max deny -

Set it to 4GB now. I believe this only affects the current shell.
root@oracle:~$ prctl -n project.max-shm-memory -r -v 4gb -i project 100

Set it to 4GB for next reboot
root@oracle:~$ projadd -U oracle -K "project.max-shm-memory=(priv,4GB,deny)" user.oracle

Confirm the changes
root@oracle:~$ prctl -n project.max-shm-memory -i project 100
project: 100: user.oracle
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
project.max-shm-memory
privileged 4.00GB - deny -
system 16.0EB max deny -

root@oracle:~$ projects -l user.oracle
user.oracle
projid : 100
comment: ""
users : oracle
groups : (none)
attribs: project.max-shm-memory=(priv,4294967296,deny)

I've got a note here that a hack is needed to link libcrypto.so on OpenSolaris during the install, but I'm not sure if it applies here.
ln -s /lib/amd64/libcrypto.so /usr/sfw/lib/amd64

Installation

At this point I set up a VNC session as root so I can use the default Oracle installer. Now the oracle user needs permission to use the display. It's been a very long time since I needed to know this, so I spent a while staring at cryptic error messages before realizing the problem had nothing to do with the Oracle installer. A page of Java stack dump and complaints about permissions on /tmp/.X11-pipe actually mean "run xhost, dummy".
vncserver :1
xhost +local:oracle

Holy cats, that default window manager is ugly!

But it takes me back...late nights on Sun pizzabox workstations in a frigid computer room...spamming full-screen xeyes onto other students' monitors...hey, it's a lot more amusing when nobody in the room has slept in two days.


Away we go.
su - oracle
export DISPLAY=oracle:1.0
cd /junk/database
./runInstaller

The installer will complain because it does not recognize OpenSolaris and can't run any pre-flight checks. That's ok. Say yes. If you're missing a package, it'll probably become apparent later, when the installer invokes make.

I won't screenshot all of the installation screens, but here's a brief summary:

  • I skipped entering an email address. This won't be a supported installation, and in any case, we already have a problem if I have to hear about "critical security issues in my configuration" via email.
  • Unless I'm performing an upgrade, I always choose to install the database software only. I prefer to make sure I have basic functionality - in the past, this was by no means assured and often required a support call to Oracle to work around installation bugs - and run dbca later.
  • The system isn't prepped for RAC so this will be a single instance installation.  Perhaps that will be a different writeup.
  • I chose to install Enterprise, minus OLAP, which I never use. (Table partitioning is still an option with a separate price tag? Seriously?)
  • The Oracle Base directory is going to be /db/oracle and the software location /db/oracle/product/11.2.0.
  • The software will be owned by user oracle, group dba.

Post-Installation

Setup the oracle user's environment in ~/.profile.

export ORACLE_HOME=/db/oracle/product/11.2.0
export ORACLE_OWNER=oracle
export ORACLE_SID=toybox
export ORACLE_UNQNAME=toybox
export NLS_LANG=AMERICAN_AMERICA.UTF8

export PATH=/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin:/${ORACLE_HOME}/bin

export DISPLAY=oracle:1.0

No comments:

Post a Comment