Tuesday, November 27, 2007

Oracle minimal client installation

1. Oracle basic client/or basic lite in case you need only English language. (oracle litebasic for windows is only 8 megs, how beautiful is that!)

2. These environment variables are to be set:

$ENV{'ORACLE_HOME'} = "d:/oracle";
$ENV{'TNS_ADMIN'} = "d:/oracle";
$ENV{'LD_LIBRARY_PATH'} = "d:/oracle";

3. Put tnsnames.ora in the path specified by $ENV{'TNS_ADMIN'}

Sunday, November 25, 2007

DBD::Oracle Activestate Perl on Windows

1. Oracle 9 oci.dll has problems with the function calls within oralce.dll by Activestate

2. Do not use the Graphical Perl Package Manager use ppm install/uninstall command prompt tool instead

3. Download the Oracle instant client avaiable from Activestate. (agree to the oracle disclaimer at the end of the ppm install DBD-oracle)

4. If after complete installation of DBD-Oracle still you got messages like procedure entry point not found, replace the oralce client oci.dll with the ones provided by activestate.

You are good to go

Monday, November 19, 2007

Oracle Sort Paging

Oracle does not have the keyword limit like mysql, you have to select couple of rows and limit them by rownumbers, this may cause problems when sorting because you may only sort the set that you have selected, so first select and sort all then limit by rownums

select * from
    (select p.*, rownum r from
        (select * from all_objects order by object_name) p
    where rownum < 20)
where r > 10;

THANKS ASKTOM

Friday, November 16, 2007

bash echo problem with filenames with whitespaces

taken from http://textsnippets.com/posts/show/1105 --thanks so much guys

Bash Internal field seperator has to be changed to $'\n' like this

export IFS=$'\n'

now when u do
for i in `ls`;echo $i;done

spaces will not be treated as field seperators and consequently the whole filename is displayed completely.

Sunday, November 11, 2007

ORACLE 9 installation document error

ALTHOUGH oracle 9 installation document tells you that ORACLE_BASE does not have to be set prior to installation of oracle, THIS IS TOTAL BULLSHIT!!!!! YOU HAVE TO SET ORACLE_BASE.

Monday, November 05, 2007

solaris install window decoration/theme

solaris install window decoration/theme with http://www.blastwave.org CSW qt and kde packages. (all installed in default locations)

./configure --with-qt-dir=/opt/csw/kde-gcc --with-qt-includes=/opt/csw/include

** in case KDE libs were not being found although they were installed remove QT libs from $LD_LIBRATY_PATH just keep KDE libs,

*** REMOVE anything you added to LD_LIBRARY_PATH in case your applications started behaving erratically.

Tuesday, October 30, 2007

Solaris manual default gateway change

route add -net 0.0.0.0/0 163.183.37.1

Solaris Ethernet connectivity related files

/etc/hosts
/etc/nodenames
/etc/hostname.[device]
/etc/defaultrouter
/etc/defaultdomain
/etc/nodename

Monday, October 29, 2007

Perl regular expressions

(a*b*)* in perl == ((a*b*)*)

matches can be accessed in internal var$ $1,..$n
complete match is in $&

[a-zA-Z0-9] = \w

(\w*) = macthes anything alphanumeric + "_"

$line =~ m/((\w*-*)*)/; will match combinations of above plus "-"
$result = $1;
or
$result = $line =~ m/((\w*-*)*)/;

Tuesday, October 23, 2007

Read man pages directly

nroff -man smbmount.8 | more

Putty login with no password

1. ssh-keygen -t rsa -C ali@ali.com -f ~/.ssh/id_rsa
2. mail -s "my private ssh key" ali@ali.com < ~/.ssh/id_rsa
3. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys2
4. chmod 600 ~/.ssh/authorized_keys2
5. download http://the.earth.li/~sgtatham/putty/0.60/x86/puttygen.exe
6. Convert the save key from email and save as private key file.
7. in Putty->SSH->Auth select the file.

To disable password based login after creating the public/private key pair

change the following in /etc/ssh/sshd_confing
PermitRootLogin no
PasswordAuthentication no
UsePAM no

*** REMEMBER NOT TO LOSE THE private key
HAVE PHUN

Monday, October 22, 2007

Oracle drop user error

ORA-00600: internal error code, arguments: [qmxiUnpPacked2], [121], [], [], [],
solution:
connect as sysdba
1)SQL> shutdown immediate

2)SQL> startup migrate

3)SQL> spool patch.log

4)SQL> @?/rdbms/admin/catpatch

5)SQL> spool off

Oracle create database and user

Oracle create user in 3 steps;
1. RUN DBCA successfully.
2. SQL> create user username identified by password default tablespace users temporary tablespace temp;
3. SQL> grant connect, resource to username;

Sunday, October 21, 2007

mysql startup on solaris

cd /usr/local/mysql1/bin
./mysql_install_db --user=mysql --ldata=/sqldata
./mysqld_safe --datadir=/sqldata --user=mysql &

Saturday, October 20, 2007

Solaris Samba Mount using shlight

shlight //srv0r/Segnts/Gest/SUPPORT //root/win -U alisadeghi -P alipassword -W domain

Saturday, September 22, 2007

Solaris Default Route

edit /etc/defaultrouter
route add default $ROUTER_IP_ADDRESS

Tuesday, September 11, 2007

make Perl modules on Solaris with GCC

To prevent the usual problems due to the lack of CC on solaris, you should download and install GCC from sunfreeware.com then change the following parameters in the Makefile and do make & make install

1. Change CC=cc to CC=gcc or ln -s gcc to cc
2. Change
CCCDLFLAGS = -KPIC
to
CCCDLFLAGS =
3. Change
OPTIMIZE = -xO3 -xspace -xildoff -xarch=v8
to
OPTIMIZE =
4. Change
CCFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO
to
CCFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO

source: http://atmail.com/view_article.php?num=251
We thank the superman above who initially wrote this!

Monday, September 03, 2007

HTML within Perl code

print<<"tab1";
#HTML CODE GOES HERE
tab1

Thursday, August 09, 2007

Install Cisco VPN Client on Linux

#!/bin/bash

# Fedora Core Cisco VPN Client install notes by Jason Roysdon - http://jason.roysdon.net/
# Creative Commons Attribution-ShareAlike 2.5 - http://creativecommons.org/licenses/by-sa/2.5/
# http://jason.roysdon.net/credits.html

# This patch allows the Cisco VPN Client 4.8.00 (0490) to install with the 2.6.19 kernel.
# It should work for other distros, but here are my FC5/FC6-specific notes.
#

# original source of fix:
# http://www.tuxx-home.at/cmt.php?article=/2006/12/07/T09_36_48/index.html
# patch:
# http://www.tuxx-home.at/projects/cisco-vpnclient/vpnclient-linux-2.6.19.diff

# Run as this as root

# fc3 had the kernel source info with the kernel rpm before, but as of kernel-2.6.12-1.1372_FC3 the following is required:
yum -y install kernel-devel
# with fc5, I now have to install the following for my P4 which looks like an SMP:
yum -y install kernel-smp-devel.i686

mkdir -p /opt/download
cd /opt/download

echo You must login to CCO manually and attempt to download the client for their ftp server to recognize your request:
echo http://cisco.com/cgi-bin/tablebuild.pl/vpnclient-3des
wget -c --user=YOUR-CCO-USER --password=YOUR-CCO-PW http://ftp-sj.cisco.com/cisco/crypto/3DES/vpn/client/linux/vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz
wget -c --user=YOUR-CCO-USER --password=YOUR-CCO-PW http://ftp-sj.cisco.com/cisco/crypto/3DES/vpn/client/linux/vpnclient-linux-4.8.00.0490-readme.txt

tar xfvz vpnclient-linux-x86_64-4.8.00.0490-k9.tar.gz
cd vpnclient

# get 2.6.19 patch
wget -c ftp://jason.roysdon.net/pub/jroysdon/linux/vpnclient-linux-2.6.19.diff
patch -i vpnclient-linux-2.6.19.diff

# create /usr/local/bin, as on FC6 it doesn't exist by default
mkdir -p /usr/local/bin

# run the install, take the defaults
./vpn_install

# I want my non-root user to be able to start the vpn
chmod 4111 /opt/cisco-vpnclient/bin/cvpnd

# start the service the first time
/etc/init.d/vpnclient_init start

# I like to quickly be able to see what connections I have with a custom 'vpnlist' command:
echo echo > /usr/local/bin/vpnlist
echo echo /etc/opt/cisco-vpnclient/Profiles/ >> /usr/local/bin/vpnlist
echo ls -b /etc/opt/cisco-vpnclient/Profiles/ >> /usr/local/bin/vpnlist
echo echo >> /usr/local/bin/vpnlist
chmod 4111 /usr/local/bin/vpnlist

# I use runlevel 4 for when I'm trying to preserve battery or want a fast bootup and want minimal services running
chkconfig --level 4 vpnclient_init off

Saturday, July 21, 2007

HLRCHECK Script

1. Linux of Other BSD system
2. Apache 2
3. Perl (Net::Telnet, DBD, DBI::Oracle)
4. Oracle Client
5. JRE 1.5
6. Mcreate Query Library (Leonard has the source)
7. Good RAM
8. As an enhancement this app should be forked into three children and each should do each of the tasks.


Scripts

1. hlrcheck:/var/www/html/index.html
2. hlrcheck:/var/www/cgi-bin/telnet2.cgi
3. hlrcheck:/var/www/cgi-bin/telnet1.cgi