Professional Documents
Culture Documents
Automatic Storage Management
Automatic Storage Management
Automatic Storage Management (ASM) is a feature that has be introduced in Oracle 10g
to simplify the storage of Oracle datafiles, controlfiles and logfiles.
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.
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.
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_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.
To create an ASM instance first create a file called init+ASM.ora in the /tmp directory
containing the following information.
INSTANCE_TYPE=ASM
OR
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
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
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.
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.
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.
-- 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';
-- 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.
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.
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.
http://www.filibeto.org/sun/lib/nonsun/oracle/10.2.0.1.0/B19306_01/server.102/b14196/a
sm.htm#sthref769
http://download-
west.oracle.com/docs/cd/B19306_01/server.102/b14215/asm_util.htm#CBAGHJHI
CREATE TABLESPACE "POOL_DATA" DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_1.dbf' SIZE 6291456000,
'+DGROUP1/oradata/snsst4/pool_data_2.dbf' SIZE 6291456000,
'+DGROUP1/oradata/snsst4/pool_data_3.dbf' SIZE 6291456000,
'+DGROUP1/oradata/snsst4/pool_data_4.dbf' SIZE 6291456000,
'+DGROUP1/oradata/snsst4/pool_data_5.dbf' SIZE 6291456000,
'+DGROUP1/oradata/snsst4/pool_data_6.dbf' SIZE 10485760000,
'+DGROUP1/oradata/snsst4/pool_data_7.dbf' SIZE 10485760000,
'+DGROUP1/oradata/snsst4/pool_data_8.dbf' SIZE 5242880000,
'+DGROUP1/oradata/snsst4/pool_data_9.dbf' SIZE 10485760000,
'+DGROUP1/oradata/snsst4/pool_data_10.dbf' SIZE 5242880000,
'+DGROUP1/oradata/snsst4/pool_data_11.dbf' SIZE 5242880000,
'+DGROUP1/oradata/snsst4/pool_data_12.dbf' SIZE 1572864000,
'+DGROUP1/oradata/snsst4/pool_data_13.dbf' SIZE 8589934592,
'+DGROUP1/oradata/snsst4/pool_data_14.dbf' SIZE 8589934592,
'+DGROUP1/oradata/snsst4/pool_data_15.dbf' SIZE 8589934592,
'+DGROUP1/oradata/snsst4/pool_data_16.dbf' SIZE 8589934592,
'+DGROUP1/oradata/snsst4/pool_data_17.dbf' SIZE 8589934592
LOGGING ONLINE PERMANENT BLOCKSIZE 8192
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 40960 SEGMENT SPACE
MANAGEMENT AUTO
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_1.dbf' RESIZE 9437184000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_2.dbf' RESIZE 8388608000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_3.dbf' RESIZE 8388608000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_4.dbf' RESIZE 8388608000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_5.dbf' RESIZE 10485760000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_8.dbf' RESIZE 8388608000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_10.dbf' RESIZE 8388608000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_11.dbf' RESIZE 8388608000
ALTER DATABASE DATAFILE
'+DGROUP1/oradata/snsst4/pool_data_12.dbf' RESIZE 7864320000
hpx613!adba:~/showcommands_IDC [187]> showasmdisk SNSST4
hpx613!adba:~/showcommands_IDC [188]> showasmclients SNSST4
Comman
d Description
cd Changes the current directory to the specified directory.
du Displays the total disk space occupied by ASM files in the
specified ASM directory and all its subdirectories,
recursively.
exit Exits ASMCMD.
find Lists the paths of all occurrences of the specified name (with
wildcards) under the specified directory.
help Displays the syntax and description of ASMCMD commands.
ls Lists the contents of an ASM directory, the attributes of the
specified file, or the names and attributes of all disk groups.
lsct Lists information about current ASM clients.
lsdg Lists all disk groups and their attributes.
mkalias Creates an alias for a system-generated filename.
mkdir Creates ASM directories.
pwd Displays the path of the current ASM directory.
rm Deletes the specified ASM files or directories.
rmalias Deletes the specified alias, retaining the file that the alias
points to.
CONTROLFILE
DATAFILE
ONLINELOG
ARCHIVELOG
TEMPFILE
BACKUPSET
DATAFILE
PARAMETERFILE
DATAGUARDCONFIG
FLASHBACK
CHANGETRACKING
DUMPSET
AUTOBACKUP
XTRANSPORT