asm管理二

创建磁盘组

假设asm_diskstring初始化参数设置成/devices/*,下面的磁盘被asm发现

ASM disk discovery identifies the following disks in directory /devices.

/devices/diska1
/devices/diska2
/devices/diska3
/devices/diska4
/devices/diskb1
/devices/diskb2
/devices/diskb3
/devices/diskb4
  • The disks diska1 - diska4 are on a separate SCSI controller from disks diskb1 - diskb4.

SQL> STARTUP NOMOUNT
SQL> CREATE DISKGROUP dgroup1 NORMAL REDUNDANCY
  2  FAILGROUP controller1 DISK
  3 '/devices/diska1',
  4 '/devices/diska2',
  5 '/devices/diska3',
  6 '/devices/diska4'
  7 FAILGROUP controller2 DISK
  8 '/devices/diskb1',
  9 '/devices/diskb2',
10 '/devices/diskb3',
11 '/devices/diskb4';


添加磁盘组

Adding Disks to a Disk Group: Example 1 The following statement adds disks to dgroup1:

ALTER DISKGROUP dgroup1 ADD DISK
     '/devices/diska5' NAME diska5,
     '/devices/diska6' NAME diska6;

Because no FAILGROUP clauses are included in the ALTER DISKGROUP statement, each disk is assigned to its own failure group. The NAME clauses assign names to the disks, otherwise they would have been assigned system-generated names.


删除磁盘组

Dropping Disks from Disk Groups: Example 1 This example drops diska5 (the operating system independent name assigned to /devices/diska5 in "Adding Disks to a Disk Group: Example 1") from disk group dgroup1.

ALTER DISKGROUP dgroup1 DROP DISK diska5;

Dropping Disks from Disk Groups: Example 2 This example drops diska5 from disk group dgroup1, and also illustrates how multiple actions are possible with one ALTER DISKGROUP statement.

alter diskgroup dgroup1 drop disk diska5 add failgroup failgrp1 disk '/devices/diska9' name diska9;    

手工平衡一个磁盘组

Manually Rebalancing a Disk Group: Example The following example manually rebalances the disk group dgroup2. The command does not return until the rebalance operation is complete.

alter diskgroup dgroup2 rebalance power 5 wait;

挂载和卸载磁盘组

ALTER DISKGROUP dgroup1 MOUNT;

ALTER DISKGROUP ALL DISMOUNT;

检查磁盘组元数据的内部一致性

ALTER DISKGROUP dgroup1 CHECK ALL;

删除磁盘组

如果要删除磁盘组中包含的所有数据文件,你可以指定including contents,默认的是excluding contents.

DROP DISKGROUP dgroup1;

管理磁盘组中的目录

example of a system-generated filename:

+dgroup2/sample/controlfile/Current.256.541956473

The plus sign represents the root of the ASM file system. The dgroup2 directory is the parent directory for all files in the dgroup2 disk group. The sample directory is the parent directory for all files in the sample database, and the controlfile directory contains all control files for the sample database.

创建目录

Creating a New Directory: Example 1 The following statement creates a hierarchical directory for disk group dgroup1, which can contain, for example, the alias name +dgroup1/mydir/control_file1:

ALTER DISKGROUP dgroup1 ADD DIRECTORY '+dgroup1/mydir'; 

Creating a New Directory: Example 2 Assuming no subdirectory exists under the directory +dgoup1/mydir, the following statement fails:

ALTER DISKGROUP dgroup1
     ADD DIRECTORY '+dgroup1/mydir/first_dir/second_dir';
重命名目录
系统命名的目录不能重命名

Renaming a Directory: Example The following statement renames a directory:

ALTER DISKGROUP dgroup1 RENAME DIRECTORY '+dgroup1/mydir'
     TO '+dgroup1/yourdir'
管理别名
v$asm_alias视图提供了asm实例中的每个别名

Adding an Alias Name for an ASM Filename: Example 1 The following statement adds a new alias name for a system-generated file name:

ALTER DISKGROUP dgroup1 ADD ALIAS '+dgroup1/mydir/second.dbf'
     FOR '+dgroup1/sample/datafile/mytable.342.3';
重命名别名

Renaming an Alias Name for an ASM Filename: Example The following statement renames an alias:

ALTER DISKGROUP dgroup1 RENAME ALIAS '+dgroup1/mydir/datafile.dbf'
     TO '+dgroup1/payroll/compensation.dbf';
删除别名
ALTER DISKGROUP dgroup1 DROP ALIAS '+dgroup1/payroll/compensation.dbf';
删除文件及相关的别名
Dropping Files and Associated Aliases from a Disk Group: Example 1
The following statement uses the alias name for the file to delete both the file and the alias:
ALTER DISKGROUP dgroup1 DROP FILE '+dgroup1/payroll/compensation.dbf';
Dropping Files and Associated Aliases from a Disk Group: Example 2
In this example the system-generated filename is used to drop the file and any associated alias:
ALTER DISKGROUP dgroup1
     DROP FILE '+dgroup1/sample/datafile/mytable.342.372642';
 管理模板
当磁盘组被创建了,asm为磁盘组创建一些默认的模板,对每种类型的文件都有模板。v$asm_template视图提供了asm中的所有模板。
模板属性

Table 12-3 Permitted Values for ASM Template Striping Attribute

Striping Attribute ValueDescription
FINEStriping in 128KB chunks.
COARSEStriping in 1MB chunks.

Table 12-4 Permitted Values for ASM Template Redundancy Attribute

Redundancy Attribute ValueResulting Mirroring in Normal Redundancy Disk GroupResulting Mirroring in High Redundancy Disk GroupResulting Mirroring in External Redundancy Disk Group
MIRROR2-way mirroring3-way mirroring(Not allowed)
HIGH3-way mirroring3-way mirroring(Not allowed)
UNPROTECTEDNo mirroring(Not allowed)No mirroring

Table 12-5 ASM System Default Templates Attribute Settings

Template NameStripingMirroring, Normal Redundancy Disk GroupMirroring, High Redundancy Disk GroupMirroring, External Redundancy Disk Group
CONTROLFILEFINEHIGHHIGHUNPROTECTED
DATAFILECOARSEMIRRORHIGHUNPROTECTED
ONLINELOGFINEMIRRORHIGHUNPROTECTED
ARCHIVELOGCOARSEMIRRORHIGHUNPROTECTED
TEMPFILECOARSEMIRRORHIGHUNPROTECTED
BACKUPSETCOARSEMIRRORHIGHUNPROTECTED
PARAMETERFILECOARSEMIRRORHIGHUNPROTECTED
DATAGUARDCONFIGCOARSEMIRRORHIGHUNPROTECTED
FLASHBACKFINEMIRRORHIGHUNPROTECTED
CHANGETRACKINGCOARSEMIRRORHIGHUNPROTECTED
DUMPSETCOARSEMIRRORHIGHUNPROTECTED
XTRANSPORTCOARSEMIRRORHIGHUNPROTECTED
AUTOBACKUPCOARSEMIRRORHIGHUNPROTECTED
想磁盘组中添加模板
ALTER DISKGROUP disk_group_name ADD TEMPLATE template_name ATTRIBUTES ([{MIRROR|HIGH|UNPROTECTED}] [{FINE|COARSE}]);

Adding Templates to a Disk Group: Example 1 The following statement creates a new template named reliable for the normal redundancy disk group dgroup2:

ALTER DISKGROUP dgroup2 ADD TEMPLATE reliable ATTRIBUTES (HIGH FINE);

Adding Templates to a Disk Group: Example 2 This statement creates a new template named unreliable that specifies files are to be unprotected (no mirroring). (Oracle discourages the use of unprotected files unless hardware mirroring is in place; this example is presented only to further illustrate how the attributes for templates are set.)

ALTER DISKGROUP dgroup2 ADD TEMPLATE unreliable ATTRIBUTES (UNPROTECTED);
修改磁盘组模板

Modifying a Disk Group Template: Example The following example changes the striping attribute specification of the reliable template for disk group dgroup2.

ALTER DISKGROUP dgroup2 ALTER TEMPLATE reliable 
     ATTRIBUTES (COARSE);
删除磁盘模板

Dropping Templates from a Disk Group: Example This example drops the previously created template unreliable from dgroup2:

ALTER DISKGROUP dgroup2 DROP TEMPLATE unreliable;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值