Setup udev rules with Red Hat 5/6 on VMware

To work on VMware Fusion, set the following on the .vmx file; without this entry, the scsi_id command does not return any values by default.
disk.EnableUUID = “TRUE” 
 
Retrieve and generate a unique SCSI identifier with the scsi_id command:

[root@rhel59dra ~]# /sbin/scsi_id -g -u -s /block/sdc

36000c29b80c12910ca4e6a95a1949d8b
[root@rhel59dra ~]# /sbin/scsi_id -g -u -s /block/sdd
36000c29344da4eab5b78409de3706424
[root@rhel59dra ~]# /sbin/scsi_id -g -u -s /block/sde
36000c291cd542d388fdee223fa90ca69
[root@rhel59dra ~]# /sbin/scsi_id -g -u -s /block/sdf
36000c296666187fd5223c0a34ca52f71
 
Add entries to a custom udev rules file
[root@rhel59dra ~]# cat /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL==”sd?1″, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s /block/$parent”, RESULT==”36000c29b80c12910ca4e6a95a1949d8b”, NAME=”ASMOCR01″, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
KERNEL==”sd?1″, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s /block/$parent”, RESULT==”36000c29344da4eab5b78409de3706424″, NAME=”ASMOCR02″, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
KERNEL==”sd?1″, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s /block/$parent”, RESULT==”36000c291cd542d388fdee223fa90ca69″, NAME=”ASMOCR03″, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
KERNEL==”sdf[0-9]“, BUS==”scsi”, PROGRAM==”/usr/bin/udevinfo -q name -p %p”, RESULT==”%k”, PROGRAM==”scsi_id -g -u -d /dev/$parent”, RESULT==”36000c296666187fd5223c0a34ca52f71″, NAME=”ASMDATA0%n”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
 

Note:
For disks with multiple partitions, the syntax in the udev rules are different.
KERNEL==”sd[c-z]1″, BUS==”scsi”, PROGRAM=”/sbin/scsi_id -g -u -s /block/%P”, RESULT==”3*”, NAME=”ASM%c”, OWNER=”oracle”, GROUP=”dba”, MODE=”0660″
 
 
To make sure that udev rules work:
[root@rhel59dra ~]# udevtest /block/sdc/sdc1
[root@rhel59dra ~]# udevtest /block/sdd/sdd1
[root@rhel59dra ~]# udevtest /block/sde/sde1
[root@rhel59dra ~]# udevtest /block/sdf/sdf1    
[root@rhel59dra ~]# udevtest /block/sdf/sdf2    
[root@rhel59dra ~]# udevtest /block/sdf/sdf3    
[root@rhel59dra ~]# udevtest /block/sdf/sdf4    
 
Restart udev rules:
RHEL 5: /sbin/udevcontrol reload_rules
RHEL 6: /sbin/udevadm control –reload-rules 
/sbin/start_udev  
 
Verify that proper devices are created

[root@rhel59dra ~]# ls -l /dev/ASM*

brw-rw—- 1 oracle dba 8, 81 May 15 23:45 /dev/ASMDATA01
brw-rw—- 1 oracle dba 8, 82 May 15 23:45 /dev/ASMDATA02
brw-rw—- 1 oracle dba 8, 83 May 15 23:45 /dev/ASMDATA03
brw-rw—- 1 oracle dba 8, 84 May 15 23:45 /dev/ASMDATA04
brw-rw—- 1 oracle dba 8, 33 May 15 23:45 /dev/ASMOCR01
brw-rw—- 1 oracle dba 8, 49 May 15 23:45 /dev/ASMOCR02
brw-rw—- 1 oracle dba 8, 65 May 15 23:45 /dev/ASMOCR03 

Stored Proc to write to database alert logs

Here’s a simple stored procedure that I’ve been using for about a decade.  From the application or from database triggers, if I want to record anything to the alert log, I can simply invoke this stored procedure and write error messages to the alert log.

Most of the DBAs have implemented alert log scanners and will send alert notifications if new ORA- error messages pop up in the alert log file.

create or replace procedure edba_write_alert

( p_message varchar2,
  p_oranum NUMBER default 20001)
is
begin
dbms_system.ksdddt;
dbms_system.ksdwrt(2, ‘ORA-’||to_char(p_oranum)||’: ‘||p_message);
end;
/
 
grant execute on edba_write_alert to public; 
 

Create a local YUM repository from your CD/DVD

Mount the CD/DVD:  mount /dev/cdrom /mnt/cdrom

Then trick the baseurl directives to point to the file instead of Oracle’s public yum server in the /etc/yum.repos.d/public-yum-ol6.repo/public-yum-el5.repo or /etc/yum.repos.d/public-yum-ol6.repo file:

[root@ovmanager media]# mount /dev/cdrom /mnt

mount: block device /dev/sr0 is write-protected, mounting read-only
 
[oracle@ovmanager yum.repos.d]$ pwd
/etc/yum.repos.d
 
[oracle@ovmanager yum.repos.d]$ vi public-yum-el5.repo
 

[ol5_u8_base]

name=Oracle Linux $releasever Update 8 installation media copy ($basearch)
baseurl=file:///mnt/OL5.8/Server/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-el5
gpgcheck=0
enabled=1 

Now you are ready to install packages from your local yum repository

By Charles Kim, Oracle ACE Director

 

Determine WWN

For those who are interested in knowing how to determine HBA port id (world-wide name – WWN) from a Linux box, see below.  Note is this is for RHEL/OEL 6.x.  5.x is quite different.  In our case its simple, we have one HBA, but the following can be used to walk thru it:
 
#lspci | grep -i fibre

03:00.0 Fibre Channel: QLogic Corp. ISP2432-based 4Gb Fibre Channel to PCI Express HBA (rev 02)
 
#systool -av -c fc_host
 
 
Class Device = “host6″
  Class Device path = “/sys/devices/pci0000:00/0000:00:1c.0/0000:03:00.0/host6/fc_host/host6″
    dev_loss_tmo        = “45″
    fabric_name         = “0xffffffffffffffff”
    issue_lip           = <store method only>
    max_npiv_vports     = “127″
    node_name           = “0x200000e08b93a654
    npiv_vports_inuse   = “0″
    port_id             = “0×000000″
    port_name           = “0x210000e08b93a654″
    port_state          = “Linkdown”
    port_type           = “Unknown”
    speed               = “unknown”
    supported_classes   = “Class 3″
    supported_speeds    = “1 Gbit, 2 Gbit, 4 Gbit”
    symbolic_name       = “QLE2460 FW:v5.03.07 DVR:v8.04.00.08.39.0-k”
    system_hostname     = “”
    tgtid_bind_type     = “wwpn (World Wide Port Name)”
    uevent              = 
    vport_create        = <store method only>
    vport_delete        = <store method only>
 
Thus WWN == 20:00:00:e0:8b:93:a6:54

By Nitin Vengurlekar and Charles Kim, Oracle ACE Director
Viscosity North America

tar with exclude

cat dg_tar.ksh

tar cpfX – dg.exclude dgmenu > dg.tar

 

$ cat dg.exclude

dgmenu/old

dgmenu/conf

dgmenu/log

afiedt.buf

*.old

*.bkup

 

Notes:

1.  dgmenu is the directory that we are creating a tar-ball for

Viscosity Has 10 presentations at IOUG Collaborate 2013

We will post the 10th session shortly …

Session #

Title

Room Assignment and Time

604

Rolling your own Database Operations Center (DOC) using Oracle Technology you already own

Mile High Ballroom 2A => Mon, Apr 08, 2013 (09:45 AM – 10:45 AM)

344

Performance Tuning your DB Cloud in OEM 12c Cloud Control – 360 Degrees

Mile High Ballroom 4A  => Mon, Apr 08, 2013 (09:45 AM – 10:45 AM)

614

Automate Data Guard Best Practices

Mile High Ballroom 2B => Mon, Apr 08, 2013 (05:00 PM – 06:00 PM)

 

 

 

477

Why Every Database Needs to be Virtualized

Mile High Ballroom 4A => Tue, Apr 09, 2013 (12:00 PM – 12:30 PM)

343

Oracle VM, OEM 12c and Cloud Computing:  Panel of Experts

C#13 vSIG Meeting => Tue, Apr 09, 2013 (4:15 PM – 5:15 PM)

 

 

 

441

ASM New Features – The New ASM Frontier

Mile High Ballroom 2C => Wed, Apr 10, 2013 (08:15 AM – 09:15 AM)

414

Engineered Systems Curriculum: The Perfect Marriage: ZFS Storage Appliance with Exadata

Mile High Ballroom 1C => Wed, Apr 10, 2013 (11:00 AM – 12:00 PM)

783

Virtualized Oracle Stretched RAC Cluster using VMware vSphere and EMC VPLEX

Mile High Ballroom 2A => Wed, Apr 10, 2013 (04:15 PM – 05:15 PM)

 

 

 

757

From Big Data to Exadata: The Best of Both Worlds for Business Analytics

Mile High Ballroom 1B => Thu, Apr 11, 2013 (09:45 AM – 10:45 AM)

 

 

 

Viscosity North America

VNA Core Competencies

Viscosity’s Core Competency centers arounds Oracle Real Application Clusters (RAC).   Because we are the top Oracle RAC Experts, we intimately know storage architecture, network infrastructure, operating systems, and most importantly, Oracle RAC database interactions within the ecosystem.  

Viscosity was formed by former Oracle Employees each of which worked in various capacities within Oracle Corporation. These capacities include Oracle Database, RAC Development, Oracle Consulting and Oracle Technical Architects, Design and Performance Tuning experts.

I am a co-founder and President of Viscosity North America, an Oracle ACE Director, an Oracle Certified DBA, Certified RAC Expert and a VMware Certified Professional. I specialize in Exadata, RAC, and Virtualization (VMware and Oracle VM) and authored three books: Oracle Database 11g New Features for DBA and Developers, Linux Recipes for Oracle DBAs and Oracle Data Guard 11g Handbook. I hold certifications in Oracle, VMware, Red Hat Linux, and Microsoft and has over 20 years of Oracle experience. I’ve sat on the panel of experts at VM World and Oracle OpenWorld for virtualization and Linux. I was one of the founding members of the IOUG virtualization SIG that launched in 2011 at Oracle OpenWorld.

If you look at the core of our competencies, we focus on what we are best at …  RAC.  RAC experts are expected to have in-depth knowledge in networks, clustering, storage, and operating systems.  Several of the managing directors have served as system administrators in past lives and hold specialized certifications in flavors of Unix.  

Because we know RAC, we know infrastructure.  Because we know infrastructure, we’ve adjusted our focus to the world of Database Cloud.  Not only do we adopt Oracle’s consolidation theme with Oracle RAC, we are heavily invested in VMware and Oracle VM.  Several of the managing directors at Viscosity hold certifications on VMware.  

Another area of mastery that we have taken is in the world of Exadata and Oracle engineered systems.  Not only are we the experts in Exadata implementation and performance tuning, we are also experts inother engineered systems such as the ZFS Storage Appliance and Oracle Database Appliance.

Viscosity’s Oracle Center of Expertise has developed best practices and tight partner relationships to implement world-class solutions. Our vast experience and intellectual property give customers insight into what is driving IT complexity. We can deliver a set of practical executable plans for simplifying IT infrastructure, helping reduce operating costs while freeing up resources for new business initiatives.

 

Complete DBCA

dbca with the silent option is the best way to create a database.  If you issue the find command from $ORACLE_HOME, you will see that oracle ships with two generic templates:

rhel59dra:/u01/app/oracle/product/11.2.0/db

> find . -name ‘*.dbc’
./assistants/dbca/templates/General_Purpose.dbc
./assistants/dbca/templates/Data_Warehouse.dbc

Leveraging the General Purpose template, I can create my custom database.  Notice all the init.ora options that is specified with my dbca command.

dbca -silent                             \

       -createDatabase                   \
       -templateName General_Purpose.dbc \
       -gdbName dbatools                   \
       -sid dbatools                       \
       -SysPassword oracle123 \
       -SystemPassword oracle123 \
       -emConfiguration NONE             \
       -redoLogFileSize 1000 \
       -recoveryAreaDestination FRA \
       -storageType ASM                  \
         -asmSysPassword oracle123 \
         -diskGroupName DATA     \
           -listeners  LISTENER_RAC \
       -characterSet AL32UTF8 \
       -nationalCharacterSet AL16UTF16 \
       -databaseType MULTIPURPOSE \
       -nodelist rhel59dra, rhel59drb \
       -initparams audit_file_dest=’/bkup/dbatools/adump’ \
           -initparams compatible=’11.2.0.3′ \
           -initparams db_create_file_dest=’+DATA’ \
           -initparams db_create_online_log_dest_1=’+DATA’ \
           -initparams db_create_online_log_dest_2=’+FRA’ \
           -initparams diagnostic_dest=’/bkup’ \
           -initparams parallel_max_servers=64 \
           -initparams pga_aggregate_target=1824522240 \
           -initparams processes=600 \
           -initparams sga_target=4294967296 \
           -initparams db_recovery_file_dest=’+FRA’ \
       -initparams db_recovery_file_dest_size=4322230272

Setting DISPLAY with X authority file utility – xauth

Setting DISPLAY with X authority file utility – xauth

From the X Server where the VNC Server is at:

$: xauth list $DISPLAY
viscdb105.visctech.com:1 MIT-MAGIC-COOKIE-1 fc0f22b8861edcea596a68db0ec3059d
viscdb105.visctech.com/unix:1 MIT-MAGIC-COOKIE-1 fc0f22b8861edcea596a68db0ec3059d

Then you go to your database server where you will launch runInstaller from:

$: xauth add viscdb105.visctech.com:1 MIT-MAGIC-COOKIE-1 fc0f22b8861edcea596a68db0ec3059d
$: xauth add viscdb105.visctech.com/unix:1 MIT-MAGIC-COOKIE-1 fc0f22b8861edcea596a68db0ec3059d

Set your DISPLAY like you would normally do:

VPRD1 – oracle: xclock Error: Can’t open display: 
viscdb007:/apps/oracle/software/11.2.0.3/grid
VPRD1 – oracle: export DISPLAY=viscdb105.visctech.com:1
viscdb007:/apps/oracle/software/11.2.0.3/grid

Test your connection

if you have xclock installed on the database server.  If you do not have xclock, you can copy xclock from another machine that has it installed.

VPRD1 – oracle: xclock

Warning: Missing charsets in String to FontSet conversion

$: ./runInstaller
Starting Oracle Universal Installer…

Checking Temp space: must be greater than 120 MB. Actual 1810 MB Passed
Checking swap space: must be greater than 150 MB. Actual 32031 MB Passed
Checking monitor: must be configured to display at least 256 colors
>>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

Continue? (y/n) [n] y

>>> Ignoring required pre-requisite failures. Continuing…
Preparing to launch Oracle Universal Installer …

 

 

Create ASMLIB disks for EMC disks

Create ASMLIB disks with /etc/init.d/oracleasm command. 

You must be logged in as root:

- root: cat /proc/partitions  |grep emcpower

 120    32    1048576 emcpowerc
 120    33    1047383 emcpowerc1
 120    48    1048576 emcpowerd
 120    49    1047383 emcpowerd1
 120    64    1048576 emcpowere
 120    65    1047383 emcpowere1
 120    80    1048576 emcpowerf
 120    81    1047383 emcpowerf1
 120    96    1048576 emcpowerg
 120    97    1047383 emcpowerg1
 120   112  471859200 emcpowerh
 120   113  471849051 emcpowerh1
 120   128  471859200 emcpoweri
 120   129  471849051 emcpoweri1
 120   144  471859200 emcpowerj
 120   145  471849051 emcpowerj1
 120   160  471859200 emcpowerk
 120   161  471849051 emcpowerk1
 120   176  524288000 emcpowerl
 120   177  524277179 emcpowerl1
 120   192  524288000 emcpowerm
 120   193  524277179 emcpowerm1
 120   208  471859200 emcpowern
 120   209  471849051 emcpowern1
 120   224  471859200 emcpowero
 120   225  471849051 emcpowero1
 
 - root: cat cr_asmlib_disks.txt
/etc/init.d/oracleasm createdisk VISC_PV101_DISK1 /dev/emcpowerc1
/etc/init.d/oracleasm createdisk VISC_PV101_DISK2 /dev/emcpowerd1
/etc/init.d/oracleasm createdisk VISC_PV101_DISK3 /dev/emcpowere1
/etc/init.d/oracleasm createdisk VISC_PV101_DISK4 /dev/emcpowerf1
/etc/init.d/oracleasm createdisk VISC_PV101_DISK5 /dev/emcpowerg1
 
 - root: ksh cr_asmlib_disks.txt
Marking disk “VISC_PV101_DISK1″ as an ASM disk: [  OK  ]
Marking disk “VISC_PV101_DISK2″ as an ASM disk: [  OK  ]
Marking disk “VISC_PV101_DISK3″ as an ASM disk: [  OK  ]
Marking disk “VISC_PV101_DISK4″ as an ASM disk: [  OK  ]
Marking disk “VISC_PV101_DISK5″ as an ASM disk: [  OK  ]
 
Next, you need to scan the disks on the remaining RAC nodes:

- root: /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:

You can verify the the disks on the other RAC nodes with the listdisks option:

- root: /etc/init.d/oracleasm listdisks
TRAX_PV101_DISK1
TRAX_PV101_DISK2
TRAX_PV101_DISK3
TRAX_PV101_DISK4
TRAX_PV101_DISK5