Centroid displayed an excellent combination of strategic forethought, leveraging technology and...
Birken Olsen, CEO
The BCE Group

Archive for the ‘Oracle’ Category

EMC RecoverPoint Behavior under Heavy Load

without comments

I’m sure this is well-known and documented behavior to RecoverPoint appliance experts, but we recently found what we think to be a very nice feature in EMC’s RecoverPoint behavior that perhaps some folks new to the technology are unaware of …

Today we did a large (1Tb) backup of an assortment of Oracle database files on HP-UX file-systems to a set of ASM disk groups.  The ASM disk groups were the source LUNs in a RecoverPoint remote replication consistency group.  Our RMAN backup to ASM disk groups was done using 6 channels, and the source ASM LUNs resided in a RAID5 Enterprise Flash Drive Raid Group.

As the RMAN backup job allocated channels and wrote backup copies to the target LUNs, we noticed that the RecoverPoint appliances essentially “suspended” transmission of data with a helpful message about the source volumes being too busy.  As channels de-allocated and the RMAN job switched from tablespace to tablespace (it was a tablespace at a time RMAN “backup as copy” operation), the RecoverPoint data transfer would kick back in, then suspend itself again as the drives became busy.

Granted, we configured our consistency groups with pretty much default settings, didn’t set any non-standard or overly aggressive RPOs, and essentially were “out of the box” with a 100Gb-sized RecoverPoint journal size.  The nice implication of this behavior is this - in the event we need to do “large” data migration or storage-related activities on our source RP volumes, it looks like we’ll never have to worry about suspending our data transfer manually (through the RP administrative web interface or otherwise) - it all just happens by itself.

One less thing to worry about …

Written by John Clarke

July 22nd, 2010 at 10:39 pm

Cloning Oracle Databases with EMC SnapView and RecoverPoint

without comments

Many are familiar with the steps required to clone Oracle database using “rman duplicate” or “hot backup” cloning .  Many are also familiar with steps required to create EMC SnapView Clones or SnapView Snapshots, either with the Navisphere web interface or CLI.  In this post, I’ll outline steps required to build consistent, usable Oracle database “clones” within the framework of the following environment/architecture:

  • Oracle 11.1.0.7, HP-UX 11iV2
  • EMC CLARiiON CX4 storage arrays at production and DR site
  • EMC RecoverPoint appliances at production and DR site
  • Source database (production) uses Oracle ASM for its storage
  • Requirement is to replicate production data from production storage array to remote “DR” array.
  • Requirement is to use this replicated data at the DR site as the source for both SnapView Clones or SnapView Snapshots
  • Requirement is to Clone or Snap from DR Replica LUNs, re-create an Oracle control file to build a new database, recover this target database, open with resetlogs, and use it
Know Your Storage Environment
Before beginning the process, it is vital to know and understand your storage environment.  While it is possible to dynamically configure and report on everything in your storage array using Navisphere CLI, I find it’s best to peruse and document your CX4 configuration details using the web interface.  So open a browser and go to:
http://<IP address of one of the CX SP’s>/start.htm
… and login as admin.    Once inside Navisphere on the production storage array, note the following:
  • The LUN numbers and names for the LUNs that comprise or will comprise the RecoverPoint consistency group
  • Ensure (or assume) the LUNs are in a storage group and zoned to the production host
On the DR array, you need to document or do the following:
  • LUN numbers/names of Replica LUNs (i.e., LUNs in the RecoverPoint Consistency Group)
  • LUN numbers/names for all to-be SnapView Clones.  When using SnapView Clones, the number and size of Replica LUNs needs to match that on the Clone LUNs for each clone group you’ll be creating
  • Sufficient LUNs carved into the Reserve LUN pool to hold snapshot data
Do Some Planning
Before plodding ahead with testing, I feel it’s important to plan your deployment and develop some up-front standards that can be used during the configuration.  Questions to ask:
  • How many SnapView Clones will I need? (will govern how many LUNs to build on the DR array, and place in the primary host storage group)
  • How many SnapView Snapshots will I need? (this information, combined with source database size, will help size reserve LUN pool)
  • What will the shelf-life be for my snapshots?
  • How much DML/DDL will occur in my snapshot instances over time?
In addition to asking these questions, I believe it’s important to decide upon the following:
  • Implement a standard ASM diskgroup naming convention (i.e., PROD_DG1, DEV_DG1, etc)
  • Implement strategy for consistent symbolic linking of O/S files to the ASM devices that will be defined in the ASM disk group.  For example, if ASM diskgroup  PROD_DG1 is designed to use /dev/rdsk/c57t0d0, which is LUN1 on the production CX4 storage array, we should symbolically link /asm/disk1 to /dev/rdsk/c57t0d0 and build the ASM diskgroup with the “/asm/disk1″ string
  • Set asm_diskstring in both production and DR server ASM instance to the same thing, with wild-cards.  For example, “/asm*/disk*”
  • Map Source to Replica LUN numbers
  • Map Replica to Clone Group LUN for each Clone Group, and ensure “target” clone LUNs are added to the right storage group
  • Implement a strategy for snapshot LUN number conventions.  For example, if you will expect to build 3 different snapshots on the Replica LUNs, you can start LUN numbering on the first set at LUN 3000, the second set at LUN 4000, the third set at LUN 5000.
The more planning done ahead of time, the less risk and the easier it will be to build automated scripts to do things end-to-end.
In This Post …
For examples below in this post, I’ll use the following information:
  • prodhost = production HP-UX host
  • drhost = DR HP-UX host
  • PROD = production database name
  • CLN1 = 1st clone of PROD using SnapView clones
  • CLN2 = 2nd clone of PROD using SnapView clones
  • SNP1 = 1st snapshot of PROD using SnapView snapshots
  • SNP2 = 2nd snapshot of PROD using SnapView snapshots
  • rpa1 = host name of RecoverPoint appliance’s admin interface
  • cx4-dr = DNS name of DR CLARiiON CX4, used for NaviSphere
  • EMC PowerPath is installed and  configured on both prodhost and drhost
  • 3 ASM Diskgroups: PROD_DG1, PROD_DG2, and PROD_DG3, all replicating in the RP Consistency group and all used as sources to Clones/Snapshots
Cloning PROD to CLN1 with SnapView Clones and Oracle ASM
  • Ensure RPA is transmitting data from primary storage array to DR array (and ensure the consistency groups are setup and functional)
  • Ensure an ASM instance is running on drhost
  • Obtain LUN numbers to use for the CLN1 clone group from NaviSphere
  • Make sure the LUNs are in the proper storage group, zoned to drhost, and visible via EMC PowerPath
# /sbin/init.d/agent stop
# ioscan -fnCdisk
# insf
# /sbin/init.d/agent start
# powermt check
# powermt config
# powermt save
  • Run “powermt display dev=all” as root and search contents for the Replica LUN and Clone LUN names/numbers.
  • Consider primary (PROD) ASM device to HP-UX device mappings and ensure you’ve got it documented.  For sake of example:
PROD_DG1 is on /asm/disk1
PROD_DG2 is on /asm_disk2
PROD_DG3 is on /asm_disk3
  • Create symbolic link from /asm_c1/disk1 to the target Clone LUN that will be synced from the Replica LUN mapped to the primary LUN for PROD_DG1
  • Repeat for /asm_c1/disk2 and /asm_c1/disk3.
NOTE: I am using /asm_cX/diskY convention here, with X = Clone Group number and Y = disk number within the clone group.
NOTE: At this point, there will be no data on the disks, since they haven’t been synchronized.
  • Create SnapView clone on the 3 LUN.  Below, assume the Replica LUNs are 1, 2, and 3

# naviseccli -h cx4-dr  -Scope 0 -User admin -Password <Nav pwd> snapview -createclonegroup -name lun1CloneGrp_1 -luns 1 -o

# naviseccli -h cx4-dr  -Scope 0 -User admin -Password <Nav pwd> snapview -createclonegroup -name lun2CloneGrp_1 -luns 2 -o

# naviseccli -h cx4-dr  -Scope 0 -User admin -Password <Nav pwd> snapview -createclonegroup -name lun3CloneGrp_1 -luns 3 -o

  • Add target LUNs to clone group and begin synchronizing data.  When you create a clone group (above) and specify the “-luns” clause, the LUN number following the “-luns” argument is the source LUN for the clone, which in this case is the Replica LUN on the DR storage array.  The following will create a clone group for LUN 11 (mapped to Replica LUN 1), LUN 12 (mapped to Replica LUN 2), and LUN 13 (mapped to Replica LUN 3)

# naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -addclone -name lun1CloneGrp_1 -luns 11 -syncrate high

# naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -addclone -name lun1CloneGrp_2 -luns 12 -syncrate high

# naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -addclone -name lun1CloneGrp_3 -luns 13 -syncrate high

  • Wait for clone synchronization to complete.  You can use the below to monitor this based on the clone group configurations above:

# naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -listclone -name lun1CloneGrp_1 | egrep ‘(^Name|^CloneState|^CloneCon|^Percent)’

# naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -listclone -name lun1CloneGrp_2 | egrep ‘(^Name|^CloneState|^CloneCon|^Percent)’

# naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -listclone -name lun1CloneGrp_3 | egrep ‘(^Name|^CloneState|^CloneCon|^Percent)’

  • Put source database (PROD) in backup mode.  First though, grab the max first_change# from V$ARCHIVED_LOG to show the earliest archived redo log we’ll need at a later step …
SQL> select max(first_change#) from v$archived_log
SQL> alter database begin backup;
  • Enable “Image Access” on the RecoverPoint Appliance (RPA).  This is required to put the source of the clones, which are the RPA Replica LUNs, in a consistent state.  If you omit this step you’ll get to the end of this, try to recover your database, and will be left with the only option to recover all the way up through the most current redo log on the primary site - something we don’t want to do …  To enable image access through the RPA CLI:

# ssh admin@rpa1 ‘enable_image_access group=<your RP consistency group> copy=<name of copy site> image=latest’

  • Fracture your SnapView clone
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview  -CloneGroupNameCloneID lun1CloneGrp_1 0100000000000000 lun2CloneGrp_1 0100000000000000 lun3CloneGrp_1 0100000000000000 -o
  • Disable image access to RPA
# ssh admin@rpa1 ‘disable_image_access group=<your RP consistency group> copy=<name of copy site>’
  • End backup mode on source
SQL> alter database end backup;
SQL> alter system archive log current;
SQL> select max(first_change#) from v$archived_log
  • Modify ASM diskgroup name.  On ASM 11gR2, we can use “renamedg” from asmcmd, but since our test is on 11gR1, we need to use kfed to modify the header block of the ASM devices.  First, do a “kfed read” on all devices that comprise the target ASM diskgroups you want to mount.  Direct this to a text file, edit the file and search for string “grpname”.  Change the diskgroup from “PROD_DG” to “CLN1_DG” and save the file.  Then, use “kfed merge” to modify the disk.
# kfed read dev=/asm_c1/disk1 > disk1.txt
# kfed read dev=/asm_c1/disk2 > disk2.txt
# kfed read dev=/asm_c1/disk3 > disk3.txt
(edit disk1.txt, disk2.txt, and disk3.txt, replacing PROD_DG1 with CLN1_DG1, etc - only modify the line that has the sting “grpname” in it)
# kfed merge /asm_c1/disk1 text=disk1.txt
# kfed merge /asm_c2/disk1 text=disk2.txt
# kfed merge /asm_c3/disk1 text=disk3.txt
Next, re-read the block header using kfed to validate …
  • Mount ASM diskgroups
SQL> alter diskgroup CLN1_DG1 mount;
SQL> alter diskgroup CLN1_DG2 mount;
SQL> alter diskgroup CLN1_DG3 mount;
  • Generate backup controlfile from source environment, edit and save so you have a “CREATE CONTROLFILE” script to use on your CLN1 database
  • Build controlfile for CLN1
  • At this point, in order for CLN1 to be recoverable, you need the archive log preceding the “begin backup” and archive log after the “end backup” in a place where CLN1 can see them.  I use RMAN to copy these archivelogs to a location CLN1 can “see”
  • Login to SQL*Plus with CLN1 set and set LOG_ARCHIVE_DEST_1 to the location you’ve copied the source archive logs to.
  • Issue a “recover database using backup controlfile”
  • Specify the archive logs copied from 3 steps ago, and cancel after the last one
  • Open with RESETLOGS
  • Add TEMP files
  • Do whatever other post-cloning needs to be done
Cloning PROD to SNP1 with SnapView Snapshots and Oracle ASM
The process for cloning based on SnapView snapshots is similar to SnapView cloning from a high-level standpoint; the Navisphere commands are obviously different and there is some additional work that needs to be done to ensure the resultant snap LUNs are visible and addressable on the host.
  • Put source database in backup mode and note latest archive log
  • Enable image access on RPA Replica LUNs (see previous section)
  • Start Snapview Session.  In the below example, the “-lun 1 2 3″ creates a snapshot session on Replca LUNs 1, 2, and 3
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -startsession snap_snp1 -lun 1 2 3 -consistent
  • Create Snapshots
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -createsnapshot snp1_1 -snapshotname snap_snp1
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -createsnapshot snp1_2 -snapshotname snap_snp1
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -createsnapshot snp1_3 -snapshotname snap_snp1
  • Activate Snapshots
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -activatesnapshot snp1_1 -snapshotname snap_snp1
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -activatesnapshot snp1_2 -snapshotname snap_snp1
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> snapview -activatesnapshot snp1_3 -snapshotname snap_snp1
  • Add Snapshot LUNs to EMC Storage group.  Assuming storage group is SG_drhost and snapshot LUNs will be named, 3000, 3001, and 3002 respectively.  It’s good to map out which snapshot LUN numbers you want to use ahead of time
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> storagegroup -addsnapshot -gname SG_drhost -hlu 3000 -snapshotname snp1_1
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> storagegroup -addsnapshot -gname SG_drhost -hlu 3001 -snapshotname snp1_2
naviseccli -h cx4-dr -Scope 0 -User admin -Password <Nav pwd> storagegroup -addsnapshot -gname SG_drhost -hlu 3002 -snapshotname snp1_3
  • Find and fix host (HP-UX) devices so they’re usable.  Since we’re added a new set of LUNs to our storage group (3000, 3001, and 3002), we need to do the following on HP-UX for them to be visible and mountable:

# /sbin/init.d/agent stop

# ioscan -fnCdisk

# insf

# /sbin/init.d/agent start

#/sbin/powermt check force dev=all

# /sbin/powermt config

# /sbin/powermt save

Then do a “powermt display dev=all” and search for snp1_1, snp1_2, and snp1_3.  Once you find these find the HP-UX device for these and symbolically link /asm_s1/disk1, /asm_s1/disk2, and /asm_s3/disk3 to these

  • Disable image access on RPA (see previous section)
  • End backup mode on source (see previous section
  • Modify ASM block header on target SNP1 (see previous section).  Use devices /asm_s1/disk1, /asm_s1/disk2, and /asm_s1/disk3 based on previous steps
  • Create ASM diskgroups for SNP1 (see previous section).  Reference above devices
  • Mount ASM diskgroups for SNP1 (see previous section)
  • Generate script to create controlfile (see previous section)
  • Build controlfile for SNP1
  • Find and backup needed archive logs to destination SNP1 can see (see previous section)
  • Recover SNP1 (see previous section)
  • Open SNP1 with RESETLOGS and add temp files
What about HP-UX LVM and Traditional File-Systems?
The overall approach to cloning Oracle using SnapView Clones or Snapshots for traditional HP-UX file-systems is very similar to the steps required for Oracle ASM, with the following exceptions:
  • You obviously won’t have to drop/dismount/create/mount ASM disk groups
  • You won’t have to modify ASM block headers
  • No need to symbolically link to HP-UX device names
Consider these requirements
  • PROD is a production database running on prodhost
  • CLN1 is an Oracle copy of production running on drhost and will be a complete SnapView clone of production
  • CLN2 is an Oracle copy production running on drhost and will be a complete SnapView clone of production
  • SNP1 is an Oracle copy production running on drhost and will be a SnapView snapshot of production
  • SNP1 is an Oracle copy production running on drhost and will be a SnapView snapshot of production
Further, PROD is physically stored on two file-systems, /u01 and /u02.   /u01 is mounted to /dev/vgprod1/lvol1 on prodhost and /u02 is mounted to /dev/vgprod2/lvol1 to prodhost.
To mount CLN1, for example, to fractured clone LUNs for the first time, we need to do this:
  • Ensure clone LUNs are in the proper CX4 Storage Group
  • # /sbin/init.d/agent stop
  • # ioscan -fnCdisk
  • # insf
  • # /sbin/init.d/agent start
  • # /sbin/powermt display dev=all
  • Examine output of PowerPath command above and note device names.  For sake of example, we’ll focus on the first LUN, /u01, which we want to mount as /u01_cln1.  The device for this is /dev/dsk/c80t0d1 (again, for example)
  • # vgchgid /dev/dsk/c80t0d1
  • # mkdir /dev/vgcln1
  • # mknod /dev/vgcln1/group c 64 0×100000 — this “0×100000″ should be unique, check /dev/vg*/group*)
  • # vgimport /dev/vgcln1 /dev/dsk/c80t0d1
  • # vgchange -a y /dev/vgcln1
  • # fsck /dev/vgcln1/lvol1
  • # mkdir /u01_cln1
  • # mount -o delaylog /dev/vgcln1/lvol1 /u01_cln1
Upon subsequent clones, we simply need to unmount file-systems prior to the clone, deactivate the volume group(s) using “vgchange -a n <vg>”, allow the SnapView clone to complete, then resume with the “vgchange -a y” step above.
The steps to do snapshots is very similar, but (I think) there’s a chance that you’ll get different physical devices each time you remove and add snapshot LUNs to the storage group. This being the case, the steps for cloning (above) need to be done in their entirety each time.

Written by John Clarke

July 8th, 2010 at 3:49 pm

Oracle on HP-UX and EMC CLARiiON: Migrating from file-systems to Oracle ASM

without comments

Goals:

  • Move Oracle storage from HP XP platform to EMC CLARiiON storage array
  • Utilize EMC Enterprise Flash Drives (EFDs) for most database files, FC drives for application/Oracle software, Oracle redo logs, archive log destination, and UNDO tablespace files
  • Transition from HP-UX 11.23 file-system based storage to Oracle ASM (on combination of EFDs and FC drives)

Environment Details:

  • HP RP8420 PA-RISC, HP-UX 11.23
  • New storage array: EMC CX4-480 with a large collection of FC drives and 5 Enterprise Flash Drives
  • Old storage array: HP XP-128 with many multiple FC drives
  • EMC PowerPath 5.1

After installing and powering on the new CLARiiON storage array, the first step is to use NaviSphere to configure Raid Groups, LUNs, and a single Storage Group.

EMC CLARiiON Array Configuration

After installing the CLARiiON CX4-480 and installing NaviSphere, login to NaviSphere.  In this configuration, we did the following:

Created four (4) Raid Groups:

  • RG0 = 5-disk RAID5, Vault (CLARiiON O/S), cached enabled with default values
  • RG1 = 4-disk RAID5, EFDs, cache disabled
  • RG2 = 5-disk RAID5, cache enabled with defaults
  • RG3 = 10-disk RAID 1/0 on FC drives, cache enabled with defaults

Create LUNs:

  • LUN0: EFD drives in RG1, intended use is database files, 1.2Tb in size
  • LUN1: FC drives from RG3, 200Gb in size
  • LUN2: FC drives from RG3, 200Gb in size
  • LUN3: FC drives from RG2, 250Gb in size
  • LUN4: FC drives from RG2, 400Gb in size

Storage group:

  • We only have one host we’ll zone to any/alll of these LUNs
  • Storage group = detux4 (the host name)

SAN Zoning and Host Configuration

At this point, we zone the newly created LUNs to DETUX4.  First, install Navisphere Agent on the host (detux4 in this case), assign via the Storage Group in NaviSphere, and scan (discover) disks. From the host:

  • # /sbin/init.d/agent stop
  • # ioscan -fnCdisk
  • # insf -e
  • # /sbin/init.d/agent start
  • # /sbin/powermt check
  • # /sbin/powermt config
  • # /sbin/powermt save

Configure PowerPath and Document Devices

After installing and licensing EMC PowerPath 5.1, we’ll do a “powermt config” and assign PowerPath devices to the raw devices discovered in the previous step.   At the completion of this step, it’s important to understand and document the raw device names and how they map to CLARiiON LUNs.  In our case:

/dev/rdsk/c57t0d0 == raw device mapped to LUN0 (EFD LUN)

/dev/rdsk/c57t0d1 == raw device mapped to LUN1 (FC)

/dev/rdsk/c57t0d2 == raw device mapped to LUN2 (FC)

(the three raw devices above will represent the 3 disks we’ll use for our ASM diskgroups)

/dev/rdsk/c57t0d3  == device for file-system based storage for non-ERP databases.  For purposes of this document, we don’t plan on using these

/dev/rdsk/c57t0d4 == device on which we’ll build an HP-UX physical device, volume group, and our logical volumes and file-systems for Applications/Oracle binaries and data.

A note about PowerPath: When deciding which raw device to use for your ASM diskgroup, you can just pick one of the ones listed.  So in a sample “powermt display dev=all” output, you may see something like this:

CLARiiON ID=APM00101902811 [SG_detux4.aam.net]
Logical device ID=60060160ED532400CC44C4D9E16FDF11 [LUN 0]
state=alive; policy=CLAROpt; priority=0; queued-IOs=0;
Owner: default=SP A, current=SP B       Array failover mode: 1
==============================================================================
————— Host —————   - Stor -   — I/O Path –  — Stats —
###  HW Path               I/O Paths    Interf.   Mode    State   Q-IOs Errors
==============================================================================
57 0/0/2/1/0.11.57.0.0.0.0  c57t0d0   SP A1     active  alive       0      0
58 0/0/2/1/0.11.59.0.0.0.0  c58t0d0   SP B0     active  alive       0      0
59 1/0/2/1/1.11.57.0.0.0.0  c59t0d0   SP A1     active  alive       0      0
60 1/0/2/1/1.11.59.0.0.0.0  c60t0d0   SP B0     active  alive       0      0
I chose to pick /dev/rdsk/c57t0d0, but could just as easily picked /dev/rdsk/c58t0d0 or either of the other two.  If one of the paths fails, PowerPath will automatically handle redirection.  In subsequent sections of this post you’ll notice we’re symbolically linking /asm/disk1 to /dev/rdsk/c57t0d0 and building our ASM diskgroup on it.  Should the HBA on the server fail down this path, or if SP A1 fails on the CX4, PowerPath will handle the alternate path and no changes should be required inside ASM.  But this should be tested of course.

Build HP-UX Volumes/Filesystems

The goal here is to present 4 file-systems to HP-UX, /m001_emc, /m002_emc, /m003_emc, and /m004_emc. The steps to make this work are:

  • # pvcreate /dev/rdsk/c57t0d4
  • # vgcreate -s 16 /dev/vg53 /dev/dsk/c57t0d4
  • # lvcreate -L 102384 /dev/vg53
  • # newfs -o largefiles /dev/vg53/rlvol1
  • # newfs -o largefiles /dev/vg53/rlvol2
  • # newfs -o largefiles /dev/vg53/rlvol3
  • # newfs -o largefiles /dev/vg53/rlvol4
  • # mkdir /m001_emc; mkdir /m002_emc; mkdir /m002_emc; mkdir /m004_emc
  • # mount -o delaylog /dev/vg53/lvol1/ /m001_emc
  • # mount -o delaylog /dev/vg53/lvol2/ /m002_emc
  • # mount -o delaylog /dev/vg53/lvol3/ /m003_emc
  • # mount -o delaylog /dev/vg53/lvol4/ /m004_emc
  • Add entries in /etc/fstab for new filesystems

Create Symbolic LInks for ASM Disks

I like to create symbolic links for ASM disk to enable a clear convention for asm_diskstring settings

  • # mkdir /asm
  • # ln -s /dev/rdsk/c57t0d0 /asm/disk1
  • # ln -s /dev/rdsk/c57t0d1 /asm/disk2
  • # ln -s /dev/rdsk/c57t0d2 /asm/disk3
  • # chown -h oraasm:dba /asm/disk*
  • # chown oraasm:dba /asm/disk*
  • # chmod 660 /asm/disk*

When we build ASM diskgroups, we’ll do it based on these /asm/diskX names

Install ASM 11.1.0.7

  • Download Oracle 11.1.0.7 software and install.  I like to install using a different Unix account (oraasm in this case) but with the same default group (dba)
  • Create ASM instance
  • Patch to PSU3 (9352179).  This is required when we migrate using RMAN from existing file-systems to ASM diskgroups; if not done, we’ll get errors trying to copy controlfile to ASM diskgroup.
  • NOTE: Before patching an ASM instance, you need to shut it down and stop /etc/init.d/init.cssd (/etc/init.d/init.cssd stop), and when complete you’ll need to do “/etc/init.d/init.cssd start”

Configure Oracle Environment

As part of this initiative, we’re moving not just the database and its files to new storage on the CLARiiON, but also applications files/binaries from HP-UX mount points on the old storage array to the new mount points on the CLARiiON.  In order for this to work, we need to ensure that all environment variables (ORACLE_HOME, etc) are pointing to the new mount point, the init.ora is placed in $ORACLE_HOME/dbs and has its path-dependent settings changed to new mount point locations, etc.  In addition, login as oracle, source the environment, and run:

$ relink all

Ensure that binaries are relinked correctly.

Build ASM Disk Groups

  • Login as oraasm
  • Set init.ora parameter asm_diskstring=’/asm/disk*’ and bounce instance
  • Create ERP5_DG1

SQL> create diskgroup ERP5_DG1 external redundancy disk ‘/asm/disk1′;
SQL> alter diskgroup ERP5_DG1 add directory ‘+ERP5_DG1/controlfile’;
SQL> alter diskgroup ERP5_DG1 add directory ‘+ERP5_DG1/controlfile/ERP5′;
SQL> alter diskgroup ERP5_DG1 set attribute ‘compatible.rdbms’='11.1′;
SQL> alter diskgroup ERP5_DG1 set attribute ‘compatible.asm’='11.1′;

  • Create ERP5_DG2

SQL> create diskgroup ERP5_DG2 external redundancy disk ‘/asm/disk2′;
SQL> alter diskgroup ERP5_DG2 add directory ‘+ERP5_DG2/controlfile’;
SQL> alter diskgroup ERP5_DG2 add directory ‘+ERP5_DG2/controlfile/ERP5′;
SQL> alter diskgroup ERP5_DG2 set attribute ‘compatible.rdbms’='11.1′;
SQL> alter diskgroup ERP5_DG2 set attribute ‘compatible.asm’='11.1′;

  • Create ERP5_DG3

SQL> create diskgroup ERP5_DG3 external redundancy disk ‘/asm/disk3′;
SQL> alter diskgroup ERP5_DG3 add directory ‘+ERP5_DG3/controlfile’;
SQL> alter diskgroup ERP5_DG3 add directory ‘+ERP5_DG3/controlfile/ERP5′;
SQL> alter diskgroup ERP5_DG3 set attribute ‘compatible.rdbms’='11.1′;
SQL> alter diskgroup ERP5_DG3 set attribute ‘compatible.asm’='11.1′;
For each of the three diskgroups, I’m leaving the allocation unit (AU) defaulted to 1Mb, as this is an OLTP database

  • Bounce the ASM instance and ensure the 3 new diskgroups are mounted by checking the alert log and querying v$asm_diskgroup

Prepare ERP5 to be Moved to ASM

  • SQL> create pfile=’/home/oracle/cx4mig/initERP5.ora’ from spfile
  • Note file# of current temporary tablespaces - this can be done afterwards as well
  • Note old controlfile location - in our case, one of them was on /r030/oradata/ERP5/control01.ctl
  • Edit /home/oracle/cx4mig/initERP5.ora and changed control_files:

control_files = (’+ERP5_DG1/ERP5/control01.ctl’,
‘+ERP5_DG2/ERP5/control02.ctl’,
‘+ERP5_DG3/ERP5/control03.ctl’)

  • Adjust any other paths that may refer to old ORACLE_BASE or ORACLE_HOME locations to use the new /m00X_emc ones
  • Shutdown ERP5 (shutdown immediate)
  • SQL> startup nomount pfile=’/home/oracle/cx4mig/initERP5.ora

Migrate to ASM: Control Files

The first step in the migration is to move the controlfiles to the ASM diskgroups. We’ll triplex these (based on the settings listed in the previous section.

  • Launch RMAN and connect:
  • $ rman
  • RMAN> connect target /
  • RMAN> restore controlfile from ‘/r030/oradata/ERP5/control01.ctl’

You should see a successful controlfile restore to ASM.  It will automatically copy /r030/oradata/ERP5/control01.ctl to each of the three ASM locations specified in the initERP5.ora

  • RMAN> alter database mount

At this point, the database will be mounted against the ASM controlfiles

Migrate to ASM: Backup Database to ASM

Now we use RMAN to create backup copies of all files to the ASM diskgroups.  In simple cases in which all files will be copied to the same ASM diskgroup, a single RMAN “backup as copy database …” would suffice.  But in this case, when we’ll be restoring UNDO tablespaces to a different ASM diskgroup (comprised of FC drives), we’ll need to tackle using a series of “backup as copy tablespace …” commands to ensure things are done right.

The first step is to do something like this:

select ‘backup as copy tablespace ‘||tablespace_name||’ format ”+ERP5_DG1”;’
from dba_tablespaces
where contents not in (’TEMPORARY’,'UNDO’)
union
select ‘backup as copy tablespace ‘||tablespace_name||’ format ”+ERP5_DG3”;’
from dba_tablespaces
where contents in (’UNDO’)
/

Spool this to an output file and put the contents in an RMAN script - for purposes of example let’s save the script is backup_copy.rcv.  The contents should look like this:

configure device type disk parallelism 4;
run {
backup as copy tablespace SYSTEM format ‘+ERP5_DG1′;
backup as copy tablespace TOOLS format ‘+ERP5_DG1′;
backup as copy tablespace USERS format ‘+ERP5_DG1′;
backup as copy tablespace CARX format ‘+ERP5_DG1′;
… lots more , lines inserted from output of above query

}

  • Launch RMAN and “connect target /”
  • RMAN> @backup_copy.rcv
  • Allow all tablespace files to restore to either ERP5_DG1 or ERP5_DG3.  NOTE: We chose a degree of parallelism to 4 to allow multiple RMAN copu threads for tablespaces that contained multiple files.  Had we chose to follow a “backup as copy datafile X” approach, we would not have been able to parallelize the work
  • Let all the database files to be copied to the ASM diskgroup and resolve all errors along the way
  • RMAN> switch database to copy;
  • RMAN> alter database open;

At this point, your controlfiles and all database files will reside on ASM.  I copied /home/oracle/cx4mig/initERP5.ora to $ORACLE_HOME/dbs at this point; built an spfile from it, and bounced again.

Migrate to ASM: Move TEMPFILES to ASM

To handle moving TEMP tablespace files to ASM:

  • RMAN> connect target /
  • RMAN> run {
    set newname for tempfile 1 to ‘+ERP5_DG1′;
    switch tempfile all;}
  • RMAN> shutdown immediate
  • RMAN> startup

Now, our temporary tablespace file lives on ASM in ERP5_DG1 (ASM LUN)

Migrate to ASM: Build Redo Log Group Members on ASM

As things stand, the only parts of the database residing on file-systems are our online redo logs.  We have 2 approaches to get them to ASM: create new redo log groups on ASM and drop old groups, or add members on ASM diskgroups to existing redo log groups and drop old members.  I like the second approach:

  • Find your groups

set lines 120
col group# format 99
col member format a70
col status format a20;SELECT a.group#, b.member, a.status FROM v$log a, v$logfile bWHERE a.group#=b.group#

  • SQL> alter database add logfile member ‘+ERP5_DG2′ to group 10;
  • SQL> alter database add logfile member ‘+ERP5_DG3′ to group 10;
  • SQL> alter database add logfile member ‘+ERP5_DG2′ to group 11;
  • SQL> alter database add logfile member ‘+ERP5_DG3′ to group 11;
  • SQL> alter database add logfile member ‘+ERP5_DG2′ to group 12;
    etc …
  • Re-run query from first bullet and validate that each of your redo log groups has a member on both ERP5_DG2 and ERP5_DG3
  • Do “alter sytem switch logfile” enough times to cycle through each group, and re-run query above
  • Do “alter database drop logfile member ‘/<file system redo log path’; for each redo log group member still residing on file-systems

Migrate to ASM: Setting Archive Destination to ASM

  • SQL> alter system set log_archive_dest_1=’LOCATION=+ERP5_DG2′;

Test It All!

  • Bounce your database, ensure things come up cleanly, switch logfiles
  • Run full-scans against large tables and compare I/O times against non-EFD storage (look for another blog on this …)
  • Do failure testing by unplugging HBAs one-at-a time on the HP server and/or SAN switch to ensure PowerPath correctly keeps connections established and no loss-of-service is experienced
  • Do a load test

Written by John Clarke

June 10th, 2010 at 10:15 pm

Posted in Oracle

Large SGA on 32-bit Redhat Linux

without comments

Many DBAs are familiar with the SGA size limitations on 32-bit platforms.  This post shows how to allocate a 3Gb buffer cache on 32-bit RHAS 3.

  • Step 1: Mount /dev/shm to as type ramfs.  Edit /etc/fstab and add an entry like this:

none                    /dev/shm                ramfs defaults,size=4G 0 0

  • Step 2: do a “mount -a” to mount /dev/shm.  I use ramfs instead of tmpfs because it doesn’t use swap; tmpfs does.  With ramfs memory allocation will also grow dynamically, whereas when using tmpfs it will not.
  • Step 3: As root, assuming your database is owned by the Linux account oracle, whose primary group is “dba”, do this:

# chown oracle:dba /dev/shm

  • Step 4: Add the following to /etc/security/limits.conf to increase maximum memory lock parameters.  Ensure “oracle” user has his environment sourced to establish these settings.

oracle            soft    memlock         3145728
oracle            hard    memlock         3145728

  • Step 5: Login as oracle and do “ulimit -a”; validate that memlock is set to the above values
  • Step 6: Edit /etc/sysctl.conf and add/change the following.  When complete, do “sysctl -w” to activate changes into the Linux kernel.  The “vm.hugetbl_pool” setting below is set based on the output of a script provided here (http://download-uk.oracle.com/docs/cd/B28359_01/server.111/b32009/appi_vlm.htm) - run this AFTER Oracle is started at the completion of this document to get a realistic value for vm.hugetbl_pool and adjust accordingly

kernel.sem = 1000 32000 100 150
kernel.shmmax = 4294967295
kernel.shmall = 4194304
net.ipv4.ip_local_port_range = 1024 65000
vm.pagecache = 10 20 30
kernel.shmmni=4096
vm.hugetlb_pool=4096

  • Step 7: Unset db_cache_size, db_xk_cache_size, sga_target, sga_max_size, memory_target init.ora parameters and manually set shared_pool_size to appropriate value.  You can use “show sga” to determine this
  • Step 8: Set use_indirect_data_buffers=true
  • Step 9: Set db_block_buffers such that the product of db_block_buffers and db_block_size = 3G
  • Step 10: In oracle’s .profile/.bash_profile, set DISABLE_MAP_LOCK=1.  This is required to avoid unnecessarily long connect times for databases that are connected to frequently

export DISABLE_MAP_LOCK=1

  • Step 11: Stop oracle, source environment, ensure O/S limits are correct (ulimit -a), ensure /dev/shm is owned by oracle (ls -al /dev/shm), ensure DISABLE_MAP_LOCK=1, and then start Oracle
  • Step 12: Add the following to /etc/rc2.d/S99local:

mount /dev/shm

chown oracle:dba /dev/shm

Test.  Enjoy the benefits of a large cache.  Test across reboots to ensure /dev/shm is mounted correctly.

Written by John Clarke

June 10th, 2010 at 3:03 pm

How to Customize R12 Payments Output (checks, ACH, positive pay, seperate remittance advice)

without comments

In R12 the formatting of payments (Checks, ACH, wires) and the output of related documents (positive pay, Separate Remittance Advice) is done by a Java concurrent programs that generate XML output which is then formatted by BI Publisher.

Oracle Payments provides the IBY_FD_EXTRACT_EXT_PUB extensibility package to construct custom XML element structure that can be added to the payment XML extract generated by Oracle Payments. The package specification and body definition can be found in files ibyfdxes.pls and ibyfdxeb.pls respectively. These files are located in the $IBY_TOP/patch/115/sql directory.

The package allows custom elements to be created at five levels within the payment XML extract. You cannot customize the package specification, but the package body contains stubbed functions that you can customize.  The five functions are as follows:

Instruction - FUNCTION Get_Ins_Ext_Agg(p_payment_instruction_id IN NUMBER) RETURN XMLTYPE
This function allows XML element to be introduced at instruction level and run only once for the instruction.

Payment - FUNCTION Get_Pmt_Ext_Agg(p_payment_id IN NUMBER) RETURN XMLTYPE
This function allows XML element to be introduced at payment level and run once for each payment in the instruction.

Document Payable - FUNCTION Get_Doc_Ext_Agg(p_document_payable_id IN NUMBER) RETURN XMLTYPE
This function allows XML element to be introduced at document payable level and run once for each document payable in the instruction.

Document Payable Line - FUNCTION Get_Docline_Ext_Agg(p_document_payable_id IN NUMBER, p_line_number IN NUMBER) RETURN XMLTYPE
This function allows XML element to be introduced at document payable line level and run once for each document payable line in the instruction.

Payment Process Request - FUNCTION Get_Ppr_Ext_Agg(p_payment_service_request_id IN NUMBER) RETURN XMLTYPE
This function allows XML element to be introduced at document payable level and run once for each payment process request.

Here are two examples where I utilized this extension:

1) Last Day of Period for Positive Pay file:

The Positive Pay File only provides the tree <PositivePayDataExtract> with <OutboundPayment> for each payment that it captures. In order to add data to the positive pay file XML  you must use the function IBY_FD_EXTRACT_EXT_PUB.Get_Pmt_Ext_Agg.

2) Count of ACH Transmissions per day:

This count was needed once per payment instruction so I utilized IBY_FD_EXTRACT_EXT_PUB.Get_Ins_Ext_Agg to insert the new xml element at the bottom of </OutboundPaymentInstruction> (the root of the XML for payment batches). This funciton also appears in the XML stream for separate remittance advice, checks, etc.

Here is a screen shot of how we coded the Get_Ins_Ext_Agg:

IBY_FD_EXTRACT_EXT_PUB.Get_Ins_Ext_Agg

IBY_FD_EXTRACT_EXT_PUB.Get_Ins_Ext_Agg

Written by Stephen Manning

April 27th, 2010 at 9:47 pm

Receivable Commitments: Guarantee vs. Deposit

without comments

I recently received a requirement to account for the entire deferred revenue amount of a sale, then recognize the revenue over time, based on consumption or clicks from a customer. Oracle Receivables has two “commitment” transaction classes to support this type of requirement.

The two commitment transaction classes are:

Guarantees: as you associate invoice transactions the amount due “moves” from the guarantee to the invoice associated to it.

Deposits: as you associate invoice transactions the amount due on the invoice is reduced or wiped out and all cash, collections, and aging can be tracked on the single deposit.

In my situation Deposits is the way to go for the following reasons:

One bill to the customer is required; we are billing the entire amount of the “deal” using installment terms (example: 25% of invoice every 30 days). Opposed to guarantees where there is an amount due on each invoice associated to the guarantee (not acceptable in my case).

Also, cash can be applied to the deposit, guarantees do not allow cash applications.

Finally, aging can be “centralized” as the deposit and installment payments are managed and reported under a single transaction. The impression invoice transactions are simply recognizing revenue in my model, in a supported, auditable way.

Accounting Flow for my setup:

1. Create the Deposit with installment terms
Example: $400K, $100K due at 30, 60, 90, 120 days.

Accounting Class DR CR
Receivable $400K
Deferred Revenue (Offset Account) $400K

Note: Detailed aging would show 4 installments of $100k due every 30 days.

2. Create a cash receipt applied to first installment.
Example: $100K paid for first amount due.

Accounting Class DR CR
Cash $100K
Receivable $100K

3. Create the impressions Invoice to recognize revenue - Linking it to the Deposit commitment Invoice.
Example: $90K in impressions delivered

Accounting Class DR CR
Deferred Revenue $90K
Revenue $90K

Balance goes to $0 once associated to the deposit which has enough remaining dollars to cover entire invoice.

Written by Stephen Manning

April 27th, 2010 at 9:46 pm

Using DBMS_SQLDIAG

without comments

As a DBA, have you ever had an issue you suspected may be a bug and have been asked to generate “test data” for Oracle development?  We ran into this at a client recently and found a cool 11g utility (at least I *think* it’s new :)) to get Oracle Support the data they need to reproduce the issue in-house.

The situation had to do with optimizer_features_enable being set to 11.1.0.7 in a database recently upgraded form 9.2.0.5 in an Oracle eBusiness Suite environment (11.5.10.2) that utilized Oracle Reports heavily.  Our problem was specific to a custom Report that had optimizer hints embedded in the main query.  With optimizer_features_enable set to 11.1.0.7, the report retrieved no rows.  With it set to 9.2.0.x or 10.2.0.x, it returned the proper number of rows.  Based on this data discrepancy, we felt it safe to set optimizer_features_enable < 11.1.0.7 across the board, as we didn’t know the scope of the issue.

During our work on an SR with Oracle, they asked for us to send the query, all the versions and optimizer settings, as well as an export of all the tables involved in the query with exported optimizer statistics.  Our problem was several-fold; first, the query was complex and had many embedded views, so we didn’t really want to spend time deconstructing it to get a comprehensive list of tables to export.  Second, the underlying tables were very large (hundreds of millions of rows for a few of them) and we didn’t have disk space or quite frankly, time, to export all the tables in their entirety.

Enter DBMS_SQLDIAG …

Using DBMS_SQLDIAG and 11g Data Pump features, we were able to quickly generate a complete test case to export a subset of the rows from all the impacted tables, very quickly and with minimal disk space requirements.  Here’s what we did:

  1. Grabbed the offending query from a TKPROF’d trace file
  2. Used this syntax to generate a test case:

declare
tc_out clob;
begin
dbms_sqldiag.export_sql_testcase(directory=>’<directory>’,
sql_text=>’<SQL Text>’,
testcase => tc_out,
exportdata=>TRUE,
samplingpercent=>1);
end;
/

In the above example, note the following:

  • <directory> is a valid directory - check DBA_DIRECTORIES
  • <SQL Text> is the SQL statement from the TKPROF output
  • exportdata=>TRUE tells DBMS_SQLDIAG to export the data from the base tables
  • samplingpercent=>1 tells Data Pump to use a 1% sampling size.  This was important to limit the number of rows

After executing, a number of XML, log, and Data Pump export dumps are generated to <directory> and available to upload to the SR!

One additional step we took was to export table statistics for all the tables involved in the query.  For this, we looked in the log file for all tables export and used DBMS_STATS.EXPORT_TABLE_STATS to export segment statistics.

The obvious benefit here is that it enabled us to continue working on the SR, but some other possible applications of DBMS_SQLDIAG could be for internal testing purposes, testing functionality/performance across versions of Oracle without a complicated upgrade, regression testing, and so forth.

Written by John Clarke

March 3rd, 2010 at 12:14 am

Connecting an Oracle Database with a DB2 Database

without comments

On a recent project we had a business and technology reason to connect Oracle EBS running 11g to a DB2 database.  After a few weeks of researching for the best practice and approach we decided on the following implementation steps.

  1. Download a DB2 driver, such as from DataTek, and download to your application server in any storage directory.
  2. Create a directory called “YM” under your custom application top.  example: $CUSTOM_TOP/java/YM.  (Assumes you have already created a $CUSTOM_TOP and it has a directory called “java”.
  3. Copy all files from the storage directory to $CUSTOM_TOP/java/YM
  4. Add 3 entries to s_adovar_classpath and s_adovar_afclasspath to point to the files in $CUSTOM_TOP/java/YM.
  5. Make sure you run auto-config on your updated environment.
  6. Bounce the application and database tier.
  7. Perform any select, insert, update and or delete from the Oracle EBS application via java program to the DB2 database.  The java program will reference the DB2 connection from a jdbc connect string such as: “jdbc:oracle:db2://servername.com:port;databasename=xxxxxx; User=xxxx; Password=xxxx”

Written by Jim Brull

January 30th, 2010 at 5:42 pm

Future Proofing Oracle EBS: Tip 1

without comments

Most organizations leave their mission critical systems vulnerable to security threats and performance degradation. Recent studies show that organizational constraints are at the core of this issue. These constraints range from organizational policies, budgets and staff availability and even competency.

26 percent of organizations apply critical security and performance patches as they are released, 20 percent will eventually apply 6 to 9 months later while another 20 percent have no requirement at all to apply them. That leaves many companies data unprotected.

There are several ways to combat these constraints. One way is gain support from your organization. This can come in the form of support from executives, security / audit team and other critical policy makers. By establishing new and or updating existing security policies, and as a critical component, patching, these guidelines and timeliness of patching removes some of these constraints. A second way to protect and improve data integrity is to use technology. By keeping current on latest software, technology can help you reduce time and budget constraints of getting current applications and databases tested and allow your team to proactively assess the impact to your enterprise.

Centroid believes in 2 degrees of continuous change instead of wide arcs of re-activeness. These small degrees of change allows for continuous improvement across the organization. Whether it be through technology or process slight proactive adjustments make the enterprise perform at a higher degree then you can ever accomplish by large scale reactive measures.

Centroid is in the business of Future Proofing Oracle environments. In fact, Centroid is the leader in Future Proofing your Business and Technology and no one does it better. No one.

Oracle OA Framework OracleCallableStatement error in EBS R12

without comments

We have been using jdeveloper 10g to create new OA Framework forms for our R12 Oracle EBS applications 12.0.6 with database version of 10.2.0.4 without issues.

We then upgraded our database to 11.1.0.7.0 and EBS to 12.1.1.  That is when we encountered an issue with prior custom OA forms in EBS.  oracle.apps.fnd.framework.OAException: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.IllegalAccessError, msg=oracle/jdbc/driver/OracleCallableStatement.

This issue/error is specifically related to the OracleCallableStatement used in 11g.  With 11g certain features/libraries are not available.  The Oracle Database 10g Release 2 (10.2) will be the last major release to offer the following feature/libraries: classes12.jar, oracle.jdbc.drivers.* and OracleConnectionCacheImpl. In other words these features/libraries will not be available in the next major database release (for example 11g).

Since our java code was using an OracleCallableStatement and also using the oracle.jdbc.drivers on the 11g database we encountered the error above.  This means that public Oracle JDBC driver classes that were referenced by oracle.jdbc.driver package must be referenced by using the oracle.jdbc package . Therefore, Java programs must not import public classes that  have belonged to the oracle.jdbc.driver package - but import  those classes from the  oracle.jdbc package.

Since our code was using “import oracle.jdbc.driver*” we had to replace it with import oracle.jdbc.*

Once we replaced the above statement; the OracleCallableStatement executed as expected.

Written by Jim Brull

November 12th, 2009 at 9:07 pm