Monday, May 9, 2011

Customized Data Backup in Oracle

To take a data backup, there are many options available such as using RMAN, taking a dump using export and export pump utilities. But sometimes you need to backup specific data from specific tables at certain intervals. Here is an example of how to do this. I have done this on XE. This post also gives an idea of using XE in commercial environments by managing the data size restrictions of oracle XE. In this example, we backup data which is more than 45 days old from a particular table.
First we create a directory object that refers to the location where the dump files will be stored. Also, grant appropriate access rights to the directory object.


Next, we define the procedure which does the data backup.


now that we have the procedure ready, we will create and schedule a job that will call this procedure at an interval defined by us.
create the job as shown in the following code.

This job will run everyday at 2 am. It will backup data which is 45 days old from the table MY_TABLE01. You can access the DMP files at the location mentioned in the directory object. Just make sure you have read/write access to the directory on the linux filesystem.
If you want to backup data from multiple tables, then either repeat the backup code in the procedure for another table using a new job handle, if there is no common relation between the data or else use the same handle code to list additional tables provided the same filter query can be applied to all the tables.

Monday, April 18, 2011

Hiding calendar control in APEX

If we do this,

It disables the text compoenent of  the calendar control, but the calendar icon still remains visible.
To hide the control completely, i.e the text part as well as the calendar icon, use the DOM and the html_HideElement function. see below the tweaked function courtesy OTN.
Lets say for example, we have to show or hide the calendar control based on the selected values from an LOV. i.e. for some values the calendar is to be shown and for some other values the calendar is to be hidden. this can be achieved as shown below


call the function onChange of LOV values.

Thursday, August 26, 2010

Essential Linux Command Tips

extracting files:
for .bz2 files
# tar -xvjf myfile.tar.bz2

for .gz files
# tar -xvzf myfile.tar.gz

compressing files:
use the -c switch intead of -x
# tar -cvzf linux-2.6.30-2.tar.gz

if you want to specify a directory,
# tar -cvzf linux-2.6.30-2.tar.gz mydir

rpms on RHEL:
installing-
# rpm -ivh filename.rpm

removing-
# rpm -e filename.rpm

checking if a package is installed-
# rpm -qa | grep gcc
this will give you the versions of gcc if it is installed.

checking size of a directory:
# du -sh
this will give the size of the current directory
# du -sh /var/lib
this will give the size of the /var/lib directory. 's' will not display the contents i.e. silent mode and 'h' will print int in human readable form (MB)

viewing only directories:
# ls -d */

Redhat Version:
# cat /etc/redhat-release

kernel version:
# uname -a

displaying year in the ls output:
# ls -l --full-time

print filesystem features:
# debugfs -R features /dev/hdc1

getting count of the listing provided by ls:
# ls | wc -l

label a partition:
# e2label /dev/sda1 mylabel

tuning a filesystem:
# tune2fs -c 1 /dev/sda1
this will perform an fsck at every boot on partition sda1. other parameters can be given accordingly. RTM (missing a letter ;- )

re-setting a symbolic link:
# ln -f -s /var/lib/foo.sh bar.sh
bar.sh file's original link will be reset to the new one specified.

Friday, July 17, 2009

Ingredients for Achievement

Some time back, while doing my masters at the University of Technology, Mauritius, I implemented a well known technique. Everyone knows about this technique but as time passes we keep forgetting about it. It helped me to come first with distinction in my Cohort.

first and foremost you need to have a goal.
secondly, you need to have motivation for achieving the goal
thirdly, you need to have a means to achieve the goal
and lastly, you need to work hard

the second point is very important and serves as the driving force. having or creating a proper means to achieve the goal is also necessary or else all our hard work will not bear fruit.

i had forgotten about these four points, until today. I'm writing it down for you and me.