Automatic Storage Management
Automatic Storage Management
Objectives
At the end of this module the student will understand the following tasks and concepts. Understand the role of ASM Understand ASM components Understand how ASM handles disk redundancy Understand ASM Disk Groups Understand ASM Directories and Files Understand the uses of the ASMCMD command Understand how OEM interfaces with ASM
ASM is designed to simplify DBA storage tasks Simply assign disks and walk away no data layout decisions Allows Oracle to manage thousands of files automatically Organizes available disks into disk groups
Offers built-in data mirroring and striping capabilities Automatically balances I/O load across disk group(s) Functionally like an LVM (Logical Volume Manager)
ASM Database
When ASM is enabled, Oracle automatically creates a small database for storing ASMrelated meta-data The default database name is +ASM
The default RAC instances are +ASMn, where n is the node number
ASM Components
Disk Groups
Oracle may provide disk mirroring (optional) Oracle will stripe files across all available disks Using ASM striping across a group of hardware striped LUNs can be beneficial to performance
Disks assigned to ASM Disk groups become ASM Disks Files written on ASM disks become ASM files
Files are named with an Oracle-defined format File name aliases may be defined for convenience A hierarchical directory structure may be defined for file aliases
ASM Components
Templates may be used to associate file attributes such as redundancy and striping with ASM files ASM is implemented through an ASM instance that runs as a service on each node
NORMAL redundancy indicates that Oracle will create a software mirror for each disk HIGH redundancy indicates that Oracle will create two mirror disks per data disk
Disk mirrors may be segregated into different locations by designating Failure Groups
EXTERNAL redundancy indicates that Oracle will not create any software mirrors. Hardware mirrors (if any) will be used instead
External redundancy is recommended for any system with a highly available storage array
Just like traditional storage, the number of IOs/second that can be sustained is directly proportional to the number of disks in the disk group
Always use External Redundancy if you are using RAID-capable storage hardware
Another option is to use multiple four disk RAID 10 groups as the building block for ASM Disk Groups
ASM will stripe on top of the hardware stripe, creating a stripe plaid, very desirable for OLTP and random I/O performance
Raw device files may be used though their file name aliases As an alternative to raw files, ASMLIB may be used to stamp raw device files
The CREATE DISKGROUP SQL statement may be used to create disk groups:
CREATE DISKGROUP dgroup_01 EXTERNAL REDUNDANCY DISK C:\ASM*'; The disk group created in this example will be referred to as +dgroup_01
ASM files will be created automatically by Oracle when a new object is created:
Note: ASM files are only visible to Oracle through SQL, ASMCMD, Grid Control, or OEM
Before creating an alias for an ASM file, you must first create a directory hierarchy to contain the file:
An SQL statement is still required to create the directory (as of Oracle 10g R1)
Let Automatic Storage Management create and manage the tablespace datafile for you: Assume the following initialization parameter setting:
DB_CREATE_FILE_DEST = '+dgroup2'
The following statements create a tablespace that uses a user defined template to specify the redundancy and striping attributes of the datafile:
SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+dgroup1(my_template)'; SQL> CREATE TABLESPACE tspace3;
The following statement creates an undo tablespace with a datafile that has an alias name, and with attributes that are set by the user defined template my_undo_template (not Oracle Managed Files).
ASMCMD
ASMCMD is a command-line utility for viewing and manipulating files and directories within ASM disk groups.
List the contents of disk groups Perform searches Create and remove directories and aliases Display space utilization And more.
ASMCMD Syntax
Command cd
du exit find help ls attributes of lsct lsdg mkalias mkdir pwd rm rmalias
Description Changes the current directory to the specified directory. Displays the total disk space occupied by ASM files in the specified ASM directory and all its subdirectories, recursively. Exits ASMCMD. Lists the paths of all occurrences of the specified name (with wildcards) under the specified directory. Displays the syntax and description of ASMCMD commands. Lists the contents of an ASM directory, the of the specified file, or the names and attributes all disk groups. Lists information about current ASM clients. Lists all disk groups and their attributes. Creates an alias for a system-generated filename. Creates ASM directories. Displays the path of the current ASM directory. Deletes the specified ASM files or directories. Deletes the specified alias, retaining the file that the alias points to.
ASMCMD Example
In the following example, the rm command operates on the file undotbs1.272.557429239, which in this case is a relative path. ASMCMD prepends the current directory to the command argument to obtain the absolute path to the file
ASMCMD [+] > cd +dgroup1 ASMCMD [+DGROUP1] > cd sample/datafile ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > ls EXAMPLE.269.555342243 SYSAUX.257.555341961 SYSTEM.256.555341961 UNDOTBS1.258.555341963 UNDOTBS1.272.557429239 USERS.259.555341963 ASMCMD [+DGROUP1/SAMPLE/DATAFILE] > rm undotbs1.272.557429239
In Grid Control or Database Control (OEM) you can log into an ASM instance target (usually +ASMn)
Disk Group I/O response Time Disk Group I/O Operations Disk Group I/O Throughput
Mount Disk Groups Dismount Disk Groups Create Disk Groups Drill down to more detail
Data Discovery Path path for discovering Disk Groups Auto Mount Disk Groups list of Disk Groups to mount automatically at startup Rebalance Power affects speed of Disk Group rebalancing. High numbers are faster, with more I/O overhead (1-11)
Review
Should you use normal redundancy for a RAC system on a SAN? What ASM component associates redundancy and file striping attributes with a file type? Do you have to create a file name for each new Oracle object? List the format of a fully qualified ASM file Give an example of an ASCMD command.
Summary
ASM provides an easy-to-administer option for allocating storage ASM extends the concept of Oracle Managed Files ASM can provide both disk striping and disk redundancy ASM components include Disk Groups, ASM Disks, Templates and ASM instances ASM Directories, Files and File Aliases may be optionally created ASMCMD may be used to simulate a traditional file system command line interface Grid Control (OEM) provides several useful ASm oriented screens