Video: Sun/Oracle’s Netbeans 6.7 and the GlassFish version 3 application server

Share Button

Getting three monitors to work with Kubuntu (Ubuntu with KDE) on a Dell Optiplex GX520 – NVidia GeForce4 MX 4000 low profile video card and the onboard Intel 82945G/GZ video card

At work we have three generic LCD monitors mounted on a pole to view monitoring metrics for our Oracle & Sybase database servers. On a previous machine that was cannibalized for another task, we ran Microsoft Windows XP to drive the three monitors.

Last week we were given a hand me down desktop, a Dell Optiplex GX520 with integrated Intel 82945G/GZ video on the motherboard. When we added the NVidia GeForce4 MX 4000 low profile video card, Windows XP for whatever reason was unable to use both video cards. I proposed Kubuntu 9.04 Linux as an alternative. As it was only myself that I had to convince to make the attempt, I was hard pressed to say no 😉

The Intel 82945G/GZ video card will be the primary card and must be attached to “Screen 0” in the ServerLayout section.

The NVidia video card has two connectors:

  1. A standard VGA port driven by a GeForce4 MX 4000 GPU < - Primary nvidia port
  2. A super-video port driven by a Quadro NVS 110M

After the base install of the operating system, XWindows was only able to see the Intel video card. After much tinkering with the /etc/xorg.conf file, I was able to get all three LCD monitors to work with Xinerama. There are a number of gotchas that you might run into:

  • If the integrated Intel video card is set to Auto in the BIOS, the card will be completely disabled. You need to disable Auto
  • You need to know which Nvidia Device entry drives the VGA connector. It must be initialized prior to the S-Video port.
  • Disable NVidia’s TwinView and metamodes option lines in the Screen Section.
  • Use sudo lspci to identify the pci bus ids. You will need to put them in the Device Sections.
  • The integrated Intel video card must use the vesa video driver as the intel video driver will stacktrace when used with xinerama.
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 1.0  (buildd@palmer)  Sun Feb  1 20:21:04 UTC 2009

Section "ServerLayout"
    Identifier     "Default Layout"
    Screen      0  "Screen0" 0 0   
    Screen      1  "Screen2" Above "Screen0"
    Screen      2  "Screen1" Above "Screen2"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"    
    Option "Xinerama" "On"                   
EndSection                                   

Section "Files"
    ModulePath      "/usr/lib/xorg/modules/extensions"
    ModulePath      "/usr/lib/xorg/modules/drivers"   
    ModulePath      "/usr/lib/xorg/modules"           
EndSection                                            

Section "Module"
    Load           "glx"
EndSection              

Section "ServerFlags"
    Option         "xinerama" "true"
    Option         "DefaultServerLayout" "Default Layout"
EndSection                                               

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"      
EndSection                    

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse" 
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"  
EndSection                               

Section "Monitor"
    Identifier     "Configured Monitor"
EndSection                             

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown" 
    ModelName      "CMO CMC 17 AD"
    HorizSync       30.0 - 82.0   
    VertRefresh     50.0 - 75.0   
EndSection                        

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "Unknown" 
    ModelName      "CMO CMC 17 AD"
    HorizSync       30.0 - 82.0   
    VertRefresh     50.0 - 75.0   
EndSection                        

Section "Monitor"
    Identifier     "Monitor2"
    VendorName     "Unknown" 
    ModelName      "Seiko"   
    HorizSync       30.0 - 75.0
    VertRefresh     60.0       
EndSection                     


Section "Device"
    Identifier     "Configured Video Device"
    Driver         "nvidia"                 
    Option         "NoLogo" "True"          
EndSection                                  

Section "Device"
   Identifier  "Device0"
   #Driver      "intel" 
   Driver      "vesa"   
   VendorName  "Intel Corporation"
   BoardName   "82945G/GZ Integrated Graphics Controller"
   BusID       "PCI:0:2:0"                               
   Screen          0                                     
EndSection                                               

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro NVS 110M"
    BusID          "PCI:4:0:0"
    Screen          1
EndSection

Section "Device"
    Identifier     "Device2"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce4 MX 4000"
    BusID          "PCI:4:0:0"
EndSection

Section "Screen"
    Identifier     "Default Screen"
    Device         "Configured Video Device"
    Monitor        "Configured Monitor"
    DefaultDepth    24
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen2"
    Device         "Device2"
    Monitor        "Monitor2"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "TwinViewXineramaInfoOrder" "CRT-0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "on"
EndSection
Share Button

How to clean up Oracle archive logs when you don’t have a RMAN catalog (10g/11g)

If you’re not using Oracle’s RMAN for backup management but you have turned on archive mode for hot backups, you can create a job in Enterprise Manager (Maintenance -> Manage Current Backups).

Recently I ran into a problem with one our Enterprise Manager installs where scheduled jobs would not run. So, I wrote a very simple RMAN script to clear out the references to any archive files that I’ve moved elsewhere or deleted:

[BASH]RMAN=/oranr/10g/bin/rman

$RMAN nocatalog target / <

Share Button

So you want to tweet to Twitter from *WITHIN* Oracle 11g? Here’s how!

Lewis Cunningham Twitterhas once again given us a gem from the world of Oracle’s relational DBMS!  This time, he has written ORA_Tweet, an API to send/receive Tweets (microblog posts) from within Oracle 11g.  Major kudos to Lewis Cunningham for writing and releasing ORA Tweet to Sourceforge.net 🙂

Call the Twitter API from within an Oracle database. ORA_Tweet uses the UTL_HTTP API within Oracle to call the update_status API. It is written completely in PL/SQL.

So, my question is…  Will someone write a Flickr API for Sybase ASE?

Share Button

Introducing QweryBuilder, a Developer GUI for Sybase ASE, SQL Anywhere, Microsoft SQL Server and Oracle 10g/11g

qwerybuilder_reflectedimageQweryBuilder uses innovative ideas to provide developers with the ability to easily insert, extract and modify data from a variety of databases.

The goal of QweryBuilder is to increase a database developer’s productivity. It contains many time saving features.

SQL Editor

QweryBuilder - SQL Editor
QweryBuilder - SQL Editor
  • Script auto complete
  • Custom auto complete lists
  • Code Templates
  • Display column list for tables and views in editor
  • Display procedure parameters in editor
  • Keyboard shortcut to open procedures
  • Generate and insert new GUIDs
  • Syntax folding
  • Auto indenting

Criteria Query

QweryBuilder - Criteria Query
QweryBuilder - Criteria Query
  • Form view criteria screen for easy data retrieval
  • Updateable result set
    • Insert nulls, GUID’s, and computed values into results
    • Insert, delete and update data rows
    • Generate insert statements from results
    • Create graphs from result data

Graphic Query

QweryBuilder - Graphic Query
QweryBuilder - Graphic Query
  • Create queries graphically
  • Cross table querying without writing SQL

Other Features

  • Support for Microsoft SQL Server, Sybase ASE, SQL Anywhere and Oracle
  • DDL Browser
  • Database Search
  • Visual Difference
  • Code Formatter
  • Getting Started Window
    • Displays last used connections, files and database objects
    • Easily navigate to the last thing you were working on
  • Clipboard Saver
  • File Browser
  • Object Browser
Share Button

FW: Oracle 10g+ Security and Audit – Part 1

Over at the Database Geek Blog, Lewis Cunningham has provided the first of three blog posts on Oracle Security.  The first post is well done IMHO:

Oracle 10g+ Security and Audit – Part 1Oracle

This is a three-part definition of Oracle Security (specifically in 10g but applies to later versions also). Part 1 covers the various types of security Oracle provides. Part 2 deals with Users/Schemas, Roles, Permissions and Data Access. Part 2 will be a more technical discussion than parts 1 or 3. In part 3, I will discuss implementing an Oracle auditing scheme and how to ensure you comply with security and audit regulations.

read more…

Share Button

Trying to install Oracle 11g on AIX 6.x but it fails on a ORA-27173 (unable to attach to shared memory) error?

The AIX version of Oracle 11g was built on AIX 5 so when you try to create an Oracle database using the Database Configuration Assistant, aka, ‘dbca’, you may get the ORA-27173 “unable to attach to shared memory” error.  Oddly enough this has to do with the time zone (TZ) setting. You see, dbca has no concept of the Olsen Time Zone ids, it is expecting what AIX 5 used. So you need to explicitly set the time zone environment variable (TZ).

AIX 6 had my TZ set to “America/New York”.  For Oracle’s dbca to work, I had to set TZ to “EST5EDT”.

Share Button

Oracle 10g: How to create an Enterprise Manager instance on the command line

In case you have to create an Oracle 10g Enterprise Manager instance from scratch, it is very easy.

  1. emca -repos create
  2. emca -config dbcontrol db

If you need to blow away the existing Enterprise Manager configuration, you can either recreate the repository, which will wipe out all the configurations:

  1. emca -repos recreate
  2. emca -config dbcontrol db

or, you can recreate just the dbcontrol for an instance:

  1. emca -deconfig dbcontrol db
  2. emca -config dbcontrol db
Share Button

Installing Oracle Instant Client and DBD::Oracle on Ubuntu Linux 8.04 Server JEOS

Ever want to just install the minimal amount of Oracle client software for client applications on Linux? Well, Oracle has provided Oracle Instant Client to do this but they have neglected to make it intuitive to install. I’ve written a couple scripts that make it easy on Linux. I’ve tested this on Ubuntu Linux 8.04 Server JEOS.

Download the files you need

Download Oracle Instant Client

Retrieve the Instant Client packages and save them to a directory (e.g. “linux 32bit”).

  • Instant Client Package – Basic
  • Instant Client Package – JDBC Supplement
  • Instant Client Package – SQL*Plus
  • Instant Client Package – SDK
  • Instant Client Package – ODBC

Download DBD::Oracle and place it in the build-cfg directory

Copy your tnsnames.ora file into the build-cfg directory

Download build_oracle_instantclient.sh into the directory above build-cfg directory

Save root.sh into the build-cfg directory

Build a tar ball containing everything we need in the directory format we need.

build_oracle_instantclient.sh "../linux 32bit"

Script1: build_oracle_instantclient.sh

SOURCE_DIR="$1"
BUILD_DIR=builddir
CFG_DIR=build-cfg

if [[ -z $1 ]]; then
  echo "Usage: build_oracle_instantclient.sh <directory containing oracle instant client zip files>"
  exit 1
fi

if [[ ! -d "${SOURCE_DIR}" ]]; then
   echo "${SOURCE_DIR} is not a directory"
   exit 1
fi

find "${SOURCE_DIR}" -name "*.zip" -type f -exec unzip {} \;

if [[ -d instantclient_11_1 ]]; then
  TMP_DIR=instantclient_11_1
elif [[ -d instantclient_10_2 ]]; then
  TMP_DIR=instantclient_10_2
else
  echo "unable to determine extraction dir"
  exit 1
fi

if [[ -d ${BUILD_DIR} ]]; then
  rm -rf ${BUILD_DIR}
fi

mkdir -p ${BUILD_DIR}
mkdir -p ${BUILD_DIR}/bin
mkdir -p ${BUILD_DIR}/doc
mkdir -p ${BUILD_DIR}/java
mkdir -p ${BUILD_DIR}/lib

cp ${CFG_DIR}/* ${BUILD_DIR}
mv ${TMP_DIR}/*README* ${BUILD_DIR}/doc
mv ${TMP_DIR}/*.html ${BUILD_DIR}/doc
mv ${TMP_DIR}/*.htm ${BUILD_DIR}/doc
mv ${TMP_DIR}/lib* ${BUILD_DIR}/lib
mv ${TMP_DIR}/*.jar ${BUILD_DIR}/java
mv ${TMP_DIR}/sdk ${BUILD_DIR}
mv ${TMP_DIR}/* ${BUILD_DIR}/bin

cd ${BUILD_DIR}/lib
ln -s libclntsh.so.* libclntsh.so
ln -s libocci.so.* libocci.so
ln -s libsqora.so.* libsqora.so

cd ..
tarball=`echo ${SOURCE_DIR} | tr ' ' '-'`
tarball=`basename ${tarball}`
tarball=Oracle-${TMP_DIR}-${tarball}
tar cvf - * | gzip -9c > "../${tarball}.tgz"

cd ..
rm -rf ${BUILD_DIR} ${TMP_DIR}

Once we have the tar ball, we can copy that file to any compatible Linux system, extract it and run the root.sh file which will copy the install to /usr/local/oracle/InstantClient, set up the system variables and build DBD::Oracle for you.

Script2: root.sh

#!/bin/bash

############################################
function copy_instantclient () {
  if [[ `pwd` != "/usr/local/oracle/InstantClient" ]]; then
    if [[ ! -d /usr/local/oracle/InstantClient ]]; then
      echo "Creating /usr/local/oracle/InstantClient directory"
      mkdir -p /usr/local/oracle/InstantClient
    fi

    echo "Copying Oracle Instant Client to /usr/local/oracle/InstantClient" 
    cp -Ra * /usr/local/oracle/InstantClient
  fi
}

#---------
function update_etc_profile () {
  if [[ -f /etc/profile ]]; then
    if [[ `grep -c "ORACLE_HOME" /etc/profile` = 0 ]]; then 
      echo "Updating /etc/profile"
      cat >> /etc/profile < < EOF
  export ORACLE_HOME=/usr/local/oracle/InstantClient
  export TNS_ADMIN=\${ORACLE_HOME}
  export PATH=\${ORACLE_HOME}/bin:\${PATH}
  export CLASSPATH=\${ORACLE_HOME}/classes:\${CLASSPATH}
  export LD_LIBRARY_PATH=\${ORACLE_HOME}/lib:\${LD_LIBRARY_PATH}
  export SQLPATH=\${ORACLE_HOME}/bin
EOF
    else
      echo "Updates to /etc/profile already applied"
    fi
  fi
}

#---------
function update_library_cache () {
  if &#91;&#91; -d /etc/ld.so.conf.d &#93;&#93;; then
    if &#91;&#91; -f /etc/ld.so.conf.d/oracle_instant_client.conf &&  `grep -c "/usr/local/oracle/InstantClient" /etc/ld.so.conf.d/oracle_instant_client.conf` != 0 &#93;&#93;; then
       echo "Updates to /etc/ld.so.conf.d/oracle_instant_client.conf already applied"
    else
      echo "Updating /etc/ld.so.conf.d/oracle_instant_client.conf"
      echo "/usr/local/oracle/InstantClient" > /etc/ld.so.conf.d/oracle_instant_client.conf
      /sbin/ldconfig
    fi
  else
    if [[ `grep -c "/usr/local/oracle/InstantClient" /etc/ld.so.conf` == 0 ]]; then
      echo "Updating /etc/ld.so.conf"
      echo "/usr/local/oracle/InstantClient" > /etc/ld.so.conf
      /sbin/ldconfig
    else
      echo "Updates to /etc/ld.so.conf already applied"
    fi 
  fi
}

#---------
function print_env () {
  echo "Add the following to the rc.d script for any daemon processes that need to access Oracle.  For example, apache"
  echo '  export ORACLE_HOME=/usr/local/oracle/InstantClient
  export TNS_ADMIN=${ORACLE_HOME}
  export PATH=${ORACLE_HOME}/bin:${PATH}
  export CLASSPATH=${ORACLE_HOME}/classes:${CLASSPATH}
  export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
  export SQLPATH=${ORACLE_HOME}/bin'
}

#---------
function install_DBD-Oracle () {
  echo "Building DBD::Oracle"
  DBDORA=`ls DBD-Oracle-*`

  if [[ -f ${DBDORA} ]]; then
    tar zxf ${DBDORA} 
    cd DBD-Oracle* 
    TMP_DBDORA=`pwd`
    TMP_DBDORA=`basename ${TMP_DBDORA}`
  	perl Makefile.PL -m $ORACLE_HOME/sdk/demo/demo.mk
    make && make install
    cd ..
    rm -rf ${TMP_DBDORA}
  else
    echo "Unable to find DBD-Oracle file"
  fi
}

############################################

export ORACLE_HOME=/usr/local/oracle/InstantClient
export TNS_ADMIN=${ORACLE_HOME}
export PATH=${ORACLE_HOME}/bin:${PATH}
export CLASSPATH=${ORACLE_HOME}/classes:${CLASSPATH}
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
export SQLPATH=${ORACLE_HOME}/bin

copy_instantclient
update_etc_profile
update_library_cache
print_env
install_DBD-Oracle

Share Button

Installing Oracle 10g / 11g on Ubuntu 8.04.1 (Hardy Heron) Server JEOS in VMware Server 1.0x/2.0x

I’ve been tasked with becoming an Oracle DBA, so I need to be able to create an VMware Server image containing 32 bit Ubuntu 8.04.1 Server JEOS and Oracle 10g. Much of the work was taken from Augusto Bott‘s Installing Oracle 11g on Ubuntu Linux 7.10 (Gutsy Gibbon) and Peter Cooper‘s How to Install VMware Tools on Ubuntu Hardy 8.04 under VMware Fusion.

I was able to consolidate the methods to work rather well together. As soon as Ubuntu 8.10 Server JEOS (Intrepid) is released, I’ll verify the procedure on that operating system as well.

If you’re looking for instructions on how to install Oracle 11 XE on Ubuntu 8.04.1, look at Installing Oracle Database XE on Debian, Ubuntu, and Kubuntu by Todd Trichler.
Create a VMware Image with the following settings

  1. Choose 32bit Ubuntu for the OS type
  2. 1024 MBytes RAM
  3. 16GBytes disk space
  4. Ubuntu 8.04.1 (or higher) Server JEOS edition http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos
  5. Upon the os installation, create a non “oracle” id to use to administer the os.

Install the required updates and packages

$ sudo aptitude update
sudo aptitude safe-upgrade
sudo aptitude install build-essential xinetd linux-headers-`uname -r` openssh-client openssh-server unzip libaio1 gawk ksh rpm libmotif3 alien lsb-rpm libtool libxtst-dev libxtst6 libstdc++5

Add swap

$ sudo dd if=/dev/zero of=/extraswap bs=1M count=1536
sudo mkswap /extraswap
sudo swapon /extraswap
sudo echo "/extraswap   none   swap   sw   0   0" >> /etc/fstab

# "/sbin/swapon -s" should show the added swap space
/sbin/swapon -s
Filename				Type		Size	Used	Priority
/dev/mapper/oracle10g-swap_1            partition	401400	92	-1
/extraswap                              file		1048568	0	-2

If VMware Server version is 2.0x or higher, install VMware tools:

$ sudo su - root
mount /dev/cdrom
cp /media/cdrom/*.gz ~
tar zxvf VMwareTools*.tar.gz
cd vmware-tools-distrib
./vmware-install.pl

If VMware Server version is 1.0x, install VMware tools:

$ sudo su - root
mount /dev/cdrom
cp /media/cdrom/*.gz ~
aptitude install libgtk2.0-dev libproc-dev libdumbnet-dev xorg-dev wget
wget http://mesh.dl.sourceforge.net/sourceforge/open-vm-tools/open-vm-tools-2008.04.14-87182.tar.gz
tar xzvf VMware*.gz ; sudo tar xzvf open-vm-tools*.gz ; cd open-vm-tools-2008.04.14-87182/
./configure && make
cd modules/linux/
for i in *; do mv ${i} ${i}-only; tar -cf ${i}.tar ${i}-only; done
cd ../../..
mv -f open-vm-tools-2008.04.14-87182/modules/linux/*.tar vmware-tools-distrib/lib/modules/source/ ; cd vmware-tools-distrib/
sudo ./vmware-install.pl
sudo reboot

Append to /etc/sysctl.conf

$ sudo cat >> /etc/sysctl.conf < <EOF
fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
EOF&#91;/bash&#93;

Append to /etc/security/limits.conf
&#91;bash&#93;$ sudo cat >> /etc/security/limits.conf < <EOF
oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535
EOF&#91;/bash&#93;

Append to /etc/pam.d/login
&#91;bash&#93;$ sudo cat >> /etc/pam.d/login < <EOF
session required /lib/security/pam_limits.so
session required pam_limits.so
EOF&#91;/bash&#93;

Set up user / groups
&#91;bash&#93;$ sudo su - root
addgroup oinstall ; addgroup dba ; addgroup nobody ; usermod -g nobody nobody ;  useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
passwd oracle
mkdir /home/oracle ; chown -R oracle:dba /home/oracle ; ln -s /usr/bin/awk /bin/awk ; ln -s /usr/bin/rpm /bin/rpm ; ln -s /usr/bin/basename /bin/basename ; mkdir /etc/rc.d
for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
mkdir -p /dbms/oracle ; chown -R oracle:dba /dbms/oracle ;  sysctl -p
reboot&#91;/bash&#93;

Retrieve Oracle 10g zip file
<ol>
	<li>Copy the Oracle install zip file from disc or somewhere</li>
	<li>Unzip it</li>

Retrieve IP of the network card
$ ifconfig |grep "Bcast"

Install / Configure oracle manually verifying any requirements:

$ ssh -C -X oracle@(ipaddress)
...
cd /home//database
./runInstaller -ignoreSysPrereqs

iSQL*Plus URL:
http://(ipaddress):5560/isqlplus

iSQL*Plus DBA URL:
http://(ipaddress):5560/isqlplus/dba

Enterprise Manager 10g Database Control URL:
http://(ipaddress):1158/em

Share Button