Wednesday, November 25, 2009

ASMCMD

In this post I will provide you with some commonly used ASM commands and how to use it to perform some day to day activities.

Before invoking the ASM command, set the following environmental variables,

$ Export ORACLE_SID=+ASM1
$ Export ORACLE_HOME=/oracle/app/oracle/product/10.2.0.1/db_1

To invoke the ASMCMD

$ asmcmd –p
If the –p option is used, it displays the path in the prompt.



To navigate the directories (same as in Unix) case insensitive



To Create a File alias

$ asmcmd
ASMCMD> cd asmdb/gcprod/datafile
ASMCMD> mkalias +asmdb/gcprod/datafile/USERS.259.661355087 users_01.dbf

To remove a file alias

ASMCMD> rmalias +asmdb/gcprod/datafile/users_01.dbf

To check space usage

du – displays disk usage in MB. Similar to du command in unix.



lsdg – lists the disk group usage.



To find the RDBMS instances connected to ASM
lsct – lists the ASM Client information



To create and delete directories and files

ASMCMD> mkdir dummydir
ASMCMD> rm dummydir
ASMCMD> rm +asmdb/gcprod/datafile/USERS.259.661355087

Note: The file must be closed before deleting it otherwise the rm command will throw error.

Searching through the ASM directories



Thanks

Top Blogs

Friday, November 6, 2009

ASMLIB

ASMLIB is a storage management interface. ASMLIB is not required for ASM to function; it is an add-on library that simplifies the tasks of managing and discovering the disks.

Function of ASMLIB

Disk Discovery: It provides more information about the disk attributes enabling easy discovery of disks. Avoids disks being added to one node and not been discovered by other nodes in the cluster.

IO Processing: Enables more efficient IO.

Thanks

ASM Rebalance

The Rebalance operation provides an even distribution of file extents across all disks in the diskgroup. The rebalance is done on each file to ensure balanced I/O load.

The RBAL background process manages the rebalance activity. It examines the extent map for each file and redistributes the extents to new storage configuration. The RBAL process will calculate estimation time and the work required to perform the rebalance activity and then message the ARBx processes to actually perform the task. The number of ARBx process starts is determined by the parameter ASM_POWER_LIMIT.

There will be one I/O for each ARBx process at a time. Hence the impact of physical movement of file extents will be low. The asm_power_limit parameter determines the speed of the rebalance activity. It can have values between 0 and 11. If the value is 0 no rebalance occurs. If the value is 11 the rebalance takes place at full speed. The power value can also be set for specific rebalance activity using Alter Diskgroup statement.

The rebalance operation has various states, they are

WAIT: No operations are running for the group.
RUN: A rebalance operation is running for the group.
HALT: The DBA has halted the operation.
ERROR: The operation has halted due to errors.

You can query the V$ASM_OPERATION to view the status of rebalance activity.

The rebalance activity is an asynchronous operation, i.e., the operation runs in the background while the users can perform other tasks. In certain situation you need the rebalance activity to finish successfully before performing the other tasks. To make the operation synchronous you add a keyword WAIT while performing the rebalance as shown below.

SQL> Alter diskgroup ASMDB Add Disk ‘/dev/sdc4’ Rebalance power 4 WAIT;

The above statement will not return the control to the user unless the rebalance operation ends.

Thanks

Top Blogs

Wednesday, November 4, 2009

ASM redundancy and Failure Groups

A Failure group is a collection of disks that can become unavailable due to failure of one of its associated components (controllers, HBAs, Fiber channel switches, Disks, Entire arrays etc).

A diskgroup is divided in to failure groups. Each disks in the diskgroup is part of one failure group. The disks in different failure groups does not share the same failure component (HBAs, controllers etc).

ASM uses Mirroring for redundancy. Three types of redundancy are supported by ASM. They are,

Normal Redundancy: 2-way mirrored. At least two failure groups are needed.
High Redundancy: 3-way mirrored. At least three failure groups are needed.
External Redundancy: No ASM mirroring. 3rd party redundancy mechanism like RAID is used.

After creating a diskgroup you cannot change the redundancy level. If you want to change it then create a separate diskgroup and move the files to that diskgroup (using RMAN restore or DBMS_FILE_TRANSFER).

ASM mirrors extents instead of disks. The first copy of the extent is called the primary extent and its mirrored extent is called secondary extent. For high redundancy there are two secondary extents. The primary and secondary extents together are known as extent set. An extent set always contains same data. For read/write operations, each extent in an extent set is written in parallel and only primary extent is read.

Note: Disk group meta data is always triple mirrored with normal or high redundancy.

Thanks

Top Blogs

Tuesday, November 3, 2009

ASM Templates

A template is a collection of file attributes that are applied to the ASM files. It is associated with a Disk Group. Whenever a file is created the file attributes specific to the template are applied to the files. For eg., if we want to create a users tablespace that contains data file we use the DATAFILE template.

Default Template: When you create a disk group, Oracle creates system default template for the disk group. It includes default attributes for various file types like control files or data files. The DBA can mention whether the files created via the template should be 2-way or 3-way mirrored and Coarse or fine striped.

Default templates and their attributes.

Ref: http://www.dbasupport.com/oracle/ora10g/ASM0301.shtml

Some of the attributes of default templates can be modified, but cannot be deleted. The redundancy and striping cannot be modified. You can also create user defined templates.

The drawback of ASM file templates is if you want to modify any of the file attributes after it is created, then you must use RMAN to copy the file to a new file with new settings.

To view the ASM template details use the following query.

SQL> Select * From V$ASM_TEMPLATE;

Thanks

Top Blogs

ASM Files

ASM Files are named using OFA standard and employs OMF for managing files for example when you drop a tablespace ASM will automatically deletes the files associated with the tablespace. Also I need not specify a file name while creating a data file, ASM will automatically assign a unique name.

A typical ASM file looks like this
+ASMDB/gcprod/datafile/users.259.661355087

The ASM file has 5 components, they are

ASM Disk Group : +ASMDB
Database name : gcprod
File type : datafile
Tag : Specific information about the file. In this case it is the tablespace name, users
file.incarnation : A number pair that insure uniqueness

ASM File Alias

Alias are used to represent the files using user friendly names.

To create an alias

SQL> Alter Diskgroup ASMDB add alias '+ASMDB/gcprod/datafile/users1.dbf' for '+ASMDB/gcprod/datafile/users.259.661355087' ;

Instead of using full name you can also use only the disk group name and the numeric identifier as shown below,

SQL> Alter Diskgroup ASMDB add alias '+ASMDB/gcprod/datafile/users1.dbf' for '+ASMDB.259.661355087';

To rename an alias

SQL> Alter Diskgroup ASMDB rename alias '+ASMDB/gcprod/datafile/users1.dbf' to '+ASMDB/gcprod/datafile/users2.dbf';

To delete an alias

SQL> Alter Diskgroup ASMDB delete alias '+ASMDB/gcprod/datafile/users1.dbf';

Note: Once you create an alias the files will not become OMF. Hence the files will not be deleted automatically when the tablespace is dropped. You have to delete the files manually as shown below,

Drop file using alias

SQL> Alter Diskgroup ASMDB drop file '+ASMDB/gcprod/datafile/users1.dbf';

Drop file using numeric name

SQL> Alter Diskgroup ASMDB drop file '+ASMDB.259.661355087';

Drop file using fully qualified name

SQL> Alter Diskgroup ASMDB drop file '+ASMDB/gcprod/datafile/users.259.661355087';

Thanks

Top Blogs

Monday, November 2, 2009

ASM Background Processes

Like normal database instances ASM instance too have the usual background processes like SMON, PMON, DBWr, CKPT and LGWr. In addition to that the ASM instance also have the following background processes,

RABL- Rebalancer: It opens all the device files as part of disk discovery and coordinates the ARB processes for rebalance activity.

ARBx - Actual Rebalancer: They perform the actual rebalancing activities. The number of ARBx processes depends on the ASM_POWER_LIMIT init parameter.

ASMB - ASM Bridge: This process is used to provide information to and from the Cluster Synchronization Service (CSS) used by ASM to manage the disk resources. It is also used to update statistics and provide a heartbeat mechanism.

Thanks

Top Blogs

Sunday, November 1, 2009

ASM Instance

ASM instance is a special kind of Oracle Instance which has only SGA and Background process and no Physical Files except parameter file. It manages the disk group activity. Each server has an ASM instance that manages the disk groups for that server. If the server has more than one database a single ASM instance can manage the disk group for all the databases. In an RAC configuration each node has a separate ASM instance that manages disk groups for that node.

ASM breaks the files into multiple extents and spreads the extents across all of the disks available in the disk group. Usually the extent is 1MB in size. The ASM instance creates an extent map, which has a pointer to each 1MB extent. When the database instance wants to create or open the datafile, it messages the ASM instance and ASM instance returns the extent map for that file. The database instance then performs the I/O directly with the datafile.

ASM instance must be started before the database instance starts and must be running as long as the database instance runs.

Initialization Parameters for ASM instance

Unlike database instance, ASM instance does not have physical files and can be started with few initialization parameters. The following are the required parameters.

*.instance_type=asm
*.cluster_database=TRUE
*.instance_number=1
*.remote_login_passwordfile=EXCLUSIVE
*.asm_diskgroups=ASMIND,ASMDB,ASMFLASH
*.background_dump_dest=’/…/’
*.core_dump_dest=’/…/’
*.user_dump_dest=’/…/’

The following size is used for most configurations

*.Shared_pool_size=128MB
*.Large_pool_size= 12MB
*.Db_cache_size=64MB

From Oracle 11g, there is no need to set bdump,cdump,udump. Instead set the following Automatic Diagnostic Repository parameter,

*.diagnostic_dest=’/…/’

Starting ASM instance

There are four modes to start asm instance they are,

SQL> Startup Nomount; -- starts the asm instance.
SQL> Startup Mount; -- mounts the disk groups
SQL> Startup Force; -- shuts down asm and restarts.
SQL> Startup Restrict; -- prevents oracle database from connecting to asm.

Stopping ASM instance

SQL> Shutdown;

Shutting down the ASM instance shuts down any oracle databases connected to that ASM instance in the same mode. When you issue shutdown normal, immediate or transactional ASM instance waits for the corresponding oracle databases to finish all SQL operations before shutting down.

Thanks

If you like the post vote for me by clicking the following button

Top Blogs

Automatic Storage Management

What is Automatic Storage Management ?

ASM is a special kind of volume manager specifically designed for Oracle Database Files. You give all the disks to Oracle and it will manage it for you. ASM groups the disks in the storage system as one or more disk groups and automates the placement of files within these disk groups. This results in better utilization, performance and high availability.

Advantages of ASM

1. Automatic Load Balancing: The data is spread over all the available disks and hence provide equal distribution of I/O loads across all the disks.

2. Automatic Rebalancing of data: When a disk is added or removed the data is automatically rebalanced with the remaining disks without affecting the performance.

3. Fault Tolerance : ASM provides fault tolerance through 2 to 3 levels of mirroring.

4. ASM can be used in single instance as well as RAC environment.

5. ASM files can co-exist with non-asm files in the same database.

Disadvantage of ASM

ASM cannot support some files such as alert log files, trace files, external table files etc.


Types of files stored in ASM

Data Files, Control files, Redo Log files, Archived log files, Temp files, Parameter files, Backup pieces, Flashback logs, Data pump sets.

Thanks

If you like the post vote for me by clicking the following button.

Top Blogs

Followers

Powered By Blogger
 

Oracle Database Administration. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com