Sie sind auf Seite 1von 27

Oracle 10g ASM Installation Steps in RHEL!!!

ASM -
ASM i.e. Automatic Storage Management simplifies administration of Oracle related files by
allowing the administrator to reference disk groups rather than individual disks and files,
which ASM manages internally. On Linux, ASM is capable of referencing disks as raw
devices or by using the ASMLib software.

In this article, we assume that you have configured a RHEL system along with Oracle
Database Software on it. To install Oracle 10g Database Software, you can follow this link.
Do not create any database now, only install the Oracle Software.

We have configured the system with below details,


Hostname - asm10g
IP address eth0 - 192.168.0.4
Gateway eth0 - 192.168.0.1

Also we have 3 raw devices available for ASM configuration (sdb, sdc, sdd). We will see the
configuration of both, ASMLib as well as RAW devices in the below article.

1) Partition the Disks:


# fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Always create the raw devices as primary partition and allocate the whole disk. Dont make
multiple primary partitions on a single disk for ASM installation. It might not work properly.
Do the above steps for /dev/sdc and /dev/sdd device also.

To update the kernel, run the below command,


# partprobe

Now check whether you are able to see the newly created raw devices.
# fdisk -l

2) ASMLib Configuration:
- Determine your kernel version and accordingly dowload the ASMLib software from OTN.

# uname -r

- The below packages were downloaded which were suitable for my kernel.
oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.7-1.el5.i386.rpm
[Y From:
http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/168542.list]

[Good
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html]

- Install the packages.


# rpm -ivh oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
oracleasm-support-2.1.7-1.el5.i386.rpm

- Now configure the ASM kernel module.


# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ([]). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: oracle


Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Creating /dev/oracleasm mount point: [ OK ]
Loading module oracleasm: [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]

- Once the ASM kernel module is configured, now create the disks.
# /etc/init.d/oracleasm createdisk DATAGRP /dev/sdb1
Marking disk /dev/sdb1 as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk ARCHGRP /dev/sdc1
Marking disk /dev/sdc1 as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk LOGGRP /dev/sdd1
Marking disk /dev/sdd1 as an ASM disk: [ OK ]
# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks: [ OK ]

- To list the disks configured.


# /etc/init.d/oracleasm listdisks
ARCHGRP
DATAGRP
LOGGRP

The ASM disks are now ready for use.

3) RAW Device Setup:


- Edit the file /etc/sysconfig/rawdevices, and add the below lines:
# vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
- Now restart the service.
# service rawdevices restart

Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2 --> /dev/sdc1
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3 --> /dev/sdd1
/dev/raw/raw3: bound to major 8, minor 49
done

- Change the ownership and permissions of raw devices


# chown oracle.oinstall /dev/raw/raw1
# chown oracle.oinstall /dev/raw/raw2
# chown oracle.oinstall /dev/raw/raw3
# chmod 600 /dev/raw/raw1
# chmod 600 /dev/raw/raw2
# chmod 600 /dev/raw/raw3

The ASM raw disks are configured. You can start your database creation now.

4) Create ASM Instance:


- Creation of the ASM instance is the same, whether you make use of ASMLib or RAW
devices. When using ASMLib, the candidate disks are listed using the stamp associated with
them, while the raw devices are listed using their device name.

- Login as oracle user and start Database Configuration Assistant.


$ dbca

- WELCOME Screen

Click on Next to continue.


- OPERATIONS Screen

Select Configure Automatic Storage Management option click on Next to continue.

A warning message will get displayed saying that Oracle Cluster Synchronization Service
(CSS) is not currently running.

Open a new terminal and login as root.


Execute the command shown in the warning window.
# /u01/app/oracle/product/10.2.0/db/bin/localconfig add

When the execution is complete, click on OK button and again click Next to continue.
- CREATE ASM INSTANCE Screen

Enter password that will be used for ASM instance.


Click on Next.

A confirmation window will get open for creating the ASM instance.
Click on OK and ASM instance will get created as shown in below pic.

- ASM DISK GROUPS Screen


Initially the window will be blank as shown above.
Click on Create New and CREATE DISK GROUP screen will get open.

Enter Disk Group Name: DATAGRP


Select Redundancy: External

- When using ASMLib, the Disk Path column will contain values as given below
ORCL:DATAGRP
ORCL:ARCHGRP
ORCL:LOGGRP

- When using raw devices, the Disk Path column will contain candidate disks
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3

Since we are using raw devices, select 1st raw device i.e. /dev/raw/raw1
Click on OK and the ASM Disk Creation will start.

- Similarly create ARCHGRP and LOGGRP disk groups as shown in above steps.

- Once all disk groups are configured, you should see 3 disk groups similar to the below pic.

Now on ASM DISK GROUPS Screen, click on Finish. You will get a popup window. Click
on No to continue.
- Now the ASM instance has been configured. You can check the ASM instance running as
below.
$ ps -ef | grep pmon

5) Listener Configuration:
- Before starting with the database creation, configure the listener and register ASM instance
with it.
$ netca

- If you dont see the ASM instance register with the listener service, then do the below steps
$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
SQL> alter system register;
SQL> exit
$ lsnrctl status

Now you will see that the ASM instance has been registered with the listener service.

6) Create Database:
- Start DBCA.
$ dbca

- WELCOME Screen

Click on Next to continue.

- OPERATIONS Screen
Select Create a Database and click on Next to continue.

- DATABASE TEMPLATES Screen

Click on Next to continue.

- DATABASE IDENTIFICATION Screen


Enter the DB name and click on Next to continue.

- MANAGEMENT OPTIONS Screen

If you want to configure your database with Enterprise Manager, then check the option
Configure the database with Enterprise Manager else uncheck it.
Click on Next to continue.

- DATABASE CREDENTIALS Screen


Enter common password for all accounts and click on Next to continue.

- STORAGE OPTIONS Screen

Select Automatic Storage Management (ASM)


Click on Next to continue. It will prompt you for sys password of ASM.
Enter the password that you configured while creating ASM instance.

- ASM DISK GROUPS Screen

Select all the disk groups click on Next.

- DATABASE FILE LOCATIONS Screen


Select Use Oracle-Managed Files and enter path as +DATAGRP

Click on Multiplex Redo Logs and Control Files and enter path as shown below,

- RECOVERY CONFIGURATION Screen


If you want to enable Flash logs, check the Specify Flash Recovery Area and enter the
details as shown.

If you want to enable archiving mode, select Enable Archiving and click Edit Archive
Mode Parameters. Enter the path as shown below.

Click on Next to continue.

- DATABASE CONTENT Screen


Click on Next to continue.

- INITIALIZATION PARAMETERS Screen

Click on Character Sets tab,


Select Character Set as Unicode (AL32UTF8).
Select Default Date Format as India.
Click on Next to continue.

- DATABASE STORAGE Screen


You can see the OMF file format for datafiles, controlfiles and redolog files. Click on Next to
continue.

- CREATION OPTIONS Screen

By default, the Create Database option is selected.


If you want to create scripts, select the Generate Database Creation Scripts option.
Click on Finish.

- CONFIRMATION Screen
Click on OK to start the installation.

- GENERATION OF SCRIPTS Screen


Since we had selected the option to generate the database creation scripts, before starting the
database creation the scripts get generated.
Click on OK.

- DATABASE CREATION PROGRESS Screen

You can observe the Database creation.

- END OF DATABASE CREATION Screen

- The Database has been created using ASM as storage option. You can verify the location of
database files as below,
$ ps -ef | grep pmon
$ ps -ef | grep lsn

$ export ORACLE_SID=asmdb

$ sqlplus / as sysdba
SQL> select name from v$datafile;
SQL> select name from v$tempfile;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;
SQL> show parameter log_archive_file_dest;
SQL> show parameter db_recover;

Switching from Raw Devices to ASMLib:


If you prefer to use ASMLIB rather than RAW devices, follow the below steps. This is just an
extra activity which you might try.

- Shutdown any databases using the ASM instance, but leave the ASM instance itself running.

- Now connect to the ASM instance.


$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba

- Alter the ASM disk string to exclude the raw devices used earlier, then shutdown the ASM
instance.
SQL> ALTER SYSTEM SET asm_diskstring = ORCL:DISK* SCOPE=SPFILE;
System altered.

SQL> SHUTDOWN IMMEDIATE;


ASM diskgroups dismounted
ASM instance shutdown

SQL>

- At this point the disks will not be used by ASM because they are not stamped. Now issue
the renamedisk command as the root user for each disk.

# /etc/init.d/oracleasm renamedisk /dev/sdb1 DISK1


Renaming disk /dev/sdb1 to VOL1: [ OK ]

# /etc/init.d/oracleasm renamedisk /dev/sdc1 DISK2


Renaming disk /dev/sdc1 to VOL2: [ OK ]

# /etc/init.d/oracleasm renamedisk /dev/sdd1 DISK3


Renaming disk /dev/sdd1 to VOL3: [ OK ]

Notice, the stamp matches the discovery string set earlier. The ASM instance can now be
started.
SQL> STARTUP
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted

SQL>
The ASM instance is now using ASMLib, rather than raw devices. All dependent databases
can now be started.

Switching from ASMLib to Raw Devices:


- Shutdown any databases using the ASM instance, but leave the ASM instance itself running.

- Now connect to the ASM instance.


$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba

- Alter the ASM disk string to match the raw devices that you want to use, then shutdown the
ASM instance.
SQL> ALTER SYSTEM SET asm_diskstring = /dev/raw/raw* SCOPE=SPFILE;
System altered.

SQL> SHUTDOWN IMMEDIATE;


ASM diskgroups dismounted
ASM instance shutdown

SQL>

- Perform all the steps listed in the Raw Device Setup, then start the ASM instance.
SQL> STARTUP
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1217836 bytes
Variable Size 57502420 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted

SQL>

The ASM instance is now using the disks as raw devices, rather than as ASMLib disks. All
dependent databases can now be started

http://chotustuff.wordpress.com/2012/01/29/oracle-asm-installation-steps-in-linux/

One More...

How to Configure ASM disks using ASMLib or Raw Disks


Posted by Zahid on August 27, 2009.

The ASM disks can be non formatted partitions from your disk already installed for OS and
they can even be OS files configured as disks. But if we use VMWare then we can add more
virtual disks to the system without any cost simulating our test environment with a real time
ASM configurations where many disks are used on different controllers to take benefit of
ASM mirroring and stripping of data. See below how to add more disks to the Virtual
machine.

NOTE: This tutorial was done on RHEL installed on VMWare.


On VMWare server web console you will see a link "Add Hardware" in the Commands
section on the right side panel. Click it and add hardware wizard will open.

1. From hardware types select "Hard Disk".


Hardware Type

2. Select "Create a new virtual disk" from the next page.


Hard Disk

3. On the Hard Disk Properties page select the capacity for the disk along with other options.
Hard Disk Properties
Notice the "Allocate all disk space now" unchecked. Its best to leave it unchecked.

4. See the hardware that is going to be added.


Hard Disk Properties

On this page select More Hardware and click "Hard Disk".


Repeat this process for all the disks you want to add to the system. When done press finish.

5. After you finish the add hardware wizard you should see your changes in the hardware on
the summary page of the virtual machine.
Ready to Complete
I have added 4 disks of size 4G each and all on different SCSI disk controller. We usually do
this to get most out of the ASM disk mirroring i.e. even if one disk is dead, Oracle will still
be able to read data from mirrored copies from other disks. But think about all of your disks
are on one disk controller and that whole controller is burnt, then you loose all of your data.

Now power on your Virtual machine from the commands panel on the right side of the VM
console and login as root.

# ls /dev/sd*
/dev/sda /dev/sda2 /dev/sda4 /dev/sda6 /dev/sdc /dev/sde
/dev/sda1 /dev/sda3 /dev/sda5 /dev/sdb /dev/sdd

# cat /proc/partitions
major minor #blocks name

8 0 26214400 sda
8 1 104391 sda1
8 2 10482412 sda2
8 3 3148740 sda3
8 4 1 sda4
8 5 1052226 sda5
8 6 11422183 sda6
8 16 4194304 sdb
8 32 4194304 sdc
8 48 4194304 sdd
8 64 4194304 sde

/*
Since we added SCSI disks so you should see then in /dev/sd*.
sda is our main disk where OS and other apps are installed and
sda1 to sda6 are its partitions.
sdb to sde are the new four disks that we have just added.
The output from 'cat /proc/partitions' shows they are not
partitioned yet. We have to create at least one partition in each
disk.
We can have more then one partitions and use each partition as a
different ASM disk.
I am going to create one partition in all disks.
*/

# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun,


SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected


by w(rite)

Command (m for help): n


Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
Using default value 522

Command (m for help): w


The partition table has been altered!

Calling ioctl() to re-read partition table.


Syncing disks.

/*
Repeat the fdisk operation for all 4 disks in the same way as
demonstrated above.
*/

# cat /proc/partitions
major minor #blocks name

8 0 26214400 sda
8 1 104391 sda1
8 2 10482412 sda2
8 3 3148740 sda3
8 4 1 sda4
8 5 1052226 sda5
8 6 11422183 sda6
8 16 4194304 sdb
8 17 4192933 sdb1
8 32 4194304 sdc
8 33 4192933 sdc1
8 48 4194304 sdd
8 49 4192933 sdd1
8 64 4194304 sde
8 65 4192933 sde1
#

Verify that you have one partition for every disk.


Use ASMLib to stamp the disks as ASM disks:
Oracle provides ASM libraries to stamp the disks as ASM disks. These libraries are
distributed on the Linux kernel basis. You need to know which kernel version you are using
then get the libraries from the OTN website to download libs for your kernel.

# uname -r
2.6.18-164.el5

/* This is the kernel version I am using. */


# uname -p
i686

/* This is the processor type. */


# uname -i
i386
/* This is the hardware platform. */

According to the above information I need following libraries.


oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasm-support-2.1.3-1.el5.i386.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm

# rpm -Uvih oracleasm-support-2.1.3-1.el5.i386.rpm \


> oracleasmlib-2.0.4-1.el5.i386.rpm \
> oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
warning: oracleasm-support-2.1.3-1.el5.i386.rpm: Header V3 DSA
signature: NOKEY, key ID 1e5e0159
Preparing... ################################# [100%]
1:oracleasm-support ################################# [ 33%]
2:oracleasm-2.6.18-164.el ################################# [ 67%]
3:oracleasmlib ################################# [100%]

With the oracleasm utility installed, configure the kernel module for ASM.
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.

Default user to own the driver interface []: oracle


Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]

After the kernel module is updated, label the disks as ASM disks and give then an ASM
name.

# /etc/init.d/oracleasm createdisk ASM1 /dev/sdb1


Marking disk "ASM1" as an ASM disk: [ OK ]

# /etc/init.d/oracleasm createdisk ASM2 /dev/sdc1


Marking disk "ASM2" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm createdisk ASM3 /dev/sdd1
Marking disk "ASM3" as an ASM disk: [ OK ]

# /etc/init.d/oracleasm createdisk ASM4 /dev/sde1


Marking disk "ASM4" as an ASM disk: [ OK ]

Now issue a scandisks on all ASM disks.


# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]

listsdisks will list all ASM disks. Make sure you see all the disks you configured.
# /etc/init.d/oracleasm listdisks
ASM1
ASM2
ASM3
ASM4
#

Configure RAW disks to use as ASM disks:


Open /etc/sysconfig/rawdevices and add following lines:

/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
/dev/raw/raw4 /dev/sde1

Restart the rwdevices service to make your changes effective.


# service rawdevices restart
Assigning devices:
/dev/raw/raw1 --> /dev/sdb1
/dev/raw/raw1: bound to major 8, minor 17
/dev/raw/raw2 --> /dev/sdc1
/dev/raw/raw2: bound to major 8, minor 33
/dev/raw/raw3 --> /dev/sdd1
/dev/raw/raw3: bound to major 8, minor 49
/dev/raw/raw4 --> /dev/sde1
/dev/raw/raw4: bound to major 8, minor 65
done
#

This will bound the disks with raw devices.


Execute the following commands to set access and ownership on the raw disks for user
oracle.
Also add these lines in /etc/rc.local to preserve these settings after system restart.
# chown oracle:oinstall /dev/raw/raw1
# chown oracle:oinstall /dev/raw/raw2
# chown oracle:oinstall /dev/raw/raw3
# chown oracle:oinstall /dev/raw/raw4
# chmod 660 /dev/raw/raw1
# chmod 660 /dev/raw/raw2
# chmod 660 /dev/raw/raw3
# chmod 660 /dev/raw/raw4

NOTE: Raw devices setup or the ASMLib setup are two different mutually exclusive ways to
configure ASM disks. You will use either one of those not both.
If you are using RHEL5.0 or 5.1 then you won't find the rawdevices service or the
/etc/sysconfig/rawdevices file, please refer to the links provided below.
See also:
How to install ASM instance on a non-asm Oracle database
How to configure Raw Disks in RHEL 5
How to migrate Oracle datafiles to ASM storage via RMAN
How to migrate online redo logs to Oracle ASM storage
Migrate Oracle Flash Recovery Area to ASM storage via RMAN
Add ASM Instance into Enterprise Manager

Das könnte Ihnen auch gefallen