一、template定义、作用
Templates are used to set redundancy (mirroring) and striping attributes of files created in an 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, 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) supported by ASM. For example, a template named ONLINELOG provides the default file redundancy and striping attributes for all redo log files written to ASM disks.
Default template settings depend on the disk group type. For example, the default template for datafiles for a normal redundancy disk group sets 2-way mirroring, while the corresponding default template in a high redundancy disk group sets 3-way mirroring.You can modify these default templates.
The V$ASM_TEMPLATE view lists all of the templates known to the ASM instance.
二、Adding Templates to a Disk Group
To add a new template for a disk group, you use the ADD TEMPLATE clause of the ALTER DISKGROUP statement. You specify the name of the template, its redundancy attribute, and its striping attribute.
语法:
ALTER DISKGROUP disk_group_name ADD TEMPLATE template_name
ATTRIBUTES ([{MIRROR|HIGH|UNPROTECTED}] [{FINE|COARSE}]);
Both types of attribute are optional. If no redundancy attribute is specified, 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 no striping attribute is specified, the value defaults to COARSE.
If the name of your new template is not one of the names listed in Table below, it is not used as a default template for database file types. To use it, you must reference its name when creating a file.如:+dgroup(template_name)/alias --Alias ASM Filename with Template;
+dgroup1(my_template) --Incomplete ASM Filename with Template
ASM System Default Templates Attribute Settings
|
Template Name |
Striping |
Mirroring, Normal Redundancy Disk Group |
Mirroring, High Redundancy Disk Group |
Mirroring, External Redundancy Disk Group |
|
CONTROLFILE |
FINE |
HIGH |
HIGH |
UNPROTECTED |
|
DATAFILE |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
ONLINELOG |
FINE |
MIRROR |
HIGH |
UNPROTECTED |
|
ARCHIVELOG |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
TEMPFILE |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
BACKUPSET |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
PARAMETERFILE |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
DATAGUARDCONFIG |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
FLASHBACK |
FINE |
MIRROR |
HIGH |
UNPROTECTED |
|
CHANGETRACKING |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
DUMPSET |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
XTRANSPORT |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
|
AUTOBACKUP |
COARSE |
MIRROR |
HIGH |
UNPROTECTED |
三、Modifying a Disk Group Template
The ALTER 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 properties are changed. Unspecified properties retain their current value.
例如:ALTER DISKGROUP dgroup2 ALTER 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.
如:ALTER DISKGROUP dgroup2 DROP TEMPLATE unreliable;
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25744374/viewspace-731418/ ,如需转载,请注明出处,否则将追究法律责任。