Tuesday, 9 September 2008

How to find LUN id? Solaris

Your disk from Format command

6. c4t60060E8004F359000000F35900000D1Ad0

grep related part luxadm probe

luxadm probe | grep c4t60060E8004F359000000F35900000D1Ad0
Logical Path:/dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2

Use logical path

luxadm display /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c4t60060E8004F359000000F35900000D1Ad0s2
Product ID: OPEN-V -SUN
Revision: 5008
Serial Num: 50 0F3590D1A
Unformatted capacity: 30720.000 MBytes
Write Cache: Enabled
Read Cache: Enabled
Minimum prefetch: 0x0
Maximum prefetch: 0x0
Device Type: Disk device

Controller /devices/pci@8,700000/SUNW,jfca@5/fp@0,0
Device Address 50060e8004f35919,0 (LUN is here, hex value)
Host controller port WWN 2000000173016d35
Class primary
Controller /devices/pci@9,600000/SUNW,jfca@2/fp@0,0
Device Address 50060e8004f35909,0
Host controller port WWN 20000001730151e3
Class primary

MPxIO c#t#d# c4t60060E8004F359000000F35900000D1Ad0
Array WWN 50060e8004f35919 (device address part)
lun 0 (device address part array wwn,LUN address (hex value) )
HBA WWNs 2000000173016d35

Friday, 5 September 2008

Solaris x86 boot GRUB bootenv.rc problem

GRUB Based Booting for Solaris x86 http://docs.sun.com/app/docs/doc/817-1985/hbx86boot-68676?a=view
I had booting problem last week. After grub screen, screen was black and later reboot. First I try rebooting verbose mode editing line in grub "kernel /platform/i86pc/multiboot kernel/unix -v"
How to Modify the Solaris Boot Behavior by Editing the GRUB Menu --> http://docs.sun.com/app/docs/doc/817-1985/fwbme?a=view
Then I got:
/boot/solaris/bootenv.rc - line 23, syntax error.

first we edit bootenv.rc

setprop console 'ttyb'
setprop console 'screen'

I could proceed with pressing ctrl+d two times (which stops running script at that time). So I could proceed with booting.
This is a bug related to kernel. Probably kernel do not show boot process to screeen. Also some boot scripts which gets information from eeprom (related to boot-args) hanged. In that kind of situations Ctrl+d could be good solution if you belive scripts hanged during boot.

Thursday, 4 September 2008

Export data from oracle via vbscript

I need to export data from oracle so it will be possible for me to generate alert from that log file. I do this because we do not have permission to change anything in the database.
Be carefull about fields section, you must know how many columns in the table.

dquerry="select * from table"

'Filesystem Object
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Check if file exist
If objFSO.FileExists(path) Then
Set objFile = objFSO.OpenTextFile(path,8,True)
wscript.echo "there is no file I am creating"
set objFile = objFSO.createtextfile(path)
'set objFile = objFSO.OpenTextFile(path,8, True)
end If

'open connection to database
Dim strCon
strCon = "Driver={Microsoft ODBC for Oracle}; " & _
"(HOST=" & strHost & ")(PORT=" & strPort & "))" & _
"(CONNECT_DATA=(SID = " & strSID & "))); uid=" & strUsername & ";pwd=" & strPassword & ";"
Dim oCon: Set oCon = WScript.CreateObject("ADODB.Connection")
Dim oRs: Set oRs = WScript.CreateObject("ADODB.Recordset")
oCon.Open strCon

Set oRs = oCon.Execute(querry)
While Not oRs.EOF
objFile.WriteLine(oRs.Fields(0).Value &"," & oRs.Fields(1).Value &"," & oRs.Fields(2).Value &"," & oRs.Fields(3).Value &"," & oRs.Fields(4).Value

&"," & oRs.Fields(5).Value &"," & oRs.Fields(6).Value &"," & oRs.Fields(7).Value &"," & oRs.Fields(8).Value &"," & oRs.Fields(9).Value &"," &

oRs.Fields(10).Value &"," & oRs.Fields(11).Value &"," & oRs.Fields(12).Value &"," & "Q3" &"," & "Q3" &"," & oRs.Fields(15).Value &"," & oRs.Fields(16).Value

Set oRs = Nothing
Set oCon = Nothing

Wednesday, 3 September 2008

Flash archive backup central server

I create flash archive backup and copy to central server. If there is any error in backup process or scp process I got mail.
Also scp works passwordless and secure.

First create transfer user at central server and give necceseery permissions.
At the main server:

# useradd transfer -d /export/home/transfer
# passwd transfer
# chown transfer /centralbackup/dir

At servers which you are going to backup, create public keys.

# ssh-keygen -t rsa
# cat ~/.ssh/id_rsa.pub

copy content to the transfer user in central server /transferuserhomedirectory/.ssh/authorized_keys . Be carefull there is no line break in the id_rsa.pub file.
now you can login without password to central server test is ssh transfer@centralserver.

This is the script that you can backup weekly.

backupname=$(hostname)_$(date '+%Y%m%d')
#if you want to exclude directories when you are creating flash archive use -x
flarcreate -c -S -n $backupname -x /putdirthatyouwanttoexclude -x /anotherexclude $backupdir/$backupname.flar
#check if there is problem creating flash archive
if [ $? -ne 0 ] ; then
echo flarcreate problem in $(hostname) "\n" | mailx -s "$(hostname) flarcreate problem" $mailaddress
exit 1
scp $backupdir/$backupname.flar $remoteloc
#check if there is problem copying to central server.
if [ $? -ne 0 ] ; then
echo backup copy problem in $(hostname) "\n" | mailx -s "$(hostname) backup copy problem" $mailaddress
exit 1
#deletes backup of previous week
rm $backdir/$(hostname)_$(TZ=GMT+167 date +%Y%m%d).flar
#check if there is problem deleting file
if [ $? -ne 0 ] ; then
echo old backup delete problem in $(hostname) "\n" | mailx -s "$(hostname) old backup delete problem" $mailaddress
exit 1

Tuesday, 2 September 2008

Inetadm connection_backlog

I patched Solaris 10 x86 which holding a another zone in container.
I got error booting guest zones

Sep 2 13:23:54 inetd[22765]: Unable to read debug property from config property group. scf_simple_prop_get() failed: entity not found
Sep 2 13:23:54 inetd[22765]: Property 'connection_backlog' of instance svc:/network/rpc/gss:default is missing, inconsistent or invalid
Sep 2 13:23:55 svc.startd[22540]: network/inetd:default failed repeatedly: transitioned to maintenance (see 'svcs -xv' for details)
Sep 2 13:23:55 svc.startd[22540]: failed to abandon contract 32259: Permission denied

Output of svcs -xv says gss inetd and related services are failing

svc:/network/rpc/gss:default (Generic Security Service)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: gssd(1M)
Impact: 14 dependent services are not running. (Use -v for list.)

svc:/application/print/server:default (LP print server)
State: disabled since Tue Sep 02 14:43:57 2008
Reason: Disabled by an administrator.
See: http://sun.com/msg/SMF-8000-05
See: lpsched(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/network/rpc/rstat:default (kernel statistics server)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: rpc.rstatd(1M)
See: rstatd(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/network/rpc/smserver:default (removable media management)
State: uninitialized since Tue Sep 02 14:43:58 2008
Reason: Restarter svc:/network/inetd:default is not running.
See: http://sun.com/msg/SMF-8000-5H
See: rpc.smserverd(1M)
Impact: 1 dependent service is not running. (Use -v for list.)

svc:/application/print/cleanup:default (print cleanup)
State: maintenance since Tue Sep 02 14:43:58 2008
Reason: Start method failed repeatedly, last exited with status 1.
See: http://sun.com/msg/SMF-8000-KS
See: /var/svc/log/application-print-cleanup:default.log
Impact: This service is not running.

svc:/network/inetd:default (inetd)
State: maintenance since Tue Sep 02 14:44:07 2008
Reason: Restarting too quickly.
See: http://sun.com/msg/SMF-8000-L5
See: inetd(1M)
See: /var/svc/log/network-inetd:default.log

I set the value below and restarted zone, now it is ok

inetadm -M connection_backlog=10