//
you're reading...
Oracle ASM

Oracle Automatic Storage Management – Overview

ASM(Automatic Storage Management) is a main push storage solution from Oracle, ASM and RDBMS are very similar, ASM is the instance and files can also be maintained through sqlplus tool.

DBAs can create and delete ASM instances through DBCA. Also they can use grid command to finish the same tasks. ASM instance requires CSS process, if a non-RAC environment, before starting the ASM instance will be prompted with a script.

1.The SGA of the ASM instance and background processes

The SGA of the ASM instance includes Buffer Cache, Share Pool, Large Pool and so on. Note that the Share Pool, because Extent Map to put this part of the memory, the more the amount of data required to estimate the size of the Extent Map adjusted accordingly.

Extent Map file size can be the basis of all sizes and to estimate, using the following statement to calculate all the files and:

select sum(bytes)/(1024 * 1024 * 1024) from v$datafile;
select sum(bytes)/(1024 * 1024 * 1024) from v$logfile a, v$log b where a.Group# = b.Group#;
select sum(bytes)/(1024 * 1024 * 1024) from v$tempfile where status = 'ONLINE';

The sum of these three sum corresponds to the total size of the database of all files stored in ASM, for use External Redundancy disk groups need to 1MB per 100G Extent Map, calculated according to the proportion Extent Map needed space, plus an additional 2MB on it. In practice generally do not consider ASM SGA configuration, use the default values provided by Oracle on it.

    • ASM background processes

ASM instance has two more processes: RBAL and ABRn compare to RDBMS instance.

RBAL: This process is also called Rebalancer process, responsible for planning activities Reblance ASM disk group.
ABRn: RBAL child process is the process, this process can have multiple in number, n from 1 to 9, which is responsible for the group process actually complete Reblance activities.

The RDBMS using ASM instance also have two more processes: RBAL and ASMB.
RBAL: The main function of this process is to open the Rebalance all disks per disk and data.

ASMB: this process as an information channel between the ASM instance and database instance. This process is responsible for communication with the ASM instance, use it to manage the ASM instance Diskgroup Name obtain the Diskgroup the connection string from the CSS, and then create a persistent connection to ASM, regular exchange of information through this connection between the two instances, but also one kind of the heartbeat mechanism.

RDBMS instance To use ASM as the storage, RDBMS instance must obtain Extent Map from ASM instance at startup, after the occurrence of maintaining disk group operation, ASM instance but also to inform the update information Extent Map to the RDBMS instance, between these two instances The exchange of information is that he just passed you, oh ASMB process completed. This also Why: ASM instance must first start the database instance, and database instance synchronous operation, later closed in the database instance.

2.ASM Configuration

ASM can use raw device or ASMLib way because bare set up other maintenance is more complex, in this way only explain ASMLib.

Corresponding to different operating systems require different packages download time and the operating system kernel must be consistent. My operating system is CENTOS 4 with UPDATE 7. kernel version is 2.6.9-78.ELSMP.

  • oracleasmlib-2.0.4-1.el4.i386.rpm
  • oracleasm-support-2.1.3-1.el4.i386.rpm
  • oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm

http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html

Configured after installation:

# /etc/init.d/oracleasm configure

Corresponding to the default user, the default group, with the system from the start, set permissions at startup.

/etc/init.d/oracleasm createdisk TESTDB_DISK01 /dev/sdc1
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks


For more usage oracleasm reference help:


[root@testdbnode01 ~] # /etc/init.d/oracleasm --help
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}

3.ASM instance configuration

3.1 initialization parameters


[oracle@testdbnode01 bin] $ export ORACLE_SID=+ASM

oracle@testdbnode01:~> sqlplus / as sysasm

SQL*Plus: Release 11.2.0.3.0 Production on Wed Sep 30 10:27:28 2015

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Real Application Clusters and Automatic Storage Management options

SQL> create pfile from spfile;

File created.

SQL> show parameter asm

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups                       string      TESTDBDATA, TESTDBFRA
asm_diskstring                       string      /dev/oracleasm/*
asm_power_limit                      integer     1
asm_preferred_read_failure_groups    string

[oracle@testdbnode01 dbs] $ pwd
/oragi/app/11.2.0.3/grid/dbs

[Oracle@testdbnode01 dbs] $ ls

ab_+ASM2.dat hc_rac2.dat initrac2.ora orapwrac2
hc_+ASM2.dat init + ASM2.ora orapw + ASM2

[oracle@testdbnode01 dbs] $ more init+ASM1.ora

+ASM2.asm_diskgroups = 'TESTDBDATA', 'TESTDBFRA'
+ASM1.asm_diskgroups = 'TESTDBDATA', 'TESTDBFRA'
*.asm_diskgroups = 'TESTDBDATA', 'TESTDBFRA'
*.background_dump_dest = '/ora01/app/oracle/admin/+ASM/bdump'
*.cluster_database = True
*.core_dump_dest = '/ora01/app/oracle/admin/+ASM/cdump'
+ ASM2.instance_number = 2
+ ASM1.instance_number = 1
*.instance_type = 'asm'
*.large_pool_size = 12M
*.remote_login_passwordfile = 'exclusive'
*.user_dump_dest = '/ora01/app/oracle/admin/+ASM/udump'

SGA requires very little memory ASM instance, the general default value, without modification. Default ASM SGA are as follows:

SHARED_POOL_SIZE = 48M
LARGE_POOL_SIZE = 12M
SHARED_POOL_RESERVED_SIZE = 24M
SGA_MAX_SIZE = 88M
These defaults can be in sqlplus show parameter view.

Instance_type: For ASM instance, this should be set to ASM, if a database instance, is RDBMS.

DB_UNIQUE_NAME: This parameter can use the default values +ASM
SQL> show parameter asm_power_limit

NAME                    TYPE      VALUE
----------------------- --------- ---------------
asm_power_limit         integer   1

ASM_POWER_LIMIT: When adding removing a disk in the disk group, the disk group will automatically redistribute data between the old and new disks to achieve decentralized IO, this process is called rebalancing (Rebalance);

This action will move data between disks, so although the online operation, will still affect part of the performance, so you want to be when the system is idle. This parameter controls Rebalance speed, ranging from 0-11 minimum value 0 represents not Rebalance, the maximum value of 11 represents the fastest, but also means seriously affect the performance, 1 represents the slowest speed and minimal performance impact. In addition to defining the parameters in the initialization parameters can also be specified at the time of the operation.

For example:

SQL> alter diskgroup TESTDBDATA rebalance power 5;

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.

ASM_DISKSTRING: define which disks can be used by ASM, ASM disk found based on the value of this parameter scanning ASM instance starts, the configuration of this parameter later, you must confirm the ORACLE user has permission to operate these disks

1. If you use raw devices, each device names separated by commas:

asm_diskstring='/dev/oracleasm/TESTDBDATA_DISK01', '/dev/oracleasm//TESTDBFRA_DISK01'

2. If you use ASMLib, you need to use “ORCL: Disk Name”

asm_diskstring='ORCL:VOL1'

3. When using ASMLib, you can use wildcards

asm_diskstring='/dev/oracleasm/*'

ASM_DISKGROUPS: This parameter defines the ASM instance starts automatically mounted after the disk groups, if not automatically mount, you can use the command to mount.

Note: ASM instance starts, by pfile, can also spfile, if you start using spfile, so if you create a new disk group, this parameter is automatically modified, it will automatically mount the new disk group next start, if is using pfile, this argument does not automatically update, you need to manually update.

3.2 CSS process
Whether in the RAC environment, ASM instance is required CSS process, so if non-RAC environment before, start ASM instance with the script

$ORACLE_HOME/bin/localconfig add start CSS, otherwise it will report ORA-29701 when the ASM instance starts: unable to connect to Cluster Manager, and prompt implementation of the script

3.3 ASM instance related operations

ASM management logon, startup, shutdown:

[Oracle@testdbnode2 dbs] $ export ORACLE_SID=+ASM2
[Oracle@testdbnode2 dbs] $ sqlplus / as sysasm
SQL> startup
SQL> shutdown immediate;

Check the disk group information SQL:

SQL> col state format a20
SQL> col name format a20
SQL> set line 200

SQL> select STATE, REDUNDANCY, TOTAL_MB, FREE_MB, NAME, FAILGROUP from v$asm_disk;

SQL> select GROUP_NUMBER, NAME, STATE, TYPE, TOTAL_MB, FREE_MB, UNBALANCED from v$asm_diskgroup;

--Create a new ASM diskgroup
SQL> create diskgroup dgtest normal redundancy failgroup DATA1 disk '/ dev / oracleasm / VOL5' name DATA1 failgroup DATA2 disk '/ dev / oracleasm / VOL6' name DATA2;

--Remove diskgroup
SQL> drop diskgroup DATA including contents;

-- For diskgroup multi-junction point, only after a mount asm instance can be dorp, other nodes must dismount.


--Manually mount command

ALTER DISKGROUP ALL DISMOUNT;
ALTER DISKGROUP ALL MOUNT;
ALTER DISKGROUP DATA DISMOUNT;
ALTER DISKGROUP DATA MOUNT;


--To increase disk diskgroup
SQL> alter diskgroup DATA add disk '/dev/oracleasm/TESTDBDATA_DISK02' name TESTDBDATA_DISK02, '/dev/oracleasm/TESTDBFRA_DISK02' name TESTDBFRA_DISK02;


--Remove from diskgroup disk
SQL> alter diskgroup DATA drop disk VOL5;


--Undelete disk commands, only valid at the time of completion of the above command is not executed

ALTER DISKGROUP DATA UNDROP DISKS;

--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.

 
--Data file management

--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 TESTDBDATA ADD ALIAS '+TESTDBDATA/testdb/testdb_datafile01.dbf' FOR '+TESTDB/testdb/datafile/testdb_file.372.352';


-- Create an alias using the numeric form filename
ALTER DISKGROUP TESTDBDATA ADD ALIAS '+TESTDBDATA/testdb/my_file.dbf' FOR '+TESTDBDATA.342.3';

 
-- Rename an alias
ALTER DISKGROUP TESTDBDATA RENAME ALIAS '+TESTDBDATA/testdb/my_file.dbf' TO '+TESTDBDATA/testdb/my_file2.dbf';

 
-- Delete an alias
ALTER DISKGROUP TESTDBDATA DELETE ALIAS '+TESTDBDATA/testdb/my_file.dbf';

 
-- Drop file using an alias
ALTER DISKGROUP TESTDBDATA DROP FILE '+TESTDBDATA/testdb/my_file.dbf';

 
-- Drop file using a numeric form filename.
ALTER DISKGROUP TESTDBDATA DROP FILE '+TESTDBDATA.342.3';


-- Drop file using a fully qualified filename.
ALTER DISKGROUP TESTDBDATA DROP FILE '+TESTDBDATA/testdb/datafile/my_ts.342.3';


-- Create datafile
SQL> create tablespace users2 datafile '+TESTDB_DATA' size 1024m;

–Precautions:

–1. ASM instance configured and created after ASM disk group, we must also ensure Listener after already registered in the database instance to use, otherwise you will need to manually register the ASM instance:

SQL> alter system register;

–2. Once the database instance using ASM as storage, then the database instance is running can not be shut down ASM instances. Otherwise it will report ORA-15097:. Can not SHUTDOWN ASM instance with connected RDBMS instance error.

4.How to delete a ASM instance

To remove Automatic Storage Management instance, we  must complete the following steps:

4.1 At the command prompt, set the environment variable oracle_sid +ASM instance:

# Export oracle_sid = +ASM

4.2 Connect to the ASM instance through user sysman:

# sqlplus / as sysman

4.3 Use the following command to determine if the database instance is using Automatic Storage Management instance +ASM:

SQL> select instance_name from v$asm_client;

The results of the command lists all running and using the +ASM instance database instance. As long as the +ASM instance that contains the database is still connected, you can not remove the +ASM instance.

4.4 Drop the associated disk group.

--First, the recognition associated with + ASM disk group:
SQL> select name from v$asm_diskgroup;

--Secondly, use the following command to remove each disk group to be deleted:
SQL> drop diskgroup <disk_group_name> including contents;

4.5 Close +ASM instance and exit SQLPlus:

SQL> shutdown
SQL> exit

4.6 Enter the following commands at the command prompt, remove the + ASM service

oradim -delete -asmsid +ASM
Advertisements

About daviewning

I am an Oracle DBA

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: