Operating System: Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
Database: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
ORACLE_HOME: /u01/app/oracle/product/10.2.0/db_1
ORACLE_BASE: /u01/app/oracle
Logical RAW Disks: /dev/sdc and /dev/sdd
* 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.
* Configure Oracle Cluster Synchronization Services (CSS)
Oracle Cluster Synchronization Services (CSS) is a daemon process that is configured by the root.sh script when you configure an Automatic Storage Management instance. It is configured to start every time the system boots. This daemon process is required to enable synchronization between Oracle Automatic Storage Management and database instances. It must be running if an Oracle database is using Automatic Storage Management for database file storage.
- Run the following command as root to configure CSS.
> [oracle@oracle10g ~]$ su -
> [root@oracle10g ~]# $ORACLE_HOME/bin/localconfig add
* Manually Create the ASM Instance[root@oracle10g ~]# $ORACLE_HOME/bin/localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
oracle10g
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
- Refer to the below procedure to create a fully functional ASM Instance, carried out by an oracle user.
- Create required directories.
> [oracle@oracle10g ~]$ mkdir -p $ORACLE_BASE/admin/+ASM
> [oracle@oracle10g ~]$ cd $ORACLE_BASE/admin/+ASM
> [oracle@oracle10g +ASM]$ mkdir bdump
> [oracle@oracle10g +ASM]$ mkdir udump
> [oracle@oracle10g +ASM]$ mkdir cdump
> [oracle@oracle10g +ASM]$ mkdir cdump
> [oracle@oracle10g +ASM]$ mkdir pfile
- Create the password file:
[oracle@oracle10g +ASM]$ orapwd file=$ORACLE_HOME/dbs/orapw+ASM password=oracle entries=5
Note: Replace oracle for the correct password of SYS account.
- Create an additional entry in /etc/oratab for your ASM instance.
> [oracle@oracle10g ~]$ vi /etc/oratab
> Add the following line.
+ASM:/u01/app/oracle/product/10.2.0/db_1:Y
- Create Instance Parameter File
- Using vi editor or any other editor you like, create the init+ASM.ora file under the $ORACLE_HOME/dbs directory and add the below lines into this file.
> [oracle@oracle10g ~]$ cd $ORACLE_HOME/dbs
> [oracle@oracle10g dbs]$ vi init+ASM.ora
Note: The created parameter file should be located in:*.asm_diskgroups='VOL1'
*.asm_diskstring='/dev/sd*'
*.background_dump_dest='/u01/app/oracle/admin/+ASM/bdump'
*.core_dump_dest='/u01/app/oracle/admin/+ASM/cdump'
*.instance_type='asm'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='/u01/app/oracle/admin/+ASM/udump'
[oracle@oracle10g dbs]$ ls -l $ORACLE_HOME/dbs/init+ASM.ora
- Create server parameter file.-rw-r--r-- 1 oracle oinstall 296 Feb 6 20:15 /u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.ora
[oracle@oracle10g ~]$ export ORACLE_SID=+ASM
[oracle@oracle10g ~]$ sqlplus / as sysdba
SQL> create spfile from pfile='/u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.ora';
Note: The spfile should be located in:
[oracle@oracle10g dbs]$ ls -l $ORACLE_HOME/dbs/spfile+ASM.ora
- Startup the ASM instance.-rw-r----- 1 oracle oinstall 1536 Feb 6 20:21 /u01/app/oracle/product/10.2.0/db_1/dbs/spfile+ASM.ora
[oracle@oracle10g ~]$ sqlplus / as sysdba
SQL> startup;
Note: Notice that you will received the following error when starting up the ASM instance.SQL> startup;
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1272120 bytes
Variable Size 57448136 bytes
ASM Cache 25165824 bytes
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "VOL1"
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "VOL1"
This is fine. The ASM instance has not discovered any diskgroup yet. We will create them on the next steps.
- Verify that RAW Logical Disks are Discovered.
> This time, the ASM instance is already created but there's no diskgroup yet.
> Remember that ASM disk groups are created using from RAW disks.
> List the RAW devices:
[oracle@oracle10g dev]$ ls -l /dev/sd*
- Verify if the Oracle can find the disks.[oracle@oracle10g dev]$ ls -l /dev/sd*
brw-rw---- 1 oracle oinstall 8, 32 Feb 7 2012 /dev/sdc
brw-rw---- 1 oracle oinstall 8, 48 Feb 7 2012 /dev/sdd
> [oracle@oracle10g dev]$ sqlplus '/as sysdba'
> SQL >
column name format a20;
column path format a20;
column mount_status format a12;
SET linesize 200;
SELECT name,
path,
group_number,
disk_number,
mount_status,
header_status,
state
FROM v$asm_disk
ORDER BY group_number;
- Now that we have verified that Oracle can find the disks, let's create the diskgroup.NAME PATH GROUP_NUMBER DISK_NUMBER MOUNT_STATUS HEADER_STATU STATE
-------------------- -------------------- ------------ ----------- ------------ ------------ --------
/dev/sdd 0 0 CLOSED CANDIDATE NORMAL
/dev/sdc 0 1 CLOSED CANDIDATE NORMAL
- The name of that diskgroup that we're going to use is VOL1 and will add the first device /dev/sdc
> SQL> create diskgroup VOL1 external redundancy disk '/dev/sdc';
- Verify that it is successfully created.SQL> SQL>
SQL> create diskgroup VOL1 external redundancy disk '/dev/sdc';
Diskgroup created.
> SQL >
column name format a20;
column path format a20;
column mount_status format a12;
SET linesize 200;
SELECT asmdg.name Diskgroup,
asm.name,
asm.path,
asm.group_number,
asm.disk_number,
asm.mount_status,
asm.header_status,
asm.state
FROM v$asm_disk asm, v$asm_diskgroup asmdg
ORDER BY group_number;
- Add the additional disk for diskgroup VOL1DISKGROUP NAME PATH GROUP_NUMBER DISK_NUMBER MOUNT_STATUS HEADER_STATU STATE
------------------------------ -------------------- -------------------- ------------ ----------- ------------ ------------ --------
VOL1 /dev/sdd 0 0 CLOSED CANDIDATE NORMAL
VOL1 VOL1_0000 /dev/sdc 1 0 CACHED MEMBER NORMAL
> SQL> alter diskgroup VOL1 add disk '/dev/sdd';
- Verify that it is successfully added.SQL> alter diskgroup VOL1 add disk '/dev/sdd';
Diskgroup altered.
> SQL >
column name format a20;
column path format a20;
column mount_status format a12;
SET linesize 200;
SELECT asmdg.name Diskgroup,
asm.name,
asm.path,
asm.group_number,
asm.disk_number,
asm.mount_status,
asm.header_status,
asm.state
FROM v$asm_disk asm, v$asm_diskgroup asmdg
ORDER BY group_number;
- Show the ASM CapacityDISKGROUP NAME PATH GROUP_NUMBER DISK_NUMBER MOUNT_STATUS HEADER_STATU STATE
------------------------------ -------------------- -------------------- ------------ ----------- ------------ ------------ --------
VOL1 VOL1_0000 /dev/sdc 1 0 CACHED MEMBER NORMAL
VOL1 VOL1_0001 /dev/sdd 1 1 CACHED MEMBER NORMAL
> SQL >
SET lines 200
SELECT name,
type,
total_mb,
free_mb,
required_mirror_free_mb,
usable_file_mb,
free_mb/total_mb*100 "% Free"
FROM V$ASM_DISKGROUP;
Note: Ensure that the ASM instance is started first, before any databases that are making use of disk groups contained in it.NAME TYPE TOTAL_MB FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB % Free
-------------------- ------ ---------- ---------- ----------------------- -------------- ----------
VOL1 EXTERN 6144 6092 0 6092 99.1536458
-- End of ASM Instance Installation --