/*
|| Oracle 11gR2 ACFS Implementation Listing
||
|| Contains code samples for implementing the new ASM Clustered File System (ACFS) as
|| part of the Oracle 11gR2 New Features article series.
||
|| Author: Jim Czuprynski
||
|| Usage Notes:
|| These examples are provided to demonstrate various Oracle 11gR2 Grid Infrastructure
|| features, and they should be carefully proofread before being executed
|| against any existing Oracle database to avoid potential damage!
*/

/*  
|| Listing 2.1:
|| Complete description of asmca “silent” command line scripting options
*/

$> asmca -help
asmca [-silent] [-sysAsmPassword <SYS user password>] [-asmsnmpPassword <ASM monitor password>] {<command> <options>}
Please refer to the manual for details.
You can enter one of the following commands:

1. Configure an ASM instance by specifying the following command and parameters:
        -configureASM
                [-sysAsmPassword <SYS user password>]
                [-asmsnmpPassword <ASM monitor password>]
                [(-param <paramname=paramvalue>)]
                -diskString <disk discovery path>
                (-diskGroupName <disk group name>
                        (-disk <disk path> [-diskName <disk name>] |
                         -diskList <comma separated disk list>
                                [-diskSize <disk size in MB>] 
                                [-failuregroup <failure group name>] 
                                [-force|-noforce] 
                                [-quorum|-noquorum])
                        [-redundancy <HIGH|NORMAL|EXTERNAL>]
                        [-au_size <2^0 ~ 2^6 (1 ~ 64)>]
                        [-compatible.asm <10.1 ~ 11.2>]
                        [-compatible.rdbms <10.1 ~ 11.2>]
                        [-compatible.advm <11.2>])

2. Upgrade an existing ASM instance by specifying the following command and parameters:
        -upgradeASM
                [-asmsnmpPassword <ASM monitor password>]

3. Configure ASM parameters by specifying the following command and parameters:
        -configureParameter
                (-param <paramname=paramvalue>)
                [-sysAsmPassword <SYS user password>]

4. Create diskgroups by specifying the following command and parameters:
        -createDiskGroup
                [-diskString <disk discovery path>]
                (-diskGroupName <disk group name>
                        (-disk <disk path> [-diskName <disk name>] |
                         -diskList <comma separated disk list>
                                [-diskSize <disk size in MB>] 
                                [-failuregroup <failure group name>] 
                                [-force|-noforce] 
                                [-quorum|-noquorum])
                        [-redundancy <HIGH|NORMAL|EXTERNAL>]
                        [-au_size <2^0 ~ 2^6 (1 ~ 64)>]
                        [-compatible.asm <10.1 ~ 11.2>]
                        [-compatible.rdbms <10.1 ~ 11.2>]
                        [-compatible.advm <11.2>])
                [-sysAsmPassword <SYS user password>]

5. Add disks to diskgroups by specifying the following command and parameters:
        -addDisk
                [-diskString <disk discovery path>]
                (-diskGroupName <disk group name>
                        (-disk <disk path> [-diskName <disk name>] |
                         -diskList <comma separated disk list>
                                [-diskSize <disk size in MB>] 
                                [-failuregroup <failure group name>] 
                                [-force|-noforce] 
                                [-quorum|-noquorum])
                [-sysAsmPassword <SYS user password>]

6. Create volumes by specifying the following command and parameters:
        -createVolume
                (-volumeName <ASM volume name>
                -volumeDiskGroup <ASM disk group name for the volume>
                -volumeSizeGB <ASM volume size in GB>
                [-volumeRedundancy <INHERIT|HIGH|NORMAL|EXTERNAL>])
                [-sysAsmPassword <SYS user password>]

7. Create ASM Cluster File Systems by specifying the following command and parameters:
        -createACFS
                (-acfsVolumeDevice <ASM volume device>)
                [-sysAsmPassword <SYS user password>]

8. Delete ASM instance(s) by specifying the following command and parameters:
        -deleteASM
                [-force]
                [-dropDiskGroups]
                [-sysAsmPassword <SYS user password>]


/* 
|| Listing 2.2:
|| Complete description of acfsutil command-line options
*/

#> acfsutil help

Usage: acfsutil [-h] command ...   # (Version 11.2.0.1.0.0)

             -h - help

 Command Subcmd Arguments
-------- ------ ----------------------------------------------------------------
    help                                 - display this message
 version                                 - display ACFS version information
    info fs                              - Display all ACFS file systems
    info fs     [<path> ...]             - Display specific ACFS file sys
    info fs     -o <item> <path>         - Display specific file sys item:
    info fs     -o                           freespace,    totalspace,
    info fs     -o                           mountpoints,  volumes,
    info fs     -o                           available,    ismountpoint,
    info fs     -o                           isavailable,  iscorrupt,
    info fs     -o                           isadvm,       diskgroup,
    info fs     -o                           redundancy,   resizeincrement,
    info fs     -o                           stripewidth,  stripecolumns,
    info fs     -o                           primaryvolume
    info file   <path> [<path> ...]      - Display specific file info
    info id     <file-identifier> <mountpoint> - 
    info id           Display the pathname associated with the given  
    info id           ACFS file identifier and mountpoint.
    rmfs        <device>                 - Remove unmounted ACFS file sys
    size        [-|+]nnn[K|M|G|T|P] [-d <device>] <path> - Resize file system
registry        [-l]                     - Display registry contents
registry        -l <mountpoint>          - Display a specific mount point
registry        -l <device>              - Display a specific device
registry        -m <device>              - Display a specific mount point associated with a device
registry        -a [-f] [-o <opts>] [-n <nodes>] <device> <mountpoint> - Add a mount point
registry        -d [<mountpoint> | <device>] - Delete a mount point or a device
    tune        AcfsMaxOpenFiles         - Maximum number of open files
    tune                                   (Windows only)
    snap create <snap_name> <mountpoint> - create a file system snapshot
    snap delete <snap_name> <mountpoint> - delete a file system snapshot


/* 
|| Listing 2.3:
|| Installing a new Oracle 11gR2 Database Home within an ACFS-controlled directory
*/

Choosing Installation Options
Figure 2.6. Choosing Installation Options

Installing Database Software Only
Figure 2.8. Installing Database Software Only

Choosing a Non-Clustered Database Installation
Figure 2.8. Choosing a Non-Clustered Database Installation

Choosing the Oracle Home’s Installation Location
Figure 2.9. Choosing the Oracle Home’s Installation Location

Picking Administration Groups
Figure 2.10. Picking Administration Groups

Validating Installation Prerequisites
Figure 2.11. Validating Installation Prerequisites

Installation Summary Confirmation

Figure 2.12. Installation Summary Confirmation

Installation Progress Report
Figure 2.13. Installation Progress Report

Successful Oracle Home Installation Confirmation (post root.sh execution)
Figure 2.14. Successful Oracle Home Installation Confirmation (post root.sh execution)