Tuesday, November 6, 2012

Managing Disk Group Templates


Managing Disk Group Templates
Templates are used to set attributes of files created in an Oracle ASM disk group. When a file is created, redundancy and striping attributes are set for that file based on an explicitly named template or the system template that is the default template for the file type.
When a disk group is created, Oracle ASM creates a set of default templates for that disk group. The set consists of one template for each file type (data file, control file, redo log file, and so on) that is supported by Oracle ASM. For example, a template named ONLINELOG provides the default file redundancy and striping attributes for all redo log files written to Oracle ASM disks. Default template settings depend on the disk group type. The default template for data files for a normal redundancy disk group sets two-way mirroring, while the corresponding default template in a high redundancy disk group sets three-way mirroring. You can modify these default templates.
For example, default redundancy for the online redo log files (ONLINELOG template) for a normal redundancy disk group is MIRROR. In Example 4-1, this setting means that when one copy of a redo log file extent is written to a disk in failure group controller1, a mirrored copy of the file extent is written to a disk in failure group controller2. To support the default mirroring of a normal redundancy disk group, at least two failure groups must be defined.
Table 7-6 lists the default templates and the attributes that are associated to matching files. As the table shows, the initial redundancy value of each default template depends on the type of disk group that the template belongs to.
Using clauses of the ALTER DISKGROUP statement, you can add new templates to a disk group, modify existing ones, or drop templates. The reason to add templates is to create the right combination of attributes to meet unique requirements. You can then reference a template name when creating a file, thereby assigning desired attributes based on an individual file rather than on the file type.
The V$ASM_TEMPLATE view lists all of the templates known to the Oracle ASM instance. For an example of the information displayed in the V$ASM_TEMPLATE view, see Example 6-10.
Template Attributes
Table 7-4 shows the permitted striping attribute values and allocation unit size chunks. These values correspond to the STRIPE column of V$ASM_TEMPLATE.
Table 7-4 Permitted values for Oracle ASM template striping attribute
Striping Attribute Value
Description
FINE
Striping in 128 KB chunks.
COARSE
Striping in 1 MB chunks.

Table 7-5 shows the permitted redundancy values for Oracle ASM templates. These values correspond to the REDUND column of V$ASM_TEMPLATE.
Table 7-5 Permitted values for Oracle ASM template redundancy attribute
Redundancy Attribute Value
Resulting Mirroring in Normal Redundancy Disk Group
Resulting Mirroring in High Redundancy Disk Group
Resulting Mirroring in External Redundancy Disk Group
MIRROR
Two-way mirroring
Three-way mirroring
(Not allowed)
HIGH
Three-way mirroring
Three-way mirroring
(Not allowed)
UNPROTECTED
No mirroring
(Not allowed)
No mirroring

Table 7-6 shows the initial attribute settings for the default templates. The type of mirroring associated with the Mirroring column for normal, high, and external redundancy disk groups is specified in Table 7-5. For example, the Mirror column for high redundancy disk groups displays MIRROR in Table 7-6. In Table 7-5, the MIRROR value for high redundancy disk groups corresponds to Three-way mirroring.








Table 7-6 Oracle ASM system default templates attribute settings
Template Name
File Striping
Mirroring, Normal Redundancy Disk Group
Mirroring, High Redundancy Disk Group
Mirroring, External Redundancy Disk Group
Primary Region
Mirror Region
CONTROLFILE
FINE
HIGH
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
DATAFILE
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
ONLINELOG
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
ARCHIVELOG
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
TEMPFILE
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
BACKUPSET
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
PARAMETERFILE
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
DATAGUARDCONFIG
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
FLASHBACK
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
CHANGETRACKING
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
DUMPSET
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
XTRANSPORT
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
AUTOBACKUP
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
ASMPARAMETERFILE
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD
OCRFILE
COARSE
MIRROR
MIRROR
UNPROTECTED
COLD
MIRRORCOLD






Table 7-7 shows the permitted primary and mirror region values for Oracle ASM templates. These values correspond to the PRIMARY_REGION and MIRROR_REGION columns of V$ASM_TEMPLATE. For more information about disk regions, see "Intelligent Data Placement".
Table 7-7 Permitted values for Oracle ASM template primary and mirror region attribute
Primary and Mirror Region Attribute Value
Description
COLD, MIRRORCOLD
Use the inner most tracks (closest to spindle) on the disk drive.
HOT, MIRRORHOT
Use the outermost tracks which have greater speed and higher bandwidth.

Adding Templates to a Disk Group
To add a template to a disk group, use the ADD TEMPLATE clause of the ALTER DISKGROUP statement.
If the name of your new template is not listed in Table 7-6, then it is not used as a default template for database file types. To use the template, you must reference its name when creating a file.
When adding a template to a disk group, the attributes are optional. If no redundancy attribute is specified, then the value defaults to MIRROR for a normal redundancy disk group, HIGH for a high redundancy disk group, and UNPROTECTED for an external redundancy disk group. If you do not specify a striping attribute, then the value defaults to COARSE. If you do not specify a value for the primary or mirror region attributes, then the value defaults to COLD and MIRRORCOLD respectively.
Example 7-13 creates a new template named reliable for the normal redundancy disk group data.
Example 7-13 Adding a template with high redundancy to a disk group
ALTER DISKGROUP data ADD TEMPLATE reliable ATTRIBUTES (HIGH FINE);
Example 7-14 creates a new template named unreliable that specifies UNPROTECTED (no mirroring) for files.
Example 7-14 Adding a template with external redundancy to a disk group
ALTER DISKGROUP data ADD TEMPLATE unreliable ATTRIBUTES (UNPROTECTED);
Note:
Oracle discourages using unprotected files unless you have implemented hardware mirroring. The previous example is presented only to further illustrate how the attributes for templates are set.
See Also:
Oracle Database SQL Language Reference for more information about the ALTER DISKGROUP...ADD TEMPLATE command
Modifying a Disk Group Template
The MODIFY TEMPLATE clause of the ALTER DISKGROUP statement enables you to modify the attribute specifications of an existing system default or user-defined disk group template. Only specified template attributes are changed. Unspecified properties retain their current value. When you modify an existing template, only new files created by the template reflect the attribute changes. Existing files maintain their attributes.
Example 7-15 changes the striping attribute specification of the reliable template for disk group data.
Example 7-15 Modifying a disk group template
ALTER DISKGROUP data MODIFY TEMPLATE reliable
     ATTRIBUTES (COARSE);
Dropping Templates from a Disk Group
Use the DROP TEMPLATE clause of the ALTER DISKGROUP statement to drop one or more templates from a disk group. You can only drop templates that are user-defined; you cannot drop system default templates.
Example 7-16 drops the previously created template unreliable from data:
Example 7-16 Dropping a template from a disk group
ALTER DISKGROUP data DROP TEMPLATE unreliable;
Creating Tablespaces in Oracle ASM: Specifying Attributes with Templates
Use the SQL ALTER SYSTEM and CREATE TABLESPACE statements to create a tablespace that uses a user-defined template to specify the attributes of the data file.
Example 7-17 assumes that the template (mytemplate) has been defined.
Example 7-17 Using a user-defined template to specify attributes
ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+data(mytemplate)';

CREATE TABLESPACE mytblspace;

No comments:

Post a Comment