Thursday, January 31, 2008

Perl: CPAN or RPM packages?

Maybe this is just CentOS 5.1 related issue, but...
 
For those of you who will install MailScanner - just a small tip to avoid problems. Spend some time and install required perl modules from CPAN. This will save you some time on fixing SpamAssassin and some other perl modules.

Tuesday, January 22, 2008

Manually configure Enterprise Manager Console

Run emca -config dbcontrol db and follow the instructions.

Monday, January 21, 2008

Redo log size & performance

We got a performance issue with our Oracle 10g. Suddenly the performance was going down and we was getting a significant increase on wait times. After sniffing around and asking a friend we found that:

  1. All our performance pick were related with time when our Oracle was writing the archive log.
  2. There is a direct relationship between log_buffer, redo log file size and performance.
So, here is a tip. Your redo log file size must be multiple by 2 of your log_buffer. What I mean is that if your log_buffer is 5 MB your redo log file size can be 10 MB (2 x 5 MB), 20 MB (4 x 5 MB), 30 MB (6 x 5 MB) and so on...

Wednesday, January 16, 2008

Ctrl+click with two fingers

Enable Ctrl+click with two fingers click in System Preferences -> Keyboard & Mouse -> Trackpad -> Tap trackpad using two fingers for secondary click. Believe me, it's quite comfortable.

List of all Max OS X keyboard shortcuts

Will be useful for all Mac users. A kind of 'print-it-and-put-in-front-of-you-until-you-remember'.


Taking screenshots in Leopard

To take a screenshot in Leopard just press Cmd + Shif + 3 if you want to take a full screen or Cmd + Shift + 4 if you want to take a screenshot of some region.

 
Cmd + Shift + 3 or 4 will make the same, but instead of saving a PNG file to your Desktop will copy a screenshot to clipboard.
 
After pressing Cmd + Shit + 4 you can use:
  • Spacebar - to take a screenshot of window (active or background)
  • Shift - to lock your region horizontally or vertically
  • Option - to resize your region proportionally

Reverse tunnel with SSH

When you need to create a reverse tunnel with SSH, just use the following:

 
ssh -R PORT_ON_REMOTE_SERVER:localhost:PORT_ON_LOCAL_SERVER -l LOGIN REMOTE_SERVER

Sun to acquire MySQL

There is a bunch of people who thinks that MySQL is a kind of database that is being used just for small projects. For those of you - take a look here. 1 billion USD for a small projects database solution? And if you still don't consider MySQL as possible database solution for your "serious" project - take a look here and here.

More comfortable environment

After installing new Linux or Unix system I like to edit /etc/profile or $HOME/.bash_profile and add following lines:

 
alias vi="vim -o"
alias ll="ls -l"
alias la="ls -la"
export EDITOR=vi
 
First line is to use vim instead of vi. Second and third lines will create two aliases for ls -l and ls -la commands. And forth line is to use vi always as system editor. 
 
YES, I love vi!

Show archive logfiles sequence

Quick SQL to see if your archive log had been applied:
 
SELECT SEQUENCE#, APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

Manually register new archive log

If you need to register archive log in Oracle by hand:

 
alter database register logfile '/some_direcotry/some_file.arc';

Rebooting linux without reboot command

Just a sample of how you can reboot or shutdown linux without issuing reboot command, so called hard reboot. That means that system will just make a reset as if you pressed a reset button, without running any shutdown scripts, etc. A kind of dangerous staff, but can be helpful in some occasions.


echo 1 > /proc/sys/kernel/sysrq 
echo b > /proc/sysrq-trigger
 
If you want to force shutdown machine try this.

echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger

Perl inline replacement

Sometimes you need to replace something in a bunch of files. And this something is quite complex, so you can describe it only with regular expressions, or, by some other reason you need to use perl in your replacement string. Here is a small sample I'm using:

perl -p -i -e "s/SEARCH_STRING/REPLACEMENT_STRIGN/g"