This is an excerpt from the bestselling book
Oracle Grid & Real Application Clusters. To get immediate
access to the code depot of working RAC scripts, buy it
directly from the publisher and save more than 30%.
There are seven new v$ views
provided in Oracle Database 10g used to monitor ASM structures.
These views are shown in Table 5.3.
|
VIEW |
ASM INSTANCE |
DB INSTANCE |
|
v$osm_diskgroup |
Shows disk group details
such as number, name, state, and redundancy type
|
Contains one row for every
open ASM disk in the DB instance. |
|
v$osm_client |
Shows databases using disk
groups managed by the ASM instance. |
Contains no rows. |
|
v$osm_disk |
Shows every disk discovered
by the ASM instance, including disks that are not part of any
disk group. |
Contains rows only for disks
in the disk groups in use by that DB instance. |
|
v$osm_file |
Shows the files (data, redo,
control, archive logs etc) in the ASM disk groups |
Contains rows only for files
that are currently open in the DB instance. |
|
v$osm_template |
Shows the templates
available in every disk group |
Contains no rows
|
|
v$osm_alias |
Shows the alias for every
disk group mounted |
Contains no rows. |
|
v$osm_operation |
Long operations executing
the rebalance activity are shown in this view |
Contains no rows. |
Table 5.3: ASM v$ Views
Example of ASM configuration
To explain the ASM methodology,
the following example will be used. There are four disk devices or
partitions as shown below. For demonstration purposes, a single LUN
of 9G was used and 4 partitions were created. In reality, actual
environments may have many more devices and partitions. The Command
FDISK manages the disk partitions.
[root@host-0002b /]# /sbin/fdisk /dev/sdl
The number of cylinders for this disk is set to
1110.
There is nothing wrong with
that, but this is larger than 1024,
and could in certain setups
cause problems with:
1) software that runs at boot
time (e.g., old versions of LILO)
2) booting and partitioning
software from other OSs
(e.g., DOS FDISK,
OS/2 FDISK)
Command (m for help): p
Disk /dev/sdl: 255 heads, 63
sectors, 1110 cylinders
Units = cylinders of 16065 * 512
bytes
Device Boot
Start End
Blocks Id
System
/dev/sdl1
1 13
104391 83
Linux
/dev/sdl2 14
39 208845
83 Linux
/dev/sdl3 40
549 409675
83 Linux
/dev/sdl4 550
1059 409675
83 Linux
As shown above, there are four
partitions, sd1, sd2, sd3 and sd4. The next step is to bind them as
raw and change the ownership to oracle. This will be done with two
disk partitions, sdl3 and sdl4, each of which is 4 GB in size.
[root@host-0002a dev]# raw /dev/raw/raw1 /dev/sdl3
/dev/raw/raw1: bound to major 8, minor 179
[root@host-0002a dev]# raw /dev/raw/raw2 /dev/sdl4
/dev/raw/raw2: bound to major 8, minor 180
> chown
oracle:dba /dev/raw/raw1
> chown oracle:dba /dev/raw/raw2
The next step will focus on
starting or creating an ASM instance. First, the ORACLE_HOME and
ORACLE_SID variables are set. Next, the initASM1.ora file is
prepared. In this example, the SID of the ASM instance is ASM1.
Shown below are the contents of
the initASM1.ora file.
# created by
TM 8/Apr/2004
*.ASM_DISKGROUPS=dgroup1
*.ASM_DISKSTRING='/dev/raw/raw*'
*.instance_type='ASM'
*.large_pool_size=12M
*.remote_login_passwordfile='NONE'
*.background_dump_dest= '/app/oracle/admin/ASM1/bdump'
*.core_dump_dest=
'/app/oracle/admin/ASM1/cdump'
*.user_dump_dest=
'/app/oracle/admin/ASM1/udump'
Ensure that the CSSD daemon is
up and running. CSSD is the daemon which controls the communication
between the database instance and ASM instance. To start the CSSD
daemon, follow these commands:
[root@host-0002b init.d]# pwd
/etc/init.d
[root@host-0002b init.d]# ./init.cssd start
(Oracle CSSD will be run out of init)
Then start the ASM instance as
follows:
become-2.05$ sqlplus "/ as
sysdba"
SQL*Plus: Release 10.1.0.2.0 -
Production on Fri Apr 9 14:34:38 2004
Copyright (c) 1982, 2004,
Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
nomount
ASM instance started
Total System Global Area
100663296 bytes
Fixed Size
777616 bytes
Variable Size
99885680 bytes
Database Buffers
0 bytes
Redo Buffers
0 bytes
SQL> create
diskgroup TEST_DG external redundancy
disk
'/dev/raw/raw1' ;
Diskgroup created.
SQL> alter
diskgroup TEST_DG add disk '/dev/raw/raw2';
Diskgroup altered.
Now that there are two ASM disks
with the disk group TEST_DG, the next step is to use the resources
to create a tablespace by the Database Instance NYREP10.
SQL> create
tablespace ASM_TBS1 DATAFILE '+TEST_DG' size 200M ;
Tablespace created.
SQL>
select BYTES, NAME, TS# from v$datafile ;
BYTES NAME
TS#
----------
------------------------------------------------ ----
471859200 /u01/NYREP10//datafile/o1_mf_system_02lswyso_.dbf
0
36700160 /u01/NYREP10/datafile/o1_mf_undotbs1_02lswz0t_.dbf
1
367001600 /u01/NYREP10/datafile/o1_mf_sysaux_02lswywy_.dbf
2
20971520 /u01/NYREP10/datafile/o1_mf_users_02lswz3t_.dbf
4
157286400 /u01/NYREP10/datafile/o1_mf_example_02lszorq_.dbf
6
209715200 +TEST_DG/nyrep10/datafile/asm_tbs1.256.1
7