 |
|
Creating a 10g RAC
Database That Uses ASM
Oracle Database Tips by Donald Burleson |
Creating a database that uses ASM is not very
different from creating a database that uses OCFS. To create this
database, launch dbca and follow the same steps used to create a 10g
database, but this time select Automatic Storage Managementand choose the diskgroup DSKGRP01 as shown in Figure 9.8.
With a database created and using ASM, it is a
simple matter to add tablespaces with datafiles stored on ASM.
Although it is possible to use explicit names for datafiles, it is far
preferable to allow ASM to name the files for you.
To request that ASM name the file, only name the
diskgroup in the create tablespace command, for example '+DSKGRP01'.
If an entire path and file name is given, such as '+DSKGRP01/last/datafile/my_file01.dbf',
the file will be created if the directory exists, but Oracle Managed
Files will not be used. This is not desirable because if the
tablespace is dropped, the only way to delete the datafile is through
one of the ASM instances using the following command:
alter
diskgroup dskgrp_name drop file '+<group>.<file#>.<incarnation>'
ASM filenames that are created using a standard
syntax will be named as follows:
+<group>/<database_name>/<file_type>/<tag>.<file#>.<incarnation#>
Figure 9.9 demonstrates creating a new tablespace
on ASM. The datafile's incarnation# is 5 because the development
tablespace had been previously created and dropped.
Other file types stored on ASM can be viewed
through the commands shown in Figure 9.10.
Simulating the Failure
of a Failgroup
An important feature of ASM is although a disk can
get wiped out, the database will continue to function -- it is a
simple matter to replace a disk.
The following exercise will simulate the total
failure of two disks on failgroup01 and the failed disks replaced with
new volumes. You may want to create some tables with sample data on
your database to demonstrate that nothing is lost. Figure 7.6 in
Chapter 7 shows an easy method for creating tables with thousands of
rows.
1.
Switch to the root user. Bind raw10 to /dev/sda11 (DISK01) and
wipe the first 100 megabytes clean. Then, do the same with /dev/sda12
(DISK02). Finally, bind raw10 to an unused partition and exit.
2.
Start the ASM instances.
3.
Use racenv to set the environment to +ASM. Launch sqlplus and
logn sys as sysdba. Verify the condition of the disks as shown. Exit
sqlplus.
4.
You can start the database at any time now with either srvctl
or sqlplus. It may be preferable to use sqlplus for this first startup
after an intentional crash. (When I use srvctl at this point my system
tends to hang). Once the database is open, verify any objects made
previously. All the data is there; if it were not, the database would
not open on either node!
5.
The next steps will add disk volumes to restore those that were
lost. There is no reason to shutdown either ASM or the database using
ASM storage. Start on oracle1 by switching to the root user. Follow
the steps taken in the image above, first on oracle1, then on oracle2.
Exit the root login from each when finished.
6.
As oracle, use racenv to set the environment for +ASM. Login
sys as sysdba. Run the select statement shown. There are two possible
outcomes. ASM is supposed to delete the disks named DISK01 and DISK02.
Perhaps it has not yet completed that task.
7.
Add the disks back into the diskgroup as shown. If ASM deleted
DISK01 and DISK02, you will be able to reuse those names. DISK01r01
stands for DISK01replacement01. Any name you prefer can be used.
8.
Quickly query
v$asm_operationsand you will find that it is working to rebalance
the extents across the newly added disks of FAILGROUP01.
 |
If you want to learn RAC at home, get the bestselling book "Personal
Oracle Real Application Clusters" by Edward Stoever.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |
|