Browsing "Older Posts"

APEX-AT-WORK no image

Update of my example application

Von Tobias Arnhold → 10.08.2009
Hi!

Out of some reason Oracle does not provide the applications from the APEX Developer Competition 2009.

Some winners already provided there applications:
Matt Nolan: APEX Plugin Registry Application
Martin Giffy D'Souza: APEX Rules & Guidelines

I just updated my example application as well:

APEX-AT-WORK Developer Competition 2009 Edition
Description: This application is an upgrade of the original APEX-AT-Work Example application. It includes lots of new examples, a new layout, new techniques (like screen casts) and an extended documentation. It is not a normal APEX application which includes lot's of business logic. This application shows how to use the new technologies out there. The core is based on a javascript library called ExtJS. This library creates a completely new look and feel which makes APEX even nicer to use. But also rarely used APEX WEB 2.0 features are integrated based on typical examples.

About the competition:
Oracle.com: Oracle Application Express Developer Competition 2009
David Peake's Blog: Winners of APEX Developer Competition 2009
OTN Blog: Congrats to the Oracle Apex Developer Competition 2009 Winners
Oracle.com: Rules

I must object another behavior what I can't understand. Why aren't there any jury judgments. I really would have loved to know what for example Dimitri thought about my application. I guess all other developers think the same.

Anyway I wish everybody a really exciting OOW.
APEX-AT-WORK no image

Linux bash: Save command and command output in logfile

Von Tobias Arnhold → 10.01.2009
Creating logfiles in a linux environment can be done with > or >> or &> or tee or script but using these commands inside a shell script which should save both the command and the command output becomes really tricky.

With > and >> you just get the command output.
With tee you just get the command output.
With script you get both but it didn't work inside my shell script.

I went on googleling and found a solution:
Capture the command run in the log file

{
set -x
pwd
set +x
} > yourlog.txt 2>&1

I used this small script inside my backup routine:

#!/bin/bash
{
set -x

echo ------------------------------------------------
echo -- - - - - RMAN LEVEL 0 Backup Script - - - - --
echo -- - - - - - - - - - - - - - - - - - - - - - ---
echo -- - - - - Creator: Tobias Arnhold - - - - - ---
echo ------------------------------------------------
echo

echo ------------------------------------------------
echo -- - - - - - - - Start backup - - - - - - - - --
echo ------------------------------------------------
echo

echo -- Set variables
ORACLE_SID=XE
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
FRA_HOME=/oracle/flash_recovery_area/XE
ORA_SCRIPTS=/oracle/scripts
DATUM=`date +"%Y%m%d%H%M%S"`
echo

echo -- Delete old log files
rm -r $FRA_HOME/backuplog/XE_*
echo

echo -- Start RMAN backup
echo -- See logfile: $FRA_HOME/backuplog/XE_FULL_BACKUP.log
rman target / nocatalog cmdfile=$ORA_SCRIPTS/FULL_BACKUP.sql log=$FRA_HOME/backuplog/XE_FULL_BACKUP.log
echo

echo -- Delete old INIT.ORA files
rm -r $FRA_HOME/initora/*
echo -- Create new INIT.ORA files
cp /oracle/admin/pfile/init.ora $FRA_HOME/initora
echo

... More commands

echo -- Delete empty directories
find $FRA_HOME/backupset -type d -empty -exec rmdir {} \;
echo

echo -- Rename RMAN backup file
cd $FRA_HOME/backuplog/
mv XE_FULL_BACKUP.log XE_FULL_BACKUP.$DATUM.log
mv XE_ARC_BACKUP.log XE_ARC.$DATUM.log
echo

echo ------------------------------------------------
echo -- - - - - - - - Backup finished - - - - - - ---
echo ------------------------------------------------
echo

set +x
} &> /oracle/flash_recovery_area/XE/backuplog/FULL_BACKUP.log
# write log file

# replace all "+ echo" lines inside the log file
LOG_HOME=/oracle/flash_recovery_area/XE/backuplog
sed "/+ echo/d" $LOG_HOME/FULL_BACKUP.log > $LOG_HOME/tmp
mv $LOG_HOME/tmp $LOG_HOME/FULL_BACKUP.log
exit

Now I have a really nice logfile:

------------------------------------------------
-- - - - - RMAN LEVEL 0 Backup Script - - - - --
-- - - - - - - - - - - - - - - - - - - - - - ---
-- - - - - Creator: Tobias Arnhold - - - - - ---
------------------------------------------------

------------------------------------------------
-- - - - - - - - Start backup - - - - - - - - --
------------------------------------------------

-- Set variables
+ ORACLE_SID=XE
+ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
+ FRA_HOME=/oracle/flash_recovery_area/XE
+ ORA_SCRIPTS=/oracle/scripts
++ date +%Y%m%d%H%M%S
+ DATUM=20090901095244

-- Delete old log files
+ rm -r /oracle/flash_recovery_area/XE/backuplog/XE_FULL_BACKUP-2009-08-31.log

-- Start RMAN backup
-- See logfile: /oracle/flash_recovery_area/XE/backuplog/XE_FULL_BACKUP.log

-- Delete old INIT.ORA files
+ rm -r /oracle/flash_recovery_area/XE/initora/init.ora
-- Create new INIT.ORA files
+ cp /oracle/admin/pfile/init.ora /oracle/flash_recovery_area/XE/initora

... More log informationen

-- Delete empty directories
+ find /oracle/flash_recovery_area/XE/backupset -type d -empty -exec rmdir {} \;
find: /oracle/flash_recovery_area/XE/backupset/2009_08_30: Datei oder Verzeichnis nicht gefunden
find: /oracle/flash_recovery_area/XE/backupset/2009_08_31: Datei oder Verzeichnis nicht gefunden

-- Rename RMAN backup file
+ cd /oracle/flash_recovery_area/XE/backuplog/
+ mv XE_FULL_BACKUP.log XE_FULL_BACKUP.20090901095244.log
+ mv XE_ARC.log XE_ARC.20090901095244.log

------------------------------------------------
-- - - - - - - - Backup finished - - - - - - ---
------------------------------------------------

+ set +x

Hope it can help some of you who are searching for better looking logs.