Friday, November 8, 2013

Script to configure User equivalence across the RAC nodes using SSH

echo "Enter Node1 name :"
read node1
echo "Enter No Of Nodes in RAC[1/2]:"
read noofnodes
echo "Make sure that /etc/hosts file contains all nodes ip addresess and hostnames "
parm="($node1)"
mkdir -p ~/.ssh
chmod 755 ~/.ssh
cd ~/.ssh
/usr/bin/ssh-keygen -t rsa
/usr/bin/ssh-keygen -t dsa
cat id_rsa.pub id_dsa.pub >> $node1
cat id_rsa.pub id_dsa.pub >> authorized_keys

if [ $noofnodes -eq 2 ]
then
echo "Enter Node2 name :"
read node2

scp $node1 $node2:~/.ssh/.
ssh $node2 "mkdir -p ~/.ssh;chmod 755 ~/.ssh;cd ~/.ssh;/usr/bin/ssh-keygen -t rsa;/usr/bin/ssh-keygen -t dsa;cat id_rsa.pub id_dsa.pub >> $node2;cat $node1 $node2 >> authorized_keys;chmod 644 authorized_keys"
scp $node2:~/.ssh/authorized_keys  ~/.ssh/.
echo "Execute Following Commands in Node $node2 as user `logname`"
echo "cd ~/.ssh"
echo "exec /usr/bin/ssh-agent \$SHELL"
echo "/usr/bin/ssh-add"
echo "Press Enter after executing above commands in node $node2 as user `logname`"
read aa
parm="($node1)|($node2)"
fi

cd ~/.ssh
chmod 644 authorized_keys
exec /usr/bin/ssh-agent $SHELL
/usr/bin/ssh-add

for lv in `cat /etc/hosts|grep -v "^#"|grep -i -E "$parm"`
do
echo $lv
ssh $lv date
ssh $lv date
done

Thursday, November 7, 2013

Configuring DNS server on linux for 11gr2 SCAN name

1) Disable firewall
service iptables stop
service ip6tables stop

2) Install following rpms
bind-libs
bind
bind-utils

2) edit /etc/named.conf file (Make sure that dns name server name and scan name is different and scan ips are not being already used)

[root@linuxdns named]# cat /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
        listen-on port 53 { 127.0.0.1; 10.10.20.6; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        #allow-query     { localhost; };
        allow-query     { any; };
        query-source port 53;
        query-source-v6 port 53;
        recursion yes;

        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "kmccorp.com" IN {
        type master;
        file "kmccorp.com.zone";
        allow-update { none; };
};

zone "20.10.10.in-addr.arpa." IN {
        type master;
        file "20.10.10.in-addr.arpa";
        allow-update { none; };
};

include "/etc/named.rfc1912.zones";

[root@linuxdns named]#

3)
In the zone definitions we defined the file containing the zone configuration. These files are located in the "/var/named/" directory.
For a RAC installation create/edit the file associated with your zone its look like bellow (/var/named/kmccorp.zone )

[root@linuxdns named]# pwd
/var/named
[root@linuxdns named]# cat kmccorp.com.zone
$TTL    86400
@               IN SOA  localhost root.localhost (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           localhost
localhost       IN A            127.0.0.1
linuxrac        IN A    10.10.20.1
linuxrac-priv   IN A    192.168.70.1
linuxrac-vip    IN A    10.10.20.3
linuxdns-scan   IN A    10.10.20.10
linuxdns-scan   IN A    10.10.20.11
linuxdns-scan   IN A    10.10.20.12
[root@linuxdns named]#

4) Next I need to create the "/var/named/20.10.10.in-addr.arpa" file for my public network reverse lookups.
This file has the following contents, where "linuxdns.kmccorp.com" is the name of the DNS server

[root@linuxdns named]# cat 20.10.10.in-addr.arpa
$ORIGIN 20.10.10.in-addr.arpa.
$TTL 1H
@       IN      SOA     linuxdns.kmccorp.com.     root.linuxdns.kmccorp.com. (      2
                                                3H
                                                1H
                                                1W
                                                1H )
20.10.10.in-addr.arpa.         IN NS      linuxdns.kmccorp.com.

1     IN PTR  linuxrac.kmccorp.com
3     IN PTR  linuxrac-vip.kmccorp.com
10    IN PTR  linuxdns-scan.kmccorp.com
11    IN PTR  linuxdns-scan.kmccorp.com
12    IN PTR  linuxdns-scan.kmccorp.com

[root@linuxdns named]#
[root@linuxdns named]#
[root@linuxdns named]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.10.20.6 linuxdns.kmccorp.com linuxdns
[root@linuxdns named]#

5) Start the dns service
[root@linuxdns named]#service named start
checkconfig named on

6) On the client side include following content in file /etc/resolv.conf

nameserver 10.10.20.6
search kmccorp.com

7) Test it

# nslookup linuxdns-scan.kmccorp.com
Server:         10.10.20.6
Address:        10.10.20.6#53

Name:   linuxdns-scan.kmccorp.com
Address: 10.10.20.10
Name:   linuxdns-scan.kmccorp.com
Address: 10.10.20.11
Name:   linuxdns-scan.kmccorp.com
Address: 10.10.20.12

scsi_id /dev/sda is not giving any output for linux 6 on vmware

1) If you were running ESXi 4.1, that bit of re-configuration consists of

shut down your virtual machine
right-click the VM’s entry in the left-hand panel and select Edit Settings
click the Options tab
Select the Advanced -> General item on the left and click the Configuration Parameters… button you then see displayed on the right
Click the Add Row button
Add disk.EnableUUID as the name of the new row, and the word TRUE as its value (don’t use quotation marks around either of these entries).
Click OK to make the new parameter addition ‘stick’.
You can then reboot your virtual machine.

2) Incase of  VMware Workstation we have to do it manually  using a text editor. Open vmware configuration file as mentioned bellow

First, find the directory where the files representing your virtual machine are stored. One of them will be called the name of your VM,
with an extension of .vmx. In my case, for example, the file is called OEL6.vmx, because when I created my VM, I called it “OEL6?. The file will be 3 or 4KB in size.
Open it in the text editor of your choice and at the very end of the file, add this line:

disk.EnableUUID = "TRUE"