$ cat agent_down.ksh export AGENT_INSTALL_PASSWORD=${AGENT_PASSWORD} ./agentDownload.linux_x64 -b /apps/oracle/product -m rac01.dbaexpert.com -r 4900 -y 

Download the agentDownload.linux_x64 script from Grid Control Server to each of the clients.

Leveraging the mass deployment agent installation method, you can deploy Oracle Intelligent Agents in matter of minutes. This script will basically download the product jar file and install the agent in the $ORACLE_BASE/product/agent11g directory.

Posted by Charles Kim, Oracle ACE Director


# — # — Partition alignment of OCR / Vote Disks with 1MB offset echo “2048,,” | sfdisk -uS /dev/emcpowera echo “2048,,” | sfdisk -uS /dev/emcpowerb echo “2048,,” | sfdisk -uS /dev/emcpowerc

# — # — Partition alignment of Data / FRA disks with 4MB offset echo “8192,,” | sfdisk -uS /dev/emcpowerd echo “8192,,” | sfdisk -uS /dev/emcpowere echo “8192,,” | sfdisk -uS /dev/emcpowerf echo “8192,,” | sfdisk -uS /dev/emcpowerg echo “8192,,” | sfdisk -uS /dev/emcpowerh

Posted by Charles Kim, Oracle ACE Director


Here’s a simple script to see how much space that you have at the disk and disk group level. This script should work on all the operating systems but only tested on Linux. The only portion that you will have to change is the ‘ps -ef’ line.

export DB=$(ps -ef |grep +ASM |grep -i pmon |awk {‘print $8’} |sed -e ‘s/asm_pmon_//g’)

export ORACLE_SID=${DB}

export ORAENV_ASK=NO

. oraenv

sqlplus -s / as sysasm <<!!

col pct_free for 999 hea ‘Pct|Free’

select name, path,

    total_mb, free_mb,

    round(free_mb/total_mb*100,2) pct_Free

from v\$asm_disk

where total_mb >1

order by name;

 

select name, state, round(total_mb/1024,2) Total_GB,

   round(free_mb/1024,2) Free_GB,

   round(free_mb/total_mb*100,2) pct_Free,

   allocation_unit_size/1024/1024 AU,

  compatibility, database_compatibility

from v\$asm_diskgroup

where total_mb > 1;

!!

Posted by Charles Kim, Oracle ACE Director


Being able to specify a sector size larger than the default 512 bytes is another ASM feature of Oracle Databases 11g Release 2. Now, we can specify a sector size up to 4k. There is a new SECTOR_SIZE attribute while create the ASM disk group.

ASM Cluster File System (Oracle ACFS) does not support 4 KB sector drives.
There’s performance implications for Oracle ACFS when utilizing 4 KB sector disk drives in 512 sector emulation mode.

Posted by Charles Kim, Oracle ACE Director

Posted in ASM

Prior to Oracle Database 11g Release 2, you had to issue the following commands in sqlplus to mount and dismount a diskgroup:

 
SQL> alter diskgroup fra mount;

Diskgroup altered.

SQL> alter diskgroup fra dismount;

Diskgroup altered.

As of Oracle Database 11g Release 2, an easier and more SA friendly approach is provided with asmcmd:

 
ASMCMD> mount fra

Looking at the disk group information with the lsdg command, we see that the fra disk group is now mounted:

 
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     15640     5352                0            5352              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     45792    45736                0           45736              0             N  DG_EXTERNAL/
MOUNTED  EXTERN  N         512   4096  1048576     42068    42016                0           42016              0             N  FRA/

Let’s issue the umount command in asmcmd. Notice that the syntax is umount in asmcmd and dismount in SQL*Plus:

 
ASMCMD> umount fra

Looking at the disk group information with the lsdg command, we see that the fra disk group is no longer mounted:

 
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     15640     5352                0            5352              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     45792    45736                0           45736              0             N  DG_EXTERNAL/

Posted by Charles Kim, Oracle ACE

Posted in ASM

Creating Volumes with the volcreate command

 
ASMCMD> volcreate -G lobdata -s 4g vol_lob2

Note:
You can not create a mirror or high redundancy volume on an external redundant disk group.

 
ASMCMD> volcreate -G lobdata -s 4g --redundancy mirror vol_lob2
ORA-15032: not all alterations performed
ORA-15471: volume redundancy incompatible with diskgroup redundancy (DBD ERROR: OCIStmtExecute)

Displaying volume information with the volinfo command

With the -a option (and do not specify a diskgroup and volume), you will get a detailed information about every volume for every diskgroup

 
ASMCMD> volinfo -a
Diskgroup Name: DATA

         Volume Name: VOL_LOGFILE
         Volume Device: /dev/asm/vol_logfile-340
         State: ENABLED
         Size (MB): 3072
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: ACFS
         Mountpath: /apps/oracle/acfsmounts/data_vol_logfile 

         Volume Name: VOL_RPTS
         Volume Device: /dev/asm/vol_rpts-340
         State: ENABLED
         Size (MB): 5120
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: ACFS
         Mountpath: /apps/oracle/acfsmounts/data_vol_rpts 

Diskgroup Name: LOBDATA

         Volume Name: VOL_LOB
         Volume Device: /dev/asm/vol_lob-484
         State: ENABLED
         Size (MB): 4096
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: ACFS
         Mountpath: /apps/oracle/acfsmounts/lobdata 

         Volume Name: VOL_LOB2
         Volume Device: /dev/asm/vol_lob2-484
         State: ENABLED
         Size (MB): 4096
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: 
         Mountpath: 

To display volume information for a specific diskgroup, use the -G option:

 
ASMCMD> volinfo -G lobdata -a
Diskgroup Name: LOBDATA

         Volume Name: VOL_LOB
         Volume Device: /dev/asm/vol_lob-484
         State: ENABLED
         Size (MB): 4096
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: ACFS
         Mountpath: /apps/oracle/acfsmounts/lobdata 

         Volume Name: VOL_LOB2
         Volume Device: /dev/asm/vol_lob2-484
         State: ENABLED
         Size (MB): 4096
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: 
         Mountpath: 

To display volume information for a specific volume, use the -G option followed by the volume name of interest:

 
ASMCMD> volinfo -G DATA VOL_RPTS
Diskgroup Name: DATA

         Volume Name: VOL_RPTS
         Volume Device: /dev/asm/vol_rpts-340
         State: ENABLED
         Size (MB): 5120
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: ACFS
         Mountpath: /apps/oracle/acfsmounts/data_vol_rpts 

You can reverse query based on a volume device and lookup the volume information:

ASMCMD> volinfo --show_volume /dev/asm/vol_lob2-484
vol_lob2

Likewise, you can reverse lookup the disk group information based on the volume device:

ASMCMD> volinfo --show_diskgroup /dev/asm/vol_lob2-484
lobdata

Report volume I/O statistics

ASMCMD> volstat -G data

DISKGROUP NUMBER / NAME:  1 / DATA
---------------------------------------
  VOLUME_NAME
     READS           BYTES_READ      READ_TIME       READ_ERRS       
     WRITES          BYTES_WRITTEN   WRITE_TIME      WRITE_ERRS      
  -------------------------------------------------------------
  VOL_LOGFILE
     49862           3219816448      37565           0               
     3349            167577600       80043           0               
  VOL_RPTS
     125             71168           306             0               
     10              12288           90              0   

If the –show_volume is not specified, I/O statistics for all volumes of the disk group are displayed. To display a specific volume, use the show_volume parameter as shown below:

ASMCMD>  volstat -G data --show_volume vol_logfile

DISKGROUP NUMBER / NAME:  1 / DATA
---------------------------------------
  VOLUME_NAME
     READS           BYTES_READ      READ_TIME       READ_ERRS       
     WRITES          BYTES_WRITTEN   WRITE_TIME      WRITE_ERRS      
  -------------------------------------------------------------
  VOL_LOGFILE
     49862           3219816448      37565           0               
     3349            167577600       80043           0  

Enable/Disable a volume

ASMCMD> voldisable -G lobdata vol_lob2 
ASMCMD>          
ASMCMD> volenable -G lobdata vol_lob2

ASMCMD> voldisable -G lobdata vol_lob2

Use the -a option to enable all the volumes for the disk gruop

ASMCMD> volenable -G lobdata -a

Note:
You cannot disable a volume that is currently being accessed:

ASMCMD> voldisable -G lobdata vol_lob
ORA-15032: not all alterations performed
ORA-15468: volume 'VOL_LOB' in diskgroup 'LOBDATA' is currently being accessed (DBD ERROR: OCIStmtExecute)

Resizing an existing volume
[code language='sql'] 
ASMCMD> volresize -G LOBDATA -s 5G VOL_LOB2
ASMCMD> volresize -G LOBDATA -s 2G VOL_LOB2
The volume is not ACFS and the requested size is smaller than the current size.
Data corruption may occur.
Are you sure? [y/n]: y

Note:
You cannot volresize a volume that is being accessed. I wish the error message was more accurate.

 
ASMCMD> volresize -G LOBDATA -s 5G VOL_LOB
ORA-15032: not all alterations performed
ORA-15476: resize of ACFS volume must use ACFS resize command (DBD ERROR: OCIStmtExecute)

Deleting an existing volume from a disk group

You can use the voldelete command followed by the -G option for the diskgroup followed by the volume name to drop a volume from the diskgroup

 
ASMCMD> voldelete -G lobdata VOL_LOB2

You can set attributes for volumes. The attributes that are available are:
1. –usagestring
2. –mountpath
These attributes are information only and used for informational purposes only by ASM and not used by ASM. Here’s couple of examples with volset

 
[oracle@jin1 ~]$ asmcmd volset -G data --usagestring 'To Store temporary reports' VOL_RPTS
[oracle@jin1 ~]$ asmcmd volset -G data --mountpath 'We should mount this volume as /data/reports' VOL_RPTS

[oracle@jin1 ~]$ asmcmd volinfo -G data VOL_RPTS 
Diskgroup Name: DATA

         Volume Name: VOL_RPTS
         Volume Device: /dev/asm/vol_rpts-340
         State: ENABLED
         Size (MB): 5120
         Resize Unit (MB): 256
         Redundancy: UNPROT
         Stripe Columns: 4
         Stripe Width (K): 128
         Usage: To Store temporary reports
         Mountpath: We should mount this volume as /data/reports 

Posted by Charles Kim, Oracle ACE

Posted in ASM

FDISK Output

[root@rac103 ~]# fdisk -l

Disk /dev/hda: 82.3 GB, 82348277760 bytes

240 heads, 63 sectors/track, 10637 cylinders

Units = cylinders of 15120 * 512 = 7741440 bytes

Device Boot Start End Blocks Id System

/dev/hda1 * 1 1354 10236208+ 83 Linux

/dev/hda2 1355 6772 40960080 83 Linux

/dev/hda3 6773 7043 2048760 82 Linux swap

/dev/hda4 7044 10637 27170640 5 Extended

/dev/hda5 7044 7314 2048728+ 83 Linux

/dev/hda6 7315 8348 7817008+ 83 Linux

/dev/hda7 8349 9382 7817008+ 83 Linux

/dev/hda8 9383 10416 7817008+ 83 Linux

Change permission for disks

[root@rac103 ~]# cd /dev

[root@rac103 dev]# chown oracle:oinstall /dev/hda6

[root@rac103 dev]# chown oracle:oinstall /dev/hda7

[root@rac103 dev]# chown oracle:oinstall /dev/hda8

Configure ASM

[root@rac103 dev]# cd /etc/init.d

[root@rac103 init.d]# ls -l oracle*

-rwxr-xr-x 1 root root 18114 Oct 24 2006 oracleasm

[root@rac103 init.d]# ./oracleasm configure

Configuring the Oracle ASM library driver.

 

This will configure the on-boot properties of the Oracle ASM library

driver. The following questions will determine whether the driver is

loaded on boot and what permissions it will have. The current values

will be shown in brackets (‘[]’). Hitting <ENTER> without typing an

answer will keep that current value. Ctrl-C will abort.

 

Default user to own the driver interface []: oracle

Default group to own the driver interface []: oinstall

Start Oracle ASM library driver on boot (y/n) [n]: y

Fix permissions of Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: [ OK ]

Loading module “oracleasm”: [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

[root@rac103 init.d]#

[root@rac103 init.d]# ./oracleasm

Usage: ./oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

[root@rac103 init.d]# ./oracleasm createdisk DATA1 /dev/hda6

Marking disk “/dev/hda6” as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm createdisk DATA2 /dev/hda7

Marking disk “/dev/hda7” as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm createdisk FRA1 /dev/hda8

Marking disk “/dev/hda8” as an ASM disk: [ OK ]

[root@rac103 init.d]# ./oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# ./oracleasm querydisk DATA1

Disk “DATA1” is a valid ASM disk on device [3, 6]

[root@rac103 init.d]# ./oracleasm querydisk DATA2

Disk “DATA2” is a valid ASM disk on device [3, 7]

[root@rac103 init.d]# ./oracleasm querydisk FRA1

Disk “FRA1” is a valid ASM disk on device [3, 8]

[root@rac103 init.d]# ./oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# ./oracleasm scandisks

Scanning system for ASM disks: [ OK ]

[root@rac103 init.d]# ./oracleasm stop

Unmounting ASMlib driver filesystem: [ OK ]

Unloading module “oracleasm”: [ OK ]

[root@rac103 init.d]# ./oracleasm start

Loading module “oracleasm”: [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks: [ OK ]

 

Now start CSS for non-RAC ASM
cd $ORACLE_HOME/bin

[root@rac103 bin]# ./localconfig add

/etc/oracle does not exist. Creating it now.

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

 

Adding to inittab

Startup will be queued to init within 90 seconds.

Checking the status of new Oracle init process…

Expecting the CRS daemons to be up within 600 seconds.

CSS is active on these nodes.

rac103

CSS is active on all nodes.

Oracle CSS service is installed and running under init(1M)

 

Listdisks and Querydisk

[root@rac103 init.d]# /etc/init.d/oracleasm listdisks

DATA1

DATA2

FRA1

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda6

Disk “/dev/hda6” is marked an ASM disk with the label “DATA1”

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda7

Disk “/dev/hda7” is marked an ASM disk with the label “DATA2”

[root@rac103 init.d]# /etc/init.d/oracleasm querydisk /dev/hda8

Disk “/dev/hda8” is marked an ASM disk with the label “FRA1”

 

Resetting CSS to new oracle home

[root@rac103 bin]# ./localconfig reset /apps/oracle/product/11.1.0/ASM

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

Stale CSS daemon is running… killing it now

Cleaning up Network socket directories

Setting up Network socket directories

Adding to inittab

Startup will be queued to init within 30 seconds.

Checking the status of new Oracle init process…

Expecting the CRS daemons to be up within 600 seconds.

Cluster Synchronization Services is active on these nodes.

rac103

Cluster Synchronization Services is active on all the nodes.

Oracle CSS service is installed and running under init(1M)

 

Manually Cleaning up CSS

[root@rac103 bin]# ./localconfig delete

Stopping Cluster Synchronization Services.

Shutting down the Cluster Synchronization Services daemon.

Shutdown request successfully issued.

Shutdown has begun. The daemons should exit soon.

Cleaning up Network socket directories

[root@rac103 bin]# ps -ef |grep -i css

root 6477 6288 0 18:25 pts/2 00:00:00 grep -i css

[root@rac103 bin]# ./localconfig add

Successfully accumulated necessary OCR keys.

Creating OCR keys for user ‘root’, privgrp ‘root’..

Operation successful.

Configuration for local CSS has been initialized

 

Cleaning up Network socket directories

Setting up Network socket directories

Adding to inittab

Startup will be queued to init within 30 seconds.

Checking the status of new Oracle init process…

Expecting the CRS daemons to be up within 600 seconds.

Cluster Synchronization Services is active on these nodes.

rac103

Cluster Synchronization Services is active on all the nodes.

Oracle CSS service is installed and running under init(1M)

By Charles Kim, Oracle ACE Director

Posted in ASM

As of Oracle Database 11g Release 2, we can now rename disk groups. Why is this important? There’s two great reason why I think this feature is really beneficial for lot of companies. First, companies who leverage hardware mirroring or triple mirroring technologies such as EMC Business Continuity Volumes (BCV) or Hitachi Shadow Image (SI) can really benefit from this. Companies can now break their BCV or SI and rename their disk group where they have their production database and mount it again as another diskgroup. This way they can stand up another copy of their production database on the same physical server with minimal effort.

Note:
1. As of the initial release of Oracle Database 11g Release 2, the disk group rename feature does not handle the remaining task of standing up another database. You still have to re-catalog all the database files with the renamed disk group name. Additionally, you will have to create a new DB ID (nid).
2. If your company happens to have standardized disk group names with easily identifiable names such as as DATA, FLASH, LOBDATA, or FRA, you may have the same disk group names in Production, Staging, DEV and even disaster recovery site. For example, you can zone your production BCV or SI disks to your staging/Pre-Production/Model servers, rename the disk group called DATA to STAGE_DATA, and stand up the database from your BCV/SI.

Likewise, if you built disk groups with intelligent naming schemes (being a forward thinking architect 🙂 ), you may now choose to create easily identifiable disk group names such as DATA, FLASH, FRA, LOBDATA, etc.

Let’s look at the process of renaming a disk group. In order to rename a disk group, the disk group must be disounted across all the RAC nodes:

 
ASMCMD> umount dg_external
ASMCMD> umount fra

You can rename a disk group in one of two ways. The first option (default) renames the disk group in a single command. In our example, we will also specify the verbose mode for additional details in the output. The second option will create a configuration file at the end of phase one and will use the configuration file to complete the rename disk group operation.

Option #1 – Phase=Both:

The default phase is both.

 
[oracle@jin1 ~]$ renamedg dgname=fra newdgname=flash verbose=true

Parsing parameters..

Parameters in effect:

         Old DG name       : FRA 
         New DG name          : FLASH 
         Phases               :
                 Phase 1
                 Phase 2
         Discovery str        : (null) 
         Clean              : TRUE
         Raw only           : TRUE
renamedg operation: dgname=fra newdgname=flash verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:FRA1 with disk number:0 and timestamp (32924850 209876992)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/32/asm/orcl/1/libasm.so:ORCL:FRA1 with disk number:0 and timestamp (32924850 209876992)
Checking if the diskgroup is mounted
Checking disk number:0
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:FRA1
Modifying the header
Completed phase 2
Terminating kgfd context 0xb7f2c050

Let’s mount the renamed disk group:

 
[oracle@jin1 ~]$ asmcmd mount flash
[oracle@jin1 ~]$ asmcmd lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     23460    13140                0           13140              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     42068    42016                0           42016              0             N  FLASH/
MOUNTED  EXTERN  N         512   4096  1048576     45792    41631                0           41631              0             N  LOBDATA/

Option #2 – Phase 1 followed by Phase 2:

This option basically involves two steps to renaming a disk group. The first step, referred to as phase one, generates a configuration file. The config file has line item entries for each disk with changes to be made. The second step called phase two uses the generated config file to perform the rename function.

Another important information to note is that the renamedg command is an OS utility (not an asmcmd command). if you type renamedg with the -help option, you can get the complete syntax:

 
[oracle@jin1 ~]$ renamedg -help

Parsing parameters..
phase                           Phase to execute, 
                                (phase=ONE|TWO|BOTH), default BOTH

dgname                          Diskgroup to be renamed

newdgname                       New name for the diskgroup

config                          intermediate config file

check                           just check-do not perform actual operation,
                                (check=TRUE/FALSE), default FALSE

confirm                         confirm before committing changes to disks,
                                (confirm=TRUE/FALSE), default FALSE

clean                           ignore errors,
                                (clean=TRUE/FALSE), default TRUE

asm_diskstring                  ASM Diskstring (asm_diskstring='discoverystring',
                                'discoverystring1' ...)

verbose                         verbose execution, 
                                (verbose=TRUE|FALSE), default FALSE

keep_voting_files               Voting file attribute, 
                                (keep_voting_files=TRUE|FALSE), default FALSE

Let’s start the process, phase one, by creating our configuration file:

 
[oracle@jin1 ~]$ renamedg -phase one -dgname dg_external -newdgname lobdata -config rename_dg_external_2.conf

Parsing parameters..
renamedg operation: -phase one -dgname dg_external -newdgname lobdata -config rename_dg_external_2.conf
Executing phase 1
Discovering the group
Checking for hearbeat...
Re-discovering the group
Generating configuration file..
Completed phase 1

The configuration file rename_dg_external_2.conf looks like this:

 
[oracle@jin1 ~]$ cat rename_dg_external_2.conf
ORCL:HIGH1 DG_EXTERNAL LOBDATA
ORCL:HIGH2 DG_EXTERNAL LOBDATA
ORCL:HIGH3 DG_EXTERNAL LOBDATA

Now, let’s apply the configuration file and rename our diskgroup from DG_EXTERNAL to LOBDATA:

 
[oracle@jin1 ~]$ renamedg -phase two -dgname dg_external -newdgname lobdata -config rename_dg_external_2.conf

Parsing parameters..
renamedg operation: -phase two -dgname dg_external -newdgname lobdata -config rename_dg_external_2.conf
Executing phase 2
Completed phase 2

We should now be able to mount the renamed LOBDATA disk group with asmcmd:

 
[oracle@jin1 ~]$ asmcmd
ASMCMD> mount lobdata

With the lsdg asmcmd command, you can verify that the LOBDATA disk group is truly mounted:

 
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576     15640     5332                0            5332              0             N  DATA/
MOUNTED  EXTERN  N         512   4096  1048576     45792    45736                0           45736              0             N  LOBDATA/

Posted by Charles Kim, Oracle ACE

Posted in ASM


Guess what? As of Oracle Database 11g Release 2, we can create disk groups using the asmcmd command. Check out one of the new ways we can create a diskgroup using an XML file as a template. The mkdg ASMCMD command can accept an xml file as a parameter to create a disk group:

 
[oracle@jin1 ~]$ asmcmd mkdg dg_high.xml

[oracle@jin1 ~]$ cat dg_high.xml
<dg name="dg_high" redundancy="high">
  <fg name="fg1">
    <dsk string="ORCL:HIGH1" />
  </fg>
  <fg name="fg2">
    <dsk string="ORCL:HIGH2" />
  </fg>
  <fg name="fg3">
    <dsk string="ORCL:HIGH3" />
  </fg>
  <a name="compatible.asm" value="11.2"/>
  <a name="compatible.rdbms" value="11.2"/>
</dg>

And if we refresh our Automatic Storage Management main screen, we see the new diskgroup as shown here:
Picture 138.png

Let’s drop the dg_high disk group and show you how you can do this same thing with asmca command line interface.

Here’s the super hard syntax to drop the dg_high disk group:

 
ASMCMD> dropdg dg_high

Now, let’s create the disk group with asmca command line interface:

 
[oracle@jin1 ~]$ ksh cr_dg_high.txt

DiskGroup dg_high created successfully.

[oracle@jin1 ~]$ cat cr_dg_high.txt
asmca -silent -createDiskGroup \
-diskgroupname dg_high \
-redundancy high \
-disk 'ORCL:HIGH1' -disk 'ORCL:HIGH2' -disk 'ORCL:HIGH3' \
-failuregroup fg1 \
-failuregroup fg2 \
-failuregroup fg3 \
-au_size 64  \
-compatible.asm '11.2.0.0.0'  \
-compatible.rdbms '11.2.0.0.0'  \
-compatible.advm '11.2.0.0.0' 

In the example with the asmca command line syntax, we added a little twist by adding the allocation extent to 64 MB and adding the compatible.advm attribute.

Majority of the ASM customers run external redundancy and have the protection provided to us by the storage array vendors. Let’s see our same example and show how to create an external redundant diskgroup. Here’s the XML file for the external redundancy disk group:

 
[oracle@jin1 ~]$ cat dg_external.xml 
<dg name="dg_external" redundancy="external">
    <dsk string="ORCL:HIGH1" />
    <dsk string="ORCL:HIGH2" />
    <dsk string="ORCL:HIGH3" />
  <a name="compatible.asm" value="11.2"/>
  <a name="compatible.rdbms" value="11.2"/>
  <a name="compatible.advm" value="11.2"/>
</dg>

Using asmcmd, we will create the dg_external diskgroup:

 
[oracle@jin1 ~]$ asmcmd mkdg dg_external.xml

Alternatively, you can create the diskgroup in a single inline command as shown here:

 
ASMCMD> mkdg '<dg name="dg_external" redundancy="external">  <dsk string="ORCL:HIGH1" /> <dsk string="ORCL:HIGH2" /> <dsk string="ORCL:HIGH3" /> <a name="compatible.asm" value="11.2"/> <a name="compatible.rdbms" value="11.2"/>  <a name="compatible.advm" value="11.2"/> </dg>'

Obviously, nobody in their right mind would create a disk in this format. Wether you use asmca or asmcmd with an XML file or even the dreaded SQL*Plus, figure out what works best for you and stick with it. Depending on if you are a Unix System Administrator or Database Administrator, you may choose a different tool as your standard.

Posted by Charles Kim, Oracle ACE Director

Posted in ASM