Friday, December 23, 2011

RAC DB faq's

To Check status of RAC DB:
===========================
[oracle@slc00ypo ~]$ srvctl status database -d ORCL
Instance ORCL1 is running on node slc00ypo
Instance ORCL2 is running on node slc00ypp
[oracle@slc00ypo ~]$


[oracle@slc00ypo ~]$ srvctl status nodeapps
VIP slc00ypq is enabled
VIP slc00ypq is running on node: slc00ypo
VIP slc00ypr is enabled
VIP slc00ypr is running on node: slc00ypp
Network is enabled
Network is running on node: slc00ypo
Network is running on node: slc00ypp
GSD is disabled
GSD is not running on node: slc00ypo
GSD is not running on node: slc00ypp
ONS is enabled
ONS daemon is running on node: slc00ypo
ONS daemon is running on node: slc00ypp


[oracle@slc00ypo trace]$ crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora.DATA.dg    ora....up.type ONLINE    ONLINE    slc00ypo   
ora....ER.lsnr ora....er.type ONLINE    ONLINE    slc00ypo   
ora....N1.lsnr ora....er.type ONLINE    ONLINE    slc00ypo   
ora.asm        ora.asm.type   ONLINE    ONLINE    slc00ypo   
ora.cvu        ora.cvu.type   ONLINE    ONLINE    slc00ypo   
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE              
ora....network ora....rk.type ONLINE    ONLINE    slc00ypo   
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    slc00ypo   
ora.ons        ora.ons.type   ONLINE    ONLINE    slc00ypo   
ora.orcl.db    ora....se.type ONLINE    ONLINE    slc00ypo   
ora....ry.acfs ora....fs.type ONLINE    ONLINE    slc00ypo   
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    slc00ypo   
ora....SM1.asm application    ONLINE    ONLINE    slc00ypo   
ora....PO.lsnr application    ONLINE    ONLINE    slc00ypo   
ora....ypo.gsd application    OFFLINE   OFFLINE              
ora....ypo.ons application    ONLINE    ONLINE    slc00ypo   
ora....ypo.vip ora....t1.type ONLINE    ONLINE    slc00ypo   
ora....SM2.asm application    ONLINE    ONLINE    slc00ypp   
ora....PP.lsnr application    ONLINE    ONLINE    slc00ypp   
ora....ypp.gsd application    OFFLINE   OFFLINE              
ora....ypp.ons application    ONLINE    ONLINE    slc00ypp   
ora....ypp.vip ora....t1.type ONLINE    ONLINE    slc00ypp   
[oracle@slc00ypo trace]$


RAC DB Connection String:
==========================
I tried :

jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=adc4120554.us.oracle.com) (PORT=1616))
(ADDRESS=(PROTOCOL=TCP)(HOST=adc4120555.us.oracle.com) (PORT=1616))
(CONNECT_DATA=(SERVICE_NAME=ORCL)))

http://programmersjournal.blogspot.com/2008/08/jdbc-connection-string-for-oracle-rac.html


Finding Log File location:
==========================
SQL> connect / as sysdba;
Connected.

SQL> show parameter backg;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
background_core_dump                 string      partial
background_dump_dest                 string      /u01/app/oracle/diag/rdbms/orc
                                                 l/ORCL1/trace
SQL> exit

Tuesday, December 6, 2011

Rsync - Copy from remote hosts

To copy files from remote servers

a) Mount the filesystem locally using NFS.

Run the below :

 rsync   -avtz      /net/host_name-mounted/faovm     /scratch/aime/faovm_local


/net/host_name-mounted/faovm is a NFS point which is mounted locally.

There is a difference in

/net/host_name-mounted/faovm and /net/host_name-mounted/faovm/

/net/host_name-mounted/faovm    :   will copy  faovm directory also.
/net/host_name-mounted/faovm/   : by giving trailing slash it will copy contents inside faovm dir.



-a  archive mode
-v  verbose
-t  preserve time
-z  transfering in a compressed mode , so that transfers are done quickly



Wednesday, November 23, 2011

How to use Vncserver with X or Console

If you want to run Vncserver in console mode,

cd $home/.vnc

=== For console Mode=======
$ cat xstartup
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &


==========================

=== startx (kde mode)============

$ cat xstartup
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
exec /usr/bin/startkde

========================























Thursday, October 20, 2011

Install perl modules

To install mod_perl in ubuntu :

root@ubuntu:/etc/apache2# apt-get install libapache2-mod-perl2

Add below directives in /etc/apache2/httpd.conf

root@ubuntu:/etc/apache2# cat httpd.conf
<Directory /var/www/perl>
Options +ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>
root@ubuntu:/etc/apache2#

Create directory inside /var/www as perl 


cd /var/www
mkdir perl

Permission can be set as below
drwxr-xr-x  2 www-data www-data 4096 2011-10-20 15:33 perl


refer your apache.conf file what user directive is given there ,
by default it is www-data




After installing any perl module restart apache2

root@ubuntu:/etc/apache2# /etc/init.d/apache2 restart



To Check all Perl modules install :

root@ubuntu:/etc/apache2# perl -MCPAN -e 'CPAN::Shell->r'


Apache2::SizeLimit             0.05      0.95  PHRED/Apache-SizeLimit-0.95.tar.gz
B                              1.22      1.31  RJBS/perl-5.15.2.tar.bz2
CGI                            3.43      3.55  MARKSTOS/CGI.pm-3.55.tar.gz
Compress::Zlib                2.020     2.037  PMQS/IO-Compress-2.037.tar.gz
Cwd                            3.30      3.33  SMUELLER/PathTools-3.33.tar.gz
File::MimeInfo::Rox            0.15       0.2  PARDUS/File-MimeInfo/File-MimeInfo-0.14.tar.gz
Filter::Util::Call             1.08      1.39  PMQS/Filter-1.39.tar.gz
HTML::FormatPS                 2.04      2.10  NIGELM/HTML-Format-2.10.tar.gz
I18N::LangTags::Detect         1.03      1.04  LBROCARD/perl-5.12.4.tar.gz
I18N::Langinfo                 0.02      0.07  JESSE/perl-5.13.9.tar.gz
LWP                           5.837      6.03  GAAS/libwww-perl-6.03.tar.gz
List::Util                     1.21      1.23  GBARR/Scalar-List-Utils-1.23.tar.gz
Locale::Constants              2.07      3.16  SBECK/Locale-Codes-3.16.tar.gz
Locale::Country                2.07      3.18  SBECK/Locale-Codes-3.18.tar.gz
Mail::Address                  2.06      2.08  MARKOV/MailTools-2.08.tar.gz
Pod::Man                       2.22      2.25  RRA/podlators-2.4.0.tar.gz
Socket                         1.82      1.94  FLORA/perl-5.13.11.tar.gz
mod_perl2                  2.000004  2.000005  PHRED/mod_perl-2.0.5.tar.gz
233 installed modules have no parsable version number
(use 'o conf show_unparsable_versions 1' to show them)



Also try :

root@ubuntu:/etc/apache2# instmodsh
Available commands are:
   l            - List all installed modules
   m <module>   - Select a module
   q            - Quit the program
cmd? l
Installed modules are:
   Perl
cmd? 1


Place all your perl scripts in /var/www/perl

and test in browser as http://localhost/test/first.pl

Wednesday, October 19, 2011

How to configure IPv6




Once you have enabled IPV6 , it will show in ifconfig entry as inet6 :


To configure IPV6 on Linux VM :



In

/etc/sysconfig/network

Add line :

NETWORKING_IPV6=yes
IPV6_DEFAULTGW= : fe80::200:ff:fe00:0/64


In :

/etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
HWADDR=00:16:3E:76:D6:7D
IPADDR=192.168.122.20
NETMASK=255.255.255.128
IPV6INIT=yes
IPV6ADDR=fe80::216:4eff:fe76:d67d/64      #Primary IPv6 address (Optional)



Add Ipv6
ip addr add fe80::216:4eff:fe76:d67d/64 dev eth0

Remove IPv6
ip addr del 2010:AAA:1::100/64 dev eth0

Add ipv6 gateway
ip route add 2010:BBC:1::1 dev eth0

remove ipv6 gateway
ip route del 2010:BBC:1::1 dev eth0


To display ipv6 route
ip -6 route show


To Ping IPv6 address
ping6 -I eth0  fe80::216:4eff:fe76:d67d

Port Forwarding



Masquerade :
/sbin/iptables -t nat -A POSTROUTING -o xenbr0 -j MASQUERADE

Port Forwarding :
  iptables -t nat -A PREROUTING -p tcp -s 0.0.0.0/0 -d  10.228.1.120  --dport 2221 -j DNAT --to-destination 192.168.1.1:22


Note : In this case Xenbr0 is listening externally. 

Anyone connecting to hypervisor on 10.228.1.120:2221 will be forwarded to VM 192.168.1.1:22

Default DHCP on xen

Xen has its own DHCP server which uses virbr0 bridge,

For DHCP server to be ready, you need to make sure that libvirtd service is running.

To use any VM as dhcp client on Xen :

In the vm.cfg add the below entries :
========================
dhcp = "dhcp"
vif = ['bridge=virbr0,mac=00:16:3E:76:D6:7D,type=netfront']


mac is the mac address of eth0 configured in Virtual Machine.

Always hardcode the mac address by defining it in the
/etc/sysconfig/network/ifcfg-eth0 script in the VM machine

The line would be :

HWADDR=00:16:3E:76:D6:7D
BOOTPROTO=dhcp