Friday 23 November 2007

mpathadm luxadm fcinfo usage info

Solaris 10 i386
Sun Microsystems Sun Fire X4100 M2
QLE2462

Which library support mpath
# mpathadm list mpath-support
mpath-support: libmpscsi_vhci.so


mpathadm list initiator-port (also you can get these wwn via fcinfo hba-port)
Initiator Port: iqn.1986-03.com.sun:01:ba98a3efffff.47286525,4000002a00ff
Initiator Port: 2100001b32025dc6
Initiator Port: 2101001b32225dc6
Initiator Port: 2101001b32224f93
Initiator Port: 2100001b32024f93


# mpathadm list lu
/dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
Total Path Count: 2
Operational Path Count: 2
/dev/rdsk/c8t60060E800429D200000029D200000800d0s2
Total Path Count: 2
Operational Path Count: 2


Check if your SAN is supported.
# mpathadm show mpath-support libmpscsi_vhci.so
Vendor: HITACHI
Product: OPEN
Revision:
Supported Load Balance Types:
round-robin



# mpathadm show initiator-port 2101001b32224f93
Initiator Port: 2101001b32224f93
Transport Type: Fibre Channel
OS Device File: /devices/pci@0,0/pci10de,5d@d/pci1077,143@0,1/fp@0,0



Get information about disk
# mpathadm show lu /dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
Logical Unit: /dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
mpath-support: libmpscsi_vhci.so
Vendor: HITACHI
Product: OPEN-V -SUN
Revision: 5007
Name Type: unknown type
Name: 60060e800429d200000029d20000003f
Asymmetric: no
Current Load Balance: none
Logical Unit Group ID: NA
Auto Failback: off
Auto Probing: NA

Paths:
Initiator Port Name: 2101001b32224f93
Target Port Name: 50060e800429d274
Override Path: NA
Path State: OK
Disabled: no

Initiator Port Name: 2100001b32024f93
Target Port Name: 50060e800429d264
Override Path: NA
Path State: OK
Disabled: no

Target Ports:
Name: 50060e800429d274
Relative ID: 0

Name: 50060e800429d264
Relative ID: 0



# This is another way to see disk information.
luxadm disp /dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
DEVICE PROPERTIES for disk: /dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
Vendor: HITACHI
Product ID: OPEN-V -SUN
Revision: 5007
Serial Num: 50 029D2003F
Unformatted capacity: 46088.000 MBytes
Write Cache: Enabled
Read Cache: Enabled
Minimum prefetch: 0x0
Maximum prefetch: 0x0
Device Type: Disk device
Path(s):

/dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2
/devices/scsi_vhci/disk@g60060e800429d200000029d20000003f:c,raw
Controller /dev/cfg/c4
Device Address 50060e800429d264,2
Host controller port WWN 2100001b32024f93
Class primary
State ONLINE
Controller /dev/cfg/c5
Device Address 50060e800429d274,2
Host controller port WWN 2101001b32224f93
Class primary
State ONLINE




# You can get hba info
fcinfo hba-port
HBA Port WWN: 2100001b32025dc6
OS Device Name: /dev/cfg/c6
Manufacturer: QLogic Corp.
Model: QLE2462
Firmware Version: 4.0.27
FCode/BIOS Version: N/A
Type: unknown
State: offline
Supported Speeds: 1Gb 2Gb 4Gb
Current Speed: not established
Node WWN: 2000001b32025dc6
HBA Port WWN: 2101001b32225dc6
OS Device Name: /dev/cfg/c7
Manufacturer: QLogic Corp.
Model: QLE2462
Firmware Version: 4.0.27
FCode/BIOS Version: N/A
Type: unknown
State: offline
Supported Speeds: 1Gb 2Gb 4Gb
Current Speed: not established
Node WWN: 2001001b32225dc6
HBA Port WWN: 2100001b32024f93
OS Device Name: /dev/cfg/c4
Manufacturer: QLogic Corp.
Model: QLE2462
Firmware Version: 4.0.27
FCode/BIOS Version: N/A
Type: N-port
State: online
Supported Speeds: 1Gb 2Gb 4Gb
Current Speed: 2Gb
Node WWN: 2000001b32024f93
HBA Port WWN: 2101001b32224f93
OS Device Name: /dev/cfg/c5
Manufacturer: QLogic Corp.
Model: QLE2462
Firmware Version: 4.0.27
FCode/BIOS Version: N/A
Type: N-port
State: online
Supported Speeds: 1Gb 2Gb 4Gb
Current Speed: 2Gb
Node WWN: 2001001b32224f93



# Get remote information over hba
fcinfo remote-port -l -s -p 2101001b32224f93
Remote Port WWN: 50060e800429d274
Active FC4 Types: SCSI
SCSI Target: yes
Node WWN: 50060e800429d274
Link Error Statistics:
Link Failure Count: 0
Loss of Sync Count: 0
Loss of Signal Count: 0
Primitive Seq Protocol Error Count: 0
Invalid Tx Word Count: 0
Invalid CRC Count: 0
LUN: 1
Vendor: HITACHI
Product: OPEN-V*5 -SUN
OS Device Name: /dev/rdsk/c8t60060E800429D200000029D200000800d0s2
LUN: 2
Vendor: HITACHI
Product: OPEN-V -SUN
OS Device Name: /dev/rdsk/c8t60060E800429D200000029D20000003Fd0s2

Thursday 22 November 2007

Rman settings

configure rman settings before starting backup
rman> connect target
rman> show all;
rman> configure retention policy to recovery window of 7 days;
RMAN> configure CONTROLFILE AUTOBACKUP on;

SQL> show parameter db_recovery_file;
look how to configure http://tlepsh.blogspot.com/2007/08/oracle-flash-recovery-area.html
move oracle archive mode http://tlepsh.blogspot.com/2007/08/moving-oracle-to-archive-mode.html


RMAN> configure default device type to disk;
RMAN> configure controlfile autobackup on;
RMAN> configure device type disk parallelism n; n=1,2,3...
RMAN> backup database plus archivelog;
RMAN> list backup summary;

Flash recovery space usage

delete backed up archivelog
rman> backup archivelog all delete all input;

reclaim archived log
delete archivelog
rman> delete archivelog until time 'sysdate-2';

delete old backup
rman> report obsolote;
http://tlepsh.blogspot.com/2007/08/oracle-deleting-old-backup-from-rman.html
rman> delete expired backup;
RMAN> report obsolete;
RMAN> delete obsolete;

Oracle point in time recovery RMAN Backup Restore

Backup database
RMAN> connect target
RMAN> backup database;
# sqlplus hr/hr
SQL> create table new as select * from employees;
SQL> insert into new select * from new;
SQL> commit;
SQL> select count(*) from new;
COUNT(*)
----------
214
SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi';
SQL> select sysdate from dual;

SYSDATE
----------------
24-10-2007 18:47

# sqlplus / as sysdba
SQL> select * from v$log;

get sequence number
Create new records
SQL> insert into new select * from new;
SQL> select count(*) from new;
COUNT(*)
----------
428


RMAN> shutdown immediate;

Restore to a time
RMAN> startup mount;
RMAN> run {
2> restore database until time "to_date('2007-10-24 18:48','YYYY-MM-DD HH24:MI:SS')";
3> recover database until time "to_date('2007-10-24 18:48','YYYY-MM-DD HH24:MI:SS')";}

Check that
# sqlplus / as sysdba
SQL> alter database open resetlogs;
# sqlplus hr/hr
SQL> select count(*) from new;

COUNT(*)
----------
214

Oracle RMAN backup/restore

Backup database
RMAN> connect target;
RMAN> backup database;
RMAN> shutdown immediate;

delete files
# mv *.dbf backup/

restore database
RMAN> startup;
RMAN> restore database;

Oracle tablespace Backup/Restore (OS backup)

I tested tablespace recovery.

Be sure your database in archive mode
SQL> archive log list;
SQL> select count(*) from hr.employees;

Begin backup.
SQL> alter tablespace example begin backup;
Check the tablespace in backup state
SQL> select * from v$backup;
Prepare hr account
SQL> alter user hr account unlock;
SQL> alter user hr identified by hr;
# sqlplus hr/hr
Make some changes
SQL> create table employees2 as select * from employees;

Backup your file (This means that if you put your database in backup state you can do filesystem backup for oracle)
# cp example01.dbf example01.dbf.backup
End backup mode
# sqlplus / as sysdba
SQL> alter tablespace example end backup;

Shutdown database, delete table and restore table
SQL> shutdown abort;
# rm example01.dbf
# sqlplus / as sysdba
SQL> startup
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/u01/app/oracle/oradata/orcl/example01.dbf'

You want database to be open while you are restoring tablespace.
SQL> alter database datafile '/path/example01.dbf' offline;
SQL> alter database open;

Restore tablespace and recover it
# mv example01.dbf.backup example01.dbf
SQL> recover tablespace example;
SQL> alter tablespace example online;

Verify recovery
# sqlplus hr/hr
SQL> select count(*) from employees2;

Oracle Offline Database Backup/Restore (OS backup)

I did some tests. Here I backed up oracle and do some changes. Later I restored with copying files. You can just copy or use any backup software.

Backup
RMAN> connect target;
RMAN> shutdown immediate;
copy oracle datafiles to backup directory
#cp -R /oracle_datafiles_dir/* /backup_dir/
remove redolog files
#rm redo*.log /backdir

Break down your database
open database and do some changes
RMAN> startup;
shutdown database and delete datafiles
RMAN> shutdown immediate;
#rm /oracle_datafiles_dir/*.dbf

Restore
Move backup files to original directory
#cp -R /backup_dir/* /oracle_datafiles_dir/
start database
RMAN> startup mount;
RMAN> recover database until cancel;
RMAN> alter database open resetlogs;

You do not have to do last two steps if you backup redo logs and restore it.

Tuesday 13 November 2007

Osiris agent installation Solaris 10

I did installation for sparc and i386 platform.
I revise configure and find how to install osiris ...
osiris-4.2.3

# cd osiris-4.2.3
edit configure file and change tonew , like below.

< for ssldir in $tryssldir "" /usr/sfw/lib /usr/sfw/bin /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
> for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do

< LIBS="$saved_LIBS $ssldir/lib/libssl.a $ssldir/lib/libcrypto.a -lsocket -lnsl -lresolv"
> LIBS="$saved_LIBS $ssldir/lib/libssl.so $ssldir/lib/libcrypto.so -lsocket -lnsl -lresolv"

< LIBS="$saved_LIBS $ssldir/lib/libssl.a $ssldir/lib/libcrypto.a"
> LIBS="$saved_LIBS $ssldir/lib/libssl.so $ssldir/lib/libcrypto.so"



# export PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin
# ./configure --with-ssl-dir=/usr/sfw
# make agent

# gunzip osiris-agent-4.2.3-release-sparc-SunOS-5.10.tar.gz
# tar xvf osiris-agent-4.2.3-release-sparc-SunOS-5.10.tar
# cd osiris-agent-4.2.3-release
# ./install.sh

Thursday 1 November 2007

RHES 2.1 "grub-install" Fails with "Does Not Have Corresponding BIOS Drive" Error Message

Red Hat Enterprise Linux v2.1 - "grub-install" Fails with "Does Not Have Corresponding BIOS Drive" Error Message

/dev/cciss/c0d0 does not have any corresponding BIOS drive.
To resolve the problem, manually run grub and use commands as in the following example

grub> device (hd0) /dev/cciss/c0d0
grub> root (hd0,0)

Filesystem type is ext2fs, partition type 0x83
grub> find /grub/stage1

(hd0,0)
grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 22 sectors are embedded. succeeded
Running "install /boot/grub/stage1 d (
hd0) (hd0)1+22 p
(hd0,0)/boot/grub/stage
2 /boot/grub/grub.conf"...
succeeded Done.
grub> quit

How to get wwn in Solaris 10

fcinfo Fibre Channel HBA Port Command Line Interface
This command gives you related output.
fcinfo hba-port

long lines in ps output

ps -ef do not give you all output including parameters and commands
So you can use this command in solaris
/usr/ucb/ps -awwwwx | grep smthing