Out Here In The Field : Journeys


ORA-27054 : Failed to create dump of Oracle database over NFS
December 17, 2008, 5:21 am
Filed under: *Nix, HP-UX

My previous post was regarding how to setup NFS server on HP-UX. It is used as target to dump database from an Oracle 10g.

The first thing that I have to do is, of course to make sure that the NFS share is automatically mounted on startup by adding a line on my /etc/fstab. The client  is on HP-UX 11.23 also

# vi /etc/fstab

This is the line that I add to the end of /etc/fstab file:

hqcmsdb2:/backup/dump /backup/dump nfs proto=tcp,rw,intr,bg,rsize=32768,wsize=32768 0 2

Please note that the lines above is intended to be written on a single line. The NFS share is mounted on /backup/dump. I was also able to write to the folder using oracle user account. Mount the share…

# mount /backup/dump

… and start the dump process. But the process logged an error, saying this:

“ORA-27054: NFS file system where the file is created or resides is not mounted with correct options

A short trip to google land told me that Oracle 10GR2 checks for certain parameter to be present on an NFS share before it start the dump process. Namely forcedirectio, vers=3, and hard. After trying several suggestion, this is my current entry on /etc/fstab

hqcmsdb2:/backup/dump /backup/dump nfs proto=tcp,forcedirectio,vers=3,rw,hard,intr,bg,rsize=32768,wsize=32768 0 2

After remounting the /backup/dump folder, I was able dump the database normally like it should be.

Please note that this is done on HP-UX system. Please consult the manual for fstab of your *Nix flavor for the similar parameters




Activating NFS server on HP-UX 11.xx
December 11, 2008, 5:29 am
Filed under: *Nix, HP-UX | Tags: ,

This is done on HP-UX v 11.23.

  1. Make NFS Server to autostart
    • Open /etc/rc.config.d/nfsconf

      # vi /etc/rc.config.d/nfsconf

    • Change NFS_SERVER paramater from “0″ to “1″, then save.

      NFS_CLIENT=1
      NFS_SERVER=1
      NUM_NFSD=16
      NUM_NFSIOD=16
      PCNFS_SERVER=0

  2. Share some directories
    • Open /etc/exports

      # vi /etc/exports

    • add directories that you want to share to the file, for example:

      /var/opt/ignite/clients -anon=2
      /var/opt/ignite/recovery/archives/hqcmsdb1 -anon=2,access=hqcmsdb1
      /backup/dump -access=hqcmsdb1

      the parameter “-anon=2” means all anonymous access will be given default uid “2” while the parameter “-acess=hqcmsdb1” means only that server is allowed to mount the share. No parameters means the directories shared with read write access for everyone. For more infos and examples, type “man 4 exports” on the console

    • Update the share

      # /usr/sbin/exportfs -a

    • Make sure the right folder are shared

      # /usr/sbin/exportfs
      /var/opt/ignite/clients -anon=2
      /var/opt/ignite/recovery/archives/hqcmsdb1 -anon=2,access=hqcmsdb1
      /backup/dump -access=hqcmsdb1

  3. Start NFS Server
    • Check whether NFS is already started or not

      # ps -ef | grep nfsd
      root 2309 2308 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2333 2312 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2332 2312 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2307 1 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2334 2312 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2308 1 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2310 2309 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2312 2308 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2313 2308 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2316 2308 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2315 2313 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2314 2308 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2317 2308 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16
      root 2318 2309 0 20:22:54 ? 0:00 /usr/sbin/nfsd 16

      If the output is similar to the above example, then the nfsd is already started, if not..

    • start the nfsd daemon

      # /sbin/init.d/nfs.server start

  4. Test whether the shared directories can be mounted from the target server
    • Mount the shared directory manually

      # mount -F nfs hqcmsdb2:/backup/dump /backup/dump

    • Check whether the directory is mounted correctly

      # mount
      / on /dev/vg00/lvol3 ioerror=nodisable,log,dev=40000003 on Sun Dec 7 18:03:17 2008
      /stand on /dev/vg00/lvol1 ioerror=mwdisable,log,nodatainlog,tranflush,dev=40000001 on Sun Dec 7 18:03:18 2008
      /var on /dev/vg00/lvol8 ioerror=mwdisable,delaylog,nodatainlog,dev=40000008 on Sun Dec 7 18:03:31 2008
      /var/opt/ignite/recovery/archives on /dev/vg00/lvol10 ioerror=mwdisable,largefiles,delaylog,nodatainlog,dev=4000000a on Sun Dec 7 18:03:31 2008
      /usr on /dev/vg00/lvol7 ioerror=mwdisable,delaylog,nodatainlog,dev=40000007 on Sun Dec 7 18:03:31 2008
      /u01 on /dev/vg00/lvol9 ioerror=mwdisable,delaylog,nodatainlog,dev=40000009 on Sun Dec 7 18:03:31 2008
      /backup/dump on hqcmsdb2:/backup/dump rsize=32768,wsize=32768,NFSv3,dev=7 on Wed Dec 10 20:37:33 2008

Aand.. I think we’re done



Scheduling a move file using cron and scp
October 6, 2008, 1:21 pm
Filed under: *Nix, HP-UX, Red Hat, Ubuntu | Tags: , , , ,

So I need to automate a process where an oracle dump file is moved to a remote server, and the existing loacl file is then permanently removed. I have to make sure that:

  1. the status of copy process is reported, whether successful, or not
  2. The remove process will only start if the copy process is successful
  3. The copy process is unattended, so a public key authentication must be available between the local and remote server. I have guide regarding a public key authentication for ssh/scp somewhere around here

This is how the script looked like:


#!/sbin/sh
date >> /backup/movedump.log
tgl=$(date +”%y-%m-%d-%M”)
cd /backup
if [ -f /backup/dumpf* ];
then
scp dumpf* kirim@172.16.2.15:/opt/data/dump/backup/
STAT=$?
echo “$tgl-S1:dump file succesfuly moved” >> /backup/movedump.log
else
STAT=1
fi
if [ $STAT -eq 0 ];
then
rm dumpf*
echo “$tgl-S2:local dump file deleted” >> /backup/movedump.log
else
if [ $STAT -eq 1 ];
then
echo “$tgl-E1:no dump file on source directory, no action taken” >> /backup/movedump.log
else
echo “$tgl-E2:dump file move process exit with code $STAT, remove process not executed” >> /backup/movedump.log
fi
fi

The code above will check whether the dumpfile exists or not. If the file doesn’t exist, the variable STAT will be given a value of 1. If the file exist, it will begin scp process to the remote server. Scp process provide us with several report codes that is stored on “$?”. If the copy process is successful, the value of “$?” is 0, other if it’s not. That value is then stored on the variable STAT

The process then proceed based on the value inserted to the variable STAT

  1. If STAT=0, the copy process is successful, the script will proceed to remove the dump file on the local server
  2. if STAT=1, the script did not find a dump file to transfer to remote server
  3. if STAT value is other than 1 and 0, the transfer process has failed

All of the step taken by the script is logged on file movedump.log

The next step is to make sure the script is executed everyday, automatically. For me, it is scheduled to run 4 pm, everyday:.

$crontab -e

Then put this line:

00 16 * * * /backup/movedump.sh

With this, the script will be executed every day at 4 pm sharp.

Done!