Friday, March 7, 2014

Disk Group Templates

  • Templates are used to set striping, redundancy, and region attributes for ASM files.
  • Striping attribute options are:
    • FINE: 128 KB stripe size
    • COARSE: 1 allocation unit (AU_SIZE attribute) stripe size
  • Redundancy attribute options are:
    • MIRROR: Two-way mirroring
    • HIGH: Three-way mirroring
    • UNPROTECTED: No ASM mirroring
  • A set of default templates is created for each disk group.
    • Default template settings depend on disk group redundancy.
  • The redundancy attribute applies only to NORMAL redundancy disk groups.

Viewing Templates

  • In either an ASM or database instance, V$ASM_TEMPLATE displays one row for every template present in every disk group mounted by the ASM instance.
  • The ASMCMD lstmpl command shows all the templates for a given disk group.
$ asmcmd lstmpl -l -G data

The following query lists all the templates associated with the DATA disk group. The SYSTEM column returns Y for system-generated templates and N for user-defined templates.

SQL> SELECT T.NAME, T.REDUNDANCY, T.STRIPE, T.SYSTEM

2 FROM V$ASM_TEMPLATE T, V$ASM_DISKGROUP G

3 WHERE T.GROUP_NUMBER = G.GROUP_NUMBER

4 AND G.NAME = 'DATA';


Managing Disk Group Templates

Creating your own templates allows you to set the right combination of attributes to meet your requirements. It also allows you to specify an intuitive name for the attribute set.

For example, in a normal or high redundancy disk group, you might use a template with a redundancy setting of UNPROTECTED to create transient files without the overhead of mirroring. This can be a useful way of creating short-term databases for testing and development purposes.



SQL> ALTER DISKGROUP DATA ADD TEMPLATE unprot ATTRIBUTES (UNPROTECTED);

SQL> ALTER DISKGROUP DATA ADD TEMPLATE reliable ATTRIBUTES (HIGH FINE);

SQL> ALTER DISKGROUP DATA MODIFY TEMPLATE DATAFILE ATTRIBUTES (FINE);



Managing Disk Group Templates with ASMCMD
Use the mktmpl statement to add disk group templates.

ASMCMD> mktmpl -G DATA -–redundancy unprotected unprotect;

Use the chtmpl command to modify disk group templates.

ASMCMD> chtmpl –G DATA -–striping fine DATAFILE;

Use the rmtmpl command to drop disk group templates.

ASMCMD> rmtmpl –G DATA unprotect;

Use the lstmpl command to view disk group templates.

ASMCMD> lstmpl –G DATA


Using Disk Group Templates

You can apply disk group templates to newly created files in the following ways:

Alias file name with template

SQL> ALTER TABLESPACE myspace ADD
2 DATAFILE '+DATA(mytemplate)/mydir/myspace02.dbf' SIZE 50M;

Incomplete file name with template

SQL> ALTER TABLESPACE myspace ADD
2 DATAFILE '+DATA(mytemplate)' SIZE 50M;

DB_CREATE_FILE_DEST database initialization parameter

SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+DATA(mytemplate)';

SQL> CREATE TABLESPACE yourspace;

No comments:

Post a Comment