Oracle 10g Automatic Storage Management
Overview of ASM as a Storage Option for Oracle 10g
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
Automatic Storage Management
ASM is a storage management system for Oracle data
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
ASM and Oracle Managed Files
ASM extends the power of Oracle Managed Files
Creates and manages files automatically
Understands different Oracle file types
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
The ASM database may be managed with srvctl commands
Normally auto-managed by Oracle
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
ASM Disk Group Redundancy
ASM Disk Groups may be defined with different levels of redundancy
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
ASM Performance Tips
ASM performance is sensitive to the number of disk spindles utilized
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
Multiple RAID 1 disks can be utilized in a Disk Group
ASM will provide the disk striping
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
Creating ASM Disk Groups
ASM disk groups may be created as part of the installation process
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
Creates a name alias for the 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 File Creation
ASM files will be created automatically by Oracle when a new object is created:
ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+dgroup_01'; CREATE TABLESPACE mytspace1;
Note: ASM files are only visible to Oracle through SQL, ASMCMD, Grid Control, or OEM
Not visible as an OS level file looks like a raw device to the OS
ASM File Formats
ASM files have the following format:
+group/dbname/file_type/file_type_tag.file.incarnation Where: +group is the disk group name dbname is the DB_UNIQUE_NAME of the database file_type is the Oracle file type tag is a descriptor appropriate to the file type file.incarnation is the file/incarnation pair, used to ensure uniqueness
An example of a fully qualified ASM filename is:
+dgroup_01/oradb/controlfile/CF.248.1
Creating ASM Directories
Before creating an alias for an ASM file, you must first create a directory hierarchy to contain the file:
ALTER DISKGROUP dgroup_01 ADD DIRECTORY '+dgroup_01/newdir';
ASM File Aliases
An alias may be created in SQL for an ASM file name:
ALTER DISKGROUP dgroup_01 ADD ALIAS '+dgroup_011/newdir/control_2.dbf' FOR '+dgroup_01/oradb/controlfile/CF.248.2';
Oracle Enterprise Manager may be used to assign file aliases
An SQL statement is still required to create the directory (as of Oracle 10g R1)
Creating a Tablespace with ASM
Creating a Tablespace in ASM: Example 1
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 statement creates the tablespace and its datafile:
CREATE TABLESPACE tspace2;
Creating a Tablespace with ASM
Creating a Tablespace in ASM: Example 2
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;
Creating a Tablespace with ASM
Creating a Tablespace in ASM: Example 3
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).
CREATE UNDO TABLESPACE myundo DATAFILE '+dgroup3(my_undo_template)/myfiles/my_undo_t s' SIZE 200M;
ASMCMD
ASMCMD is a command-line utility for viewing and manipulating files and directories within ASM disk groups.
Can be used in interactive mode Commands can be placed in OS scripts
Available with 10g R2 ASMCMD can be used to:
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
OEM (Grid Control) ASM Home Page
In Grid Control or Database Control (OEM) you can log into an ASM instance target (usually +ASMn)
Check overall Disk Group health Specific tabs for:
Performance Administration Maintenance
OEM (Grid Control) ASM Performance Page
Performance Graphs for Disk Group metrics:
Disk Group I/O response Time Disk Group I/O Operations Disk Group I/O Throughput
OEM (Grid Control) ASM Administration Page
Provides administrative access to disk groups
Mount Disk Groups Dismount Disk Groups Create Disk Groups Drill down to more detail
OEM (Grid Control) ASM Configuration Page
Configure parameters for Disk Groups
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