asm in oracle 10g-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 3977062
  • 博文数量: 536
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4825
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(536)

文章存档

2024年(3)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: oracle

2009-09-22 13:38:21

automatic storage management (asm) is a new feature that has be introduced in oracle 10g to simplify the storage of oracle datafiles, controlfiles and logfiles.
  • overview of automatic storage management (asm)
  • initialization parameters and asm instance creation
  • startup and shutdown of asm instances
  • administering asm disk groups
    • disks
    • templates
    • directories
    • aliases
    • files
    • checking metadata
  • asm filenames
  • asm views
  • sql and asm
  • migrating to asm using rman

overview of automatic storage management (asm)

automatic storage management (asm) simplifies administration of oracle related files by allowing the administrator to reference disk groups rather than individual disks and files, which are managed by asm. the asm functionality is an extention of the oracle managed files (omf) functionality that also includes striping and mirroring to provide balanced and secure storage. the new asm functionality can be used in combination with existing raw and cooked file systems, along with omf and manually managed files.

the asm functionality is controlled by an asm instance. this is not a full database instance, just the memory structures and as such is very small and lightweight.

the main components of asm are disk groups, each of which comprise of several physical disks that are controlled as a single unit. the physical disks are known as asm disks, while the files that reside on the disks are know as asm files. the locations and names for the files are controlled by asm, but user-friendly aliases and directory structures can be defined for ease of reference.

the level of redundancy and the granularity of the striping can be controlled using templates. default templates are provided for each file type stored by asm, but additional templates can be defined as needed.

failure groups are defined within a disk group to support the required level of redundancy. for two-way mirroring you would expect a disk group to contain two failure groups so individual files are written to two locations.

in summary asm provides the following functionality:
  • manages groups of disks, called disk groups.
  • manages disk redundancy within a disk group.
  • provides near-optimal i/o balancing without any manual tuning.
  • enables management of database objects without specifying mount points and filenames.
  • supports large files.

initialization parameters and asm instance creation

the initialization parameters that are of specific interest for an asm instance are:
  • instance_type - set to asm or rdbms depending on the instance type. the default is rdbms.
  • db_unique_name - specifies a globally unique name for the database. this defaults to asm but must be altered if you intend to run multiple asm instances.
  • asm_power_limit -the maximum power for a rebalancing operation on an asm instance. the valid values range from 1 to 11, with 1 being the default. the higher the limit the more resources are allocated resulting in faster rebalancing operations. this value is also used as the default when the power clause is omitted from a rebalance operation.
  • asm_diskgroups - the list of disk groups that should be mounted by an asm instance during instance startup, or by the alter diskgroup all mount statement. asm configuration changes are automatically reflected in this parameter.
  • asm_diskstring - specifies a value that can be used to limit the disks considered for discovery. altering the default value may improve the speed of disk group mount time and the speed of adding a disk to a disk group. changing the parameter to a value which prevents the discovery of already mounted disks results in an error. the default value is null allowing all suitable disks to be considered.
incorrect usage of parameters in asm or rdbms instances result in ora-15021 errors.

to create an asm instance first create a file called init asm.ora in the /tmp directory containing the following information.
instance_type=asm
next, using sql*plus connect to the ide instance.
export oracle_sid= asm
sqlplus / as sysdba
create an spfile using the contents of the init asm.ora file.
sql> create spfile from pfile='/tmp/init asm.ora';

file created.
finally, start the instance with the nomount option.
sql> startup nomount
asm instance started

total system global area 125829120 bytes
fixed size 1301456 bytes
variable size 124527664 bytes
database buffers 0 bytes
redo buffers 0 bytes
sql>
the asm instance is now ready to use for creating and mounting disk groups. to shutdown the asm instance issue the following command.
sql> shutdown
asm instance shutdown
sql>
once an asm instance is present disk groups can be used for the following parameters in database instances (instance_type=rdbms) to allow asm file creation:
  • db_create_file_dest
  • db_create_online_log_dest_n
  • db_recovery_file_dest
  • control_files
  • log_archive_dest_n
  • log_archive_dest
  • standby_archive_dest

startup and shutdown of asm instances

asm instance are started and stopped in a similar way to normal database instances. the options for the startup command are:
  • force - performs a shutdown abort before restarting the asm instance.
  • mount - starts the asm instance and mounts the disk groups specified by the asm_diskgroups parameter.
  • nomount - starts the asm instance without mounting any disk groups.
  • open - this is not a valid option for an asm instance.
the options for the shutdown command are:
  • normal - the asm instance waits for all connected asm instances and sql sessions to exit then shuts down.
  • immediate - the asm instance waits for any sql transactions to complete then shuts down. it doesn't wait for sessions to exit.
  • transactional - same as immediate.
  • abort - the asm instance shuts down instantly.

administering asm disk groups

disks

disk groups are created using the create diskgroup statement. this statement allows you to specify the level of redundancy:
  • normal redundancy - two-way mirroring, requiring two failure groups.
  • high redundancy - three-way mirroring, requiring three failure groups.
  • external redundancy - no mirroring for disks that are already protected using hardware mirroring or raid.
in addition failure groups and preferred names for disks can be defined. if the name clause is omitted the disks are given a system generated name like "disk_group_1_0001". the force option can be used to move a disk from another disk group into this one.
create diskgroup disk_group_1 normal redundancy
failgroup failure_group_1 disk
'/devices/diska1' name diska1,
'/devices/diska2' name diska2,
failgroup failure_group_2 disk
'/devices/diskb1' name diskb1,
'/devices/diskb2' name diskb2;
disk groups can be deleted using the drop diskgroup statement.
drop diskgroup disk_group_1 including contents;
disks can be added or removed from disk groups using the alter diskgroup statement. remember that the wildcard "*" can be used to reference disks so long as the resulting string does not match a disk already used by an existing disk group.
-- add disks.
alter diskgroup disk_group_1 add disk
'/devices/disk*3',
'/devices/disk*4';

-- drop a disk.
alter diskgroup disk_group_1 drop disk diska2;
disks can be resized using the resize clause of the alter diskgroup statement. the statement can be used to resize individual disks, all disks in a failure group or all disks in the disk group. if the size clause is omitted the disks are resized to the size of the disk returned by the os.
-- resize a specific disk.
alter diskgroup disk_group_1
resize disk diska1 size 100g;

-- resize all disks in a failure group.
alter diskgroup disk_group_1
resize disks in failgroup failure_group_1 size 100g;

-- resize all disks in a disk group.
alter diskgroup disk_group_1
resize all size 100g;
the undrop disks clause of the alter diskgroup statement allows pending disk drops to be undone. it will not revert drops that have completed, or disk drops associated with the dropping of a disk group.
alter diskgroup disk_group_1 undrop disks;
disk groups can be rebalanced manually using the rebalance clause of the alter diskgroup statement.if the power clause is omitted the asm_power_limit parameter value is used. rebalancing is only needed when the speed of the automatic rebalancing is not appropriate.
alter diskgroup disk_group_1 rebalance power 5;
disk groups are mounted at asm instance startup and unmounted at asm instance shutdown. manual mounting and dismounting can be accomplished using the alter diskgroup statement as seen below.
alter diskgroup all dismount;
alter diskgroup all mount;
alter diskgroup disk_group_1 dismount;
alter diskgroup disk_group_1 mount;

templates

templates are named groups of attributes that can be applied to the files within a disk group. the following example show how templates can be created, altered and dropped.
-- create a new template.
alter diskgroup disk_group_1 add template my_template attributes (mirror fine);

-- modify template.
alter diskgroup disk_group_1 alter template my_template attributes (coarse);

-- drop template.
alter diskgroup disk_group_1 drop template my_template;
available attributes include:
  • unprotected - no mirroring or striping regardless of the redundancy setting.
  • mirror - two-way mirroring for normal redundancy and three-way mirroring for high redundancy. this attribute cannot be set for external redundancy.
  • coarse - specifies lower granuality for striping. this attribute cannot be set for external redundancy.
  • fine - specifies higher granularity for striping. this attribute cannot be set for external redundancy.

directories

a directory heirarchy can be defined using the alter diskgroup statement to support asm file aliasing. the following examples show how asm directories can be created, modified and deleted.
-- create a directory.
alter diskgroup disk_group_1 add directory ' disk_group_1/my_dir';

-- rename a directory.
alter diskgroup disk_group_1 rename directory ' disk_group_1/my_dir' to ' disk_group_1/my_dir_2';

-- delete a directory and all its contents.
alter diskgroup disk_group_1 drop directory ' disk_group_1/my_dir_2' force;

aliases

aliases allow you to reference asm files using user-friendly names, rather than the fully qualified asm filenames.
-- create an alias using the fully qualified filename.
alter diskgroup disk_group_1 add alias ' disk_group_1/my_dir/my_file.dbf'
for ' disk_group_1/mydb/datafile/my_ts.342.3';

-- create an alias using the numeric form filename.
alter diskgroup disk_group_1 add alias ' disk_group_1/my_dir/my_file.dbf'
for ' disk_group_1.342.3';

-- rename an alias.
alter diskgroup disk_group_1 rename alias ' disk_group_1/my_dir/my_file.dbf'
to ' disk_group_1/my_dir/my_file2.dbf';

-- delete an alias.
alter diskgroup disk_group_1 delete alias ' disk_group_1/my_dir/my_file.dbf';
attempting to drop a system alias results in an error.

files

files are not deleted automatically if they are created using aliases, as they are not oracle managed files (omf), or if a recovery is done to a point-in-time before the file was created. for these circumstances it is necessary to manually delete the files, as shown below.
-- drop file using an alias.
alter diskgroup disk_group_1 drop file ' disk_group_1/my_dir/my_file.dbf';

-- drop file using a numeric form filename.
alter diskgroup disk_group_1 drop file ' disk_group_1.342.3';

-- drop file using a fully qualified filename.
alter diskgroup disk_group_1 drop file ' disk_group_1/mydb/datafile/my_ts.342.3';

checking metadata

the internal consistency of disk group metadata can be checked in a number of ways using the check clause of the alter diskgroup statement.
-- check metadata for a specific file.
alter diskgroup disk_group_1 check file ' disk_group_1/my_dir/my_file.dbf'

-- check metadata for a specific failure group in the disk group.
alter diskgroup disk_group_1 check failgroup failure_group_1;
-- check metadata for a specific disk in the disk group. alter diskgroup disk_group_1 check disk diska1; -- check metadata for all disks in the disk group. alter diskgroup disk_group_1 check all;

asm views

the asm configuration can be viewed using the v$asm_% views, which often contain different information depending on whether they are queried from the asm instance, or a dependant database instance.

view asm instance db instance
v$asm_alias displays a row for each alias present in every disk group mounted by the asm instance. returns no rows
v$asm_client displays a row for each database instance using a disk group managed by the asm instance. displays a row for the asm instance if the database has open asm files.
v$asm_disk displays a row for each disk discovered by the asm instance, including disks which are not part of any disk group. displays a row for each disk in disk groups in use by the database instance.
v$asm_diskgroup displays a row for each disk group discovered by the asm instance. displays a row for each disk group mounted by the local asm instance.
v$asm_file displays a row for each file for each disk group mounted by the asm instance. displays no rows.
v$asm_operation displays a row for each file for each long running operation executing in the asm instance. displays no rows.
v$asm_template displays a row for each template present in each disk group mounted by the asm instance. displays a row for each template present in each disk group mounted by the asm instance with which the database instance communicates.

asm filenames

there are several ways to reference asm file. some forms are used during creation and some for referencing asm files. the forms for file creation are incomplete, relying on asm to create the fully qualified name, which can be retrieved from the supporting views. the forms of the asm filenames are summarised below.

filename type format
fully qualified asm filename dgroup/dbname/file_type/file_type_tag.file.incarnation
numeric asm filename dgroup.file.incarnation
alias asm filenames dgroup/directory/filename
alias asm filename with template dgroup(template)/alias
incomplete asm filename dgroup
incomplete asm filename with template dgroup(template)

sql and asm

asm filenames can be used in place of conventional filenames for most oracle file types, including controlfiles, datafiles, logfiles etc. for example, the following command creates a new tablespace with a datafile in the disk_group_1 disk group.
create tablespace my_ts datafile ' disk_group_1' size 100m autoextend on;

migrating to asm using rman

the following method shows how a primary database can be migrated to asm from a disk based backup:
  • disable change tracking (only available in enterprise edition) if it is currently being used.
    sql> alter database disable block change tracking;
  • shutdown the database.
    sql> shutdown immediate
  • modify the parameter file of the target database as follows:
    • set the db_create_file_dest and db_create_online_log_dest_n parameters to the relevant asm disk groups.
    • remove the control_files parameter from the spfile so the control files will be moved to the db_create_* destination and the spfile gets updated automatically. if you are using a pfile the control_files parameter must be set to the appropriate asm files or aliases.

  • start the database in nomount mode.
    rman> startup nomount
  • restore the controlfile into the new location from the old location.
    rman> restore controlfile from 'old_control_file_name';
  • mount the database.
    rman> alter database mount;
  • copy the database into the asm disk group.
    rman> backup as copy database format ' disk_group';
  • switch all datafile to the new asm location.
    rman> switch database to copy;
  • open the database.
    rman> alter database open;
  • create new redo logs in asm and delete the old ones.

  • enable change tracking if it was being used.
    sql> alter database enable block change tracking;
form more information see:
    阅读(2550) | 评论(1) | 转发(0) |
    给主人留下些什么吧!~~

    chinaunix网友2009-10-12 14:57:03

      10.使用好在页头中的标签,这个挺有效果。也是最重要的。 本人作品,大家可以给点建议。 1. 公司注册网 http://www.51zhuce.net 2.上海公司注册网 http://www.51gongsizhuce.com/ 3.外资公司注册网 http://www.zhucewaizi.com 4.代表处注册网 http://www.shdbc.com 5.上海企业注册网 http://www.shanghaizhuce.com

    |
    ")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
    网站地图