目录
ASM using ASMLib and Raw Devices
Introduction
Partition the Disks
ASMLib Installation
Raw Device Setup
ASM Creation
Database Creation
Switching from Raw Devices to ASMLib
Switching from ASMLib to Raw Devices
Performance Comparison
首页 数据库 mysql教程 ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Jun 07, 2016 pm 03:50 PM
and asm raw using

Home?Articles?10g? Here http://www.oracle-base.com/articles/10g/asm-using-asmlib-and-raw-devices.php ASM using ASMLib and Raw Devices Introduction Partition the Disks ASMLib Installation Raw Device Setup ASM Creation Database Creation Swit

Home ? Articles ? 10g ? Here
http://www.oracle-base.com/articles/10g/asm-using-asmlib-and-raw-devices.php

ASM using ASMLib and Raw Devices

  • Introduction
  • Partition the Disks
  • ASMLib Installation
  • Raw Device Setup
  • ASM Creation
  • Database Creation
  • Switching from Raw Devices to ASMLib
  • Switching from ASMLib to Raw Devices
  • Performance Comparison

Related articles.

  • Automatic Storage Management (ASM) in Oracle Database 10g
  • Using NFS with ASM
  • Automatic Storage Manager (ASM) Enhancements in Oracle Database 11g Release 1
  • UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6

Introduction

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 ASM manages internally. On Linux, ASM is capable of referencing disks as raw devices or by using the ASMLib software. This article presents the setup details for using either raw devices or ASMLib, as well as the procedures for converting between both methods.

The article assumes the operating system installation is complete, along with an Oracle software installation. The ASM instance shares the Oracle home with the database instance. If you plan on running multiple database instances on the server the ASM instance should be installed in a separate Oracle home.

Note: When running Oracle 10g Release 2 on RHEL 4 you should consider reading this article: Using Block Devices for Oracle 10g Release 2 in RHEL 4

Partition the Disks

Both ASMLib and raw devices require the candidate disks to be partitioned before they can be accessed. In this example, three 10Gig VMware virtual disks are to be used for the ASM storage. The following text shows the "/dev/sdb" disk being partitioned.

# ls sd*
sda  sda1  sda2  sdb  sdc  sdd
# 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.


The number of cylinders for this disk is set to 1305.
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)
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-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.
#
登录后复制
登录后复制

The remaining disks ("/dev/sdc" and "/dev/sdd") must be partitioned in the same way.

ASMLib Installation

This step is only necessary if you want to use ASMLib to access the ASM disks.

Determine your kernel version using the following command as the root user.

# uname -r
2.6.9-34.ELsmp
#
登录后复制
登录后复制

Download the ASMLib software from the OTN website, making sure you pick the version that matches your distribution, kernel and architecture. For this example I used CentOS 4.3, so the following packages were required.

  • oracleasm-support-2.0.1-1.i386.rpm
  • oracleasmlib-2.0.1-1.i386.rpm
  • oracleasm-2.6.9-34.ELsmp-2.0.1-1.i686.rpm

Install the packages as the root user.

# rpm -Uvh oracleasm-support-2.0.1-1.i386.rpm \
           oracleasmlib-2.0.1-1.i386.rpm \
           oracleasm-2.6.9-34.ELsmp-2.0.1-1.i686.rpm
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [ 33%]
   2:oracleasm-2.6.9-34.ELsm########################################### [ 67%]
   3:oracleasmlib           ########################################### [100%]
#
登录后复制
登录后复制

With the software installed, 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 <enter> 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]:
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  ]
#</enter>
登录后复制
登录后复制

Once the kernel module is loaded, stamp (or label) the partitions created earlier as ASM disks.

# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk:                   [  OK  ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk:                   [  OK  ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk:                   [  OK  ]
#
登录后复制
登录后复制

If this were a RAC installation, the disks would only be stamped by one node. The other nodes would just scan for the disks.

# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks:                             [  OK  ]
#
登录后复制
登录后复制

The stamped disks are listed as follows.

# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
#
登录后复制
登录后复制

The disks are now ready to be used by ASM.

Raw Device Setup

This step is only necessary if you want ASM to access the disks as raw devices.

Edit the "/etc/sysconfig/rawdevices" file, adding the following lines.

/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
登录后复制
登录后复制

Restart the rawdevices service using the following command.

service rawdevices restart
登录后复制
登录后复制

Run the following commands and add them the "/etc/rc.local" file.

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 device disks are now configured.

ASM Creation

Creation of the ASM instance is the same, regardless of the 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.

To configure an ASM instance, start the Database Configuration Assistant by issuing the "dbca" command as the oracle user. On the "Welcome" screen, click the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Select the "Configure Automatic Storage Management" option, then click the "Next" Button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

If the Oracle Cluster Syncronization Service (CSS) is not currently running, a warning screen will be displayed. Follow the instructions and click the "OK" button. Once you've returned to the previous screen, click the "Next" button again.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

The script gives the following output.

# /u01/app/oracle/product/10.2.0/db_1/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 90 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.
        centos2
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
#
登录后复制
登录后复制

Enter a password for the ASM instance, then click the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

On the confirmation screen, click the "OK" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Wait while the ASM instance is created.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Once the ASM instance is created, you are presented with the "ASM Disk Groups" screen. Click the "Create New" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

On the "Create Disk Group" screen, enter Disk Group Name of "DATA" and select the required level of redundancy:

  • External - ASM does not mirror the files. This option should only be used if your disks are already protected by some form of redundancy, like RAID.
  • Normal - ASM performs two-way mirroring of all files.
  • High - ASM performs three-way mirroring of all files.

In this example, the "High" redundancy is used. Select all three candidate disks and click the "OK" button. The following image shows how the candidate disks are displayed when using ASMLib.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

When using raw devices, the candidate discs are listed using the devide names.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

On the "ASM Disk Groups" screen. Click the "Finish" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Click the "Yes" button to perform another operation.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

You are now ready to create a database instance using ASM.

Database Creation

Before continuing with the database creation, check the listener is up and the ASM instance has registered with it. Start the listener using the following command.

$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-APR-2006 14:35:46

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener .log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos2.localdomain)(POR T=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                29-APR-2006 14:35:47
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos2.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
$
登录后复制
登录后复制

The ASM instance is not registered, so we can force the registration by doing the following.

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 29 14:37:06 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter system register;

System altered.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr oduction
With the Partitioning, OLAP and Data Mining options
$
登录后复制
登录后复制

Checking the status of the listener shows that the ASM instance is now registered.

$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-APR-2006 14:37:32

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                29-APR-2006 14:35:47
Uptime                    0 days 0 hr. 1 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos2.localdomain)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
$
登录后复制
登录后复制

Go back to the DBCA and create a custom database in the normal way, selecting the "Automatic Storage Management (ASM)" storage option.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Enter the ASM password if prompted, then click the "OK" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Select the "DATA" disk group, then clicking the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Accept the default "Oracle-Managed Files" database location by clicking the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Enable the "Flash Recovery Area" and Archiving, using the "+DATA" disk group for both.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Continue with the rest of the DBCA, selecting the required options along the way.

Switching from Raw Devices to ASMLib

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

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
登录后复制
登录后复制
登录后复制
登录后复制

Perform the ASMLib Installation, but stop prior to stamping the ASM disk. If you attempt to stamp the disks using the createdisk command it will fail.

Alter the ASM disk discovery string to exclude the raw devices used previously, then shutdown the ASM instance.

SQL> ALTER SYSTEM SET asm_diskstring = 'ORCL:VOL*' SCOPE=SPFILE;

System altered.

SQL> SHUTDOWN IMMEDIATE;
ASM diskgroups dismounted
ASM instance shutdown
SQL>
登录后复制
登录后复制

If you are planning to remove the raw device mappings (Raw Device Setup), you could simply reset the ASM_DISKGROUP parameter.

SQL> ALTER SYSTEM RESET asm_diskstring SCOPE=SPFILE SID='*';

System altered.

SQL>
登录后复制
登录后复制

At this point the disks will not be used by ASM because they are not stamped. As mentioned previously, the createdisk command used to stamp new disks would fail, so we must issue the renamedisk command as the root user for each disk.

# /etc/init.d/oracleasm renamedisk /dev/sdb1 VOL1
Renaming disk "/dev/sdb1" to "VOL1":                       [  OK  ]
# /etc/init.d/oracleasm renamedisk /dev/sdc1 VOL2
Renaming disk "/dev/sdc1" to "VOL2":                       [  OK  ]
# /etc/init.d/oracleasm renamedisk /dev/sdd1 VOL3
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. Connect to the running ASM instance.

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
登录后复制
登录后复制
登录后复制
登录后复制

Alter the ASM disk discovery string to match the raw devices you plan to set up, 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.

Performance Comparison

Some documents suggests using ASMLib with Oracle 10g Release 2 gives superior disk performance, while others say it only reduces the time searching for candidate disks, and hence ASM startup time. I decided to compare the performance of the two methods myself to see if I could tell the difference.

My first thought was to perform a simple insert/update/delete test, so I created the following user and schema for the test in a database using and ASM instance using ASMLib.

export ORACLE_SID=DB10G
sqlplus / as sysdba

CREATE TABLESPACE test_ts;

CREATE USER test_user IDENTIFIED BY test_user DEFAULT TABLESPACE test_ts QUOTA UNLIMITED ON test_ts;
GRANT CONNECT, CREATE TABLE TO test_user;

CONN test_user/test_user

CREATE TABLE test_tab (
  id    NUMBER,
  data  VARCHAR2(4000),
  CONSTRAINT test_tab_pk PRIMARY KEY (id)
);
登录后复制
登录后复制

Then, as the test user, I ran the following code several times and calculated an average time for each operation.

SET SERVEROUTPUT ON
DECLARE
  l_loops NUMBER := 1000;
  l_data  VARCHAR2(32767) := RPAD('X', 4000, 'X');
  l_start NUMBER;
BEGIN
  l_start := DBMS_UTILITY.get_time;

  FOR i IN 1 .. l_loops LOOP
    INSERT INTO test_tab (id, data) VALUES (i, l_data);
    COMMIT;
  END LOOP;

  DBMS_OUTPUT.put_line('Inserts (' || l_loops || '): ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

  l_start := DBMS_UTILITY.get_time;

  FOR i IN 1 .. l_loops LOOP
    UPDATE test_tab
    SET    data = l_data
    WHERE  id   = i;
    COMMIT;
  END LOOP;

  DBMS_OUTPUT.put_line('Updates (' || l_loops || '): ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

  l_start := DBMS_UTILITY.get_time;

  FOR i IN 1 .. l_loops LOOP
    DELETE FROM test_tab
    WHERE  id = i;
    COMMIT;
  END LOOP;

  DBMS_OUTPUT.put_line('Deletes (' || l_loops || '): ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

  EXECUTE IMMEDIATE 'TRUNCATE TABLE test_tab';
END;
/
登录后复制
登录后复制

The code is purposely inefficient, using a single statement and a commit within a loop for each operation. Remember, the ASM instance is using high redundancy, so each physical write operation is effectively done 3 times.

Once the tests on ASMLib were complete, I switched to using raw devices and repeated the tests. The average results for 1000 of each operation are listed below.

Operation       ASMLib (hsecs)  Raw Devices (hsecs)
==============  ==============  ===================
Inserts (1000)             468                  852
Updates (1000)             956                 1287
Deletes (1000)            1281                 1995
登录后复制
登录后复制

You can instantly see that the ASMLib results are better than those of the raw devices, but the testing is suspect for the following reasons:

  • For each single run of the script, only 1000 operations of each type were performed. That equates to about 4M of data in the table when it is full. When you consider the use of the buffer cache, this is a pitiful amount of data. I originally intended to perform many more operations, but my disk was grinding so badly I thought better of it.
  • The tests were performed using VMware virtual disks, so really all this work was being done on a single SATA disk. I can't be sure if these results aren't just an artifact of the setup.
  • Although the average results look convincing, the raw data was so eratic I'm not convinced these results mean anything.

For these reasons, I decided not to continue to persue the performance tests, much to the delight of my hard drive. If I get access to a more realistic setup I will attempt some large scale tests and report the outcome.

For more information see:

  • Installing ASMLib
  • Migrating Raw Devices to ASMLib
  • Automatic Storage Management (ASM) in Oracle Database 10g
  • Oracle Database 10g Release 2 (10.2.0.1) RAC Installation On Linux (CentOS 4) Using VMware Server
  • Configuring I/O for Raw Partitions

Hope this helps. Regards Tim...

Back to the Top.

  • Introduction
  • Partition the Disks
  • ASMLib Installation
  • Raw Device Setup
  • ASM Creation
  • Database Creation
  • Switching from Raw Devices to ASMLib
  • Switching from ASMLib to Raw Devices
  • Performance Comparison

Related articles.

  • Automatic Storage Management (ASM) in Oracle Database 10g
  • Using NFS with ASM
  • Automatic Storage Manager (ASM) Enhancements in Oracle Database 11g Release 1
  • UDEV SCSI Rules Configuration for ASM in Oracle Linux 5 and 6

Introduction

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 ASM manages internally. On Linux, ASM is capable of referencing disks as raw devices or by using the ASMLib software. This article presents the setup details for using either raw devices or ASMLib, as well as the procedures for converting between both methods.

The article assumes the operating system installation is complete, along with an Oracle software installation. The ASM instance shares the Oracle home with the database instance. If you plan on running multiple database instances on the server the ASM instance should be installed in a separate Oracle home.

Note: When running Oracle 10g Release 2 on RHEL 4 you should consider reading this article: Using Block Devices for Oracle 10g Release 2 in RHEL 4

Partition the Disks

Both ASMLib and raw devices require the candidate disks to be partitioned before they can be accessed. In this example, three 10Gig VMware virtual disks are to be used for the ASM storage. The following text shows the "/dev/sdb" disk being partitioned.

# ls sd*
sda  sda1  sda2  sdb  sdc  sdd
# 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.


The number of cylinders for this disk is set to 1305.
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)
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-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.
#
登录后复制
登录后复制

The remaining disks ("/dev/sdc" and "/dev/sdd") must be partitioned in the same way.

ASMLib Installation

This step is only necessary if you want to use ASMLib to access the ASM disks.

Determine your kernel version using the following command as the root user.

# uname -r
2.6.9-34.ELsmp
#
登录后复制
登录后复制

Download the ASMLib software from the OTN website, making sure you pick the version that matches your distribution, kernel and architecture. For this example I used CentOS 4.3, so the following packages were required.

  • oracleasm-support-2.0.1-1.i386.rpm
  • oracleasmlib-2.0.1-1.i386.rpm
  • oracleasm-2.6.9-34.ELsmp-2.0.1-1.i686.rpm

Install the packages as the root user.

# rpm -Uvh oracleasm-support-2.0.1-1.i386.rpm \
           oracleasmlib-2.0.1-1.i386.rpm \
           oracleasm-2.6.9-34.ELsmp-2.0.1-1.i686.rpm
Preparing...                ########################################### [100%]
   1:oracleasm-support      ########################################### [ 33%]
   2:oracleasm-2.6.9-34.ELsm########################################### [ 67%]
   3:oracleasmlib           ########################################### [100%]
#
登录后复制
登录后复制

With the software installed, 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 <enter> 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]:
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  ]
#</enter>
登录后复制
登录后复制

Once the kernel module is loaded, stamp (or label) the partitions created earlier as ASM disks.

# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "/dev/sdb1" as an ASM disk:                   [  OK  ]
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
Marking disk "/dev/sdc1" as an ASM disk:                   [  OK  ]
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
Marking disk "/dev/sdd1" as an ASM disk:                   [  OK  ]
#
登录后复制
登录后复制

If this were a RAC installation, the disks would only be stamped by one node. The other nodes would just scan for the disks.

# /etc/init.d/oracleasm scandisks
Scanning system for ASM disks:                             [  OK  ]
#
登录后复制
登录后复制

The stamped disks are listed as follows.

# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
#
登录后复制
登录后复制

The disks are now ready to be used by ASM.

Raw Device Setup

This step is only necessary if you want ASM to access the disks as raw devices.

Edit the "/etc/sysconfig/rawdevices" file, adding the following lines.

/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdc1
/dev/raw/raw3 /dev/sdd1
登录后复制
登录后复制

Restart the rawdevices service using the following command.

service rawdevices restart
登录后复制
登录后复制

Run the following commands and add them the "/etc/rc.local" file.

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 device disks are now configured.

ASM Creation

Creation of the ASM instance is the same, regardless of the 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.

To configure an ASM instance, start the Database Configuration Assistant by issuing the "dbca" command as the oracle user. On the "Welcome" screen, click the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Select the "Configure Automatic Storage Management" option, then click the "Next" Button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

If the Oracle Cluster Syncronization Service (CSS) is not currently running, a warning screen will be displayed. Follow the instructions and click the "OK" button. Once you've returned to the previous screen, click the "Next" button again.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

The script gives the following output.

# /u01/app/oracle/product/10.2.0/db_1/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 90 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.
        centos2
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
#
登录后复制
登录后复制

Enter a password for the ASM instance, then click the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

On the confirmation screen, click the "OK" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Wait while the ASM instance is created.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Once the ASM instance is created, you are presented with the "ASM Disk Groups" screen. Click the "Create New" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

On the "Create Disk Group" screen, enter Disk Group Name of "DATA" and select the required level of redundancy:

  • External - ASM does not mirror the files. This option should only be used if your disks are already protected by some form of redundancy, like RAID.
  • Normal - ASM performs two-way mirroring of all files.
  • High - ASM performs three-way mirroring of all files.

In this example, the "High" redundancy is used. Select all three candidate disks and click the "OK" button. The following image shows how the candidate disks are displayed when using ASMLib.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

When using raw devices, the candidate discs are listed using the devide names.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

On the "ASM Disk Groups" screen. Click the "Finish" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Click the "Yes" button to perform another operation.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

You are now ready to create a database instance using ASM.

Database Creation

Before continuing with the database creation, check the listener is up and the ASM instance has registered with it. Start the listener using the following command.

$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-APR-2006 14:35:46

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener .log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos2.localdomain)(POR T=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                29-APR-2006 14:35:47
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos2.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
$
登录后复制
登录后复制

The ASM instance is not registered, so we can force the registration by doing the following.

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 29 14:37:06 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter system register;

System altered.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Pr oduction
With the Partitioning, OLAP and Data Mining options
$
登录后复制
登录后复制

Checking the status of the listener shows that the ASM instance is now registered.

$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 29-APR-2006 14:37:32

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                29-APR-2006 14:35:47
Uptime                    0 days 0 hr. 1 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos2.localdomain)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
  Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
$
登录后复制
登录后复制

Go back to the DBCA and create a custom database in the normal way, selecting the "Automatic Storage Management (ASM)" storage option.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Enter the ASM password if prompted, then click the "OK" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Select the "DATA" disk group, then clicking the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Accept the default "Oracle-Managed Files" database location by clicking the "Next" button.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Enable the "Flash Recovery Area" and Archiving, using the "+DATA" disk group for both.

ASM using ASMLib and Raw Devices (for oracle 10g)【不错的

Continue with the rest of the DBCA, selecting the required options along the way.

Switching from Raw Devices to ASMLib

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

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
登录后复制
登录后复制
登录后复制
登录后复制

Perform the ASMLib Installation, but stop prior to stamping the ASM disk. If you attempt to stamp the disks using the createdisk command it will fail.

Alter the ASM disk discovery string to exclude the raw devices used previously, then shutdown the ASM instance.

SQL> ALTER SYSTEM SET asm_diskstring = 'ORCL:VOL*' SCOPE=SPFILE;

System altered.

SQL> SHUTDOWN IMMEDIATE;
ASM diskgroups dismounted
ASM instance shutdown
SQL>
登录后复制
登录后复制

If you are planning to remove the raw device mappings (Raw Device Setup), you could simply reset the ASM_DISKGROUP parameter.

SQL> ALTER SYSTEM RESET asm_diskstring SCOPE=SPFILE SID='*';

System altered.

SQL>
登录后复制
登录后复制

At this point the disks will not be used by ASM because they are not stamped. As mentioned previously, the createdisk command used to stamp new disks would fail, so we must issue the renamedisk command as the root user for each disk.

# /etc/init.d/oracleasm renamedisk /dev/sdb1 VOL1
Renaming disk "/dev/sdb1" to "VOL1":                       [  OK  ]
# /etc/init.d/oracleasm renamedisk /dev/sdc1 VOL2
Renaming disk "/dev/sdc1" to "VOL2":                       [  OK  ]
# /etc/init.d/oracleasm renamedisk /dev/sdd1 VOL3
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. Connect to the running ASM instance.

$ export ORACLE_SID=+ASM
$ sqlplus / as sysdba
登录后复制
登录后复制
登录后复制
登录后复制

Alter the ASM disk discovery string to match the raw devices you plan to set up, 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.

Performance Comparison

Some documents suggests using ASMLib with Oracle 10g Release 2 gives superior disk performance, while others say it only reduces the time searching for candidate disks, and hence ASM startup time. I decided to compare the performance of the two methods myself to see if I could tell the difference.

My first thought was to perform a simple insert/update/delete test, so I created the following user and schema for the test in a database using and ASM instance using ASMLib.

export ORACLE_SID=DB10G
sqlplus / as sysdba

CREATE TABLESPACE test_ts;

CREATE USER test_user IDENTIFIED BY test_user DEFAULT TABLESPACE test_ts QUOTA UNLIMITED ON test_ts;
GRANT CONNECT, CREATE TABLE TO test_user;

CONN test_user/test_user

CREATE TABLE test_tab (
  id    NUMBER,
  data  VARCHAR2(4000),
  CONSTRAINT test_tab_pk PRIMARY KEY (id)
);
登录后复制
登录后复制

Then, as the test user, I ran the following code several times and calculated an average time for each operation.

SET SERVEROUTPUT ON
DECLARE
  l_loops NUMBER := 1000;
  l_data  VARCHAR2(32767) := RPAD('X', 4000, 'X');
  l_start NUMBER;
BEGIN
  l_start := DBMS_UTILITY.get_time;

  FOR i IN 1 .. l_loops LOOP
    INSERT INTO test_tab (id, data) VALUES (i, l_data);
    COMMIT;
  END LOOP;

  DBMS_OUTPUT.put_line('Inserts (' || l_loops || '): ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

  l_start := DBMS_UTILITY.get_time;

  FOR i IN 1 .. l_loops LOOP
    UPDATE test_tab
    SET    data = l_data
    WHERE  id   = i;
    COMMIT;
  END LOOP;

  DBMS_OUTPUT.put_line('Updates (' || l_loops || '): ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

  l_start := DBMS_UTILITY.get_time;

  FOR i IN 1 .. l_loops LOOP
    DELETE FROM test_tab
    WHERE  id = i;
    COMMIT;
  END LOOP;

  DBMS_OUTPUT.put_line('Deletes (' || l_loops || '): ' || (DBMS_UTILITY.get_time - l_start) || ' hsecs');

  EXECUTE IMMEDIATE 'TRUNCATE TABLE test_tab';
END;
/
登录后复制
登录后复制

The code is purposely inefficient, using a single statement and a commit within a loop for each operation. Remember, the ASM instance is using high redundancy, so each physical write operation is effectively done 3 times.

Once the tests on ASMLib were complete, I switched to using raw devices and repeated the tests. The average results for 1000 of each operation are listed below.

Operation       ASMLib (hsecs)  Raw Devices (hsecs)
==============  ==============  ===================
Inserts (1000)             468                  852
Updates (1000)             956                 1287
Deletes (1000)            1281                 1995
登录后复制
登录后复制

You can instantly see that the ASMLib results are better than those of the raw devices, but the testing is suspect for the following reasons:

  • For each single run of the script, only 1000 operations of each type were performed. That equates to about 4M of data in the table when it is full. When you consider the use of the buffer cache, this is a pitiful amount of data. I originally intended to perform many more operations, but my disk was grinding so badly I thought better of it.
  • The tests were performed using VMware virtual disks, so really all this work was being done on a single SATA disk. I can't be sure if these results aren't just an artifact of the setup.
  • Although the average results look convincing, the raw data was so eratic I'm not convinced these results mean anything.

For these reasons, I decided not to continue to persue the performance tests, much to the delight of my hard drive. If I get access to a more realistic setup I will attempt some large scale tests and report the outcome.

For more information see:

  • Installing ASMLib
  • Migrating Raw Devices to ASMLib
  • Automatic Storage Management (ASM) in Oracle Database 10g
  • Oracle Database 10g Release 2 (10.2.0.1) RAC Installation On Linux (CentOS 4) Using VMware Server
  • Configuring I/O for Raw Partitions

Hope this helps. Regards Tim...

Back to the Top.

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 个月前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳图形设置
1 个月前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您听不到任何人,如何修复音频
1 个月前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.聊天命令以及如何使用它们
1 个月前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

chkdsk无法供raw驱动器使用怎么办 chkdsk无法供raw驱动器使用怎么办 Mar 06, 2023 pm 03:27 PM

chkdsk无法供raw驱动器使用的解决办法:1、右键底部任务栏Win图标,在弹出的菜单栏中点击“运行”选项;2、在命令行窗口输入“chkdsk /?”,然后点击回车键确定;3、等待chkdsk工具成功运行即可。

linux raw是什么格式 linux raw是什么格式 Mar 14, 2023 am 09:33 AM

linux raw是原始数据格式,在linux中表示“裸设备”,也叫裸分区、原始分区;linux raw是一种没有经过格式化,不被Unix/Linux通过文件系统来读取的特殊字符设备;裸设备可以绑定一个分区,也可以绑定一个磁盘。

raw是什么格式 raw是什么格式 Feb 01, 2023 pm 01:43 PM

RAW是未经处理、也未经压缩的格式,可以把RAW概念化为“原始图像编码数据”或更形象的称为“数字底片”。RAW格式文件是一种记录了数码相机传感器的原始信息,同时记录了由相机拍摄所产生的一些元数据(Metadata,如ISO的设置、快门速度、光圈值、白平衡等)的文件。

SQL语句中的AND运算符和OR运算符怎么用 SQL语句中的AND运算符和OR运算符怎么用 May 28, 2023 pm 04:34 PM

SQLAND&OR运算符AND和OR运算符用于基于一个以上的条件对记录进行过滤。AND和OR可在WHERE子语句中把两个或多个条件结合起来。如果第一个条件和第二个条件都成立,则AND运算符显示一条记录。如果第一个条件和第二个条件中只要有一个成立,则OR运算符显示一条记录。"Persons"表:LastNameFirstNameAddressCityAdamsJohnOxfordStreetLondonBushGeorgeFifthAvenueNewYorkCarter

raw照片是什么意思 raw照片是什么意思 Jan 12, 2021 am 11:05 AM

raw照片是指未经处理、也未经压缩的照片格式;因为raw的原意就是“未经加工”,可以理解为“RAW图像就是CMOS或者CCD图像感应器将捕捉到的光源信号转化为数字信号的原始数据”。

raw格式和jpg格式有什么区别 raw格式和jpg格式有什么区别 Aug 10, 2023 pm 03:31 PM

raw格式和jpg格式区别有:1、JPEG是一种被广泛使用的有损压缩格式,而RAW格式是一种无损的图像格式;2、JPEG格式的图像文件小巧,而RAW格式的文件较大;3、JPEG格式的图像只能进行有限的后期处理,而RAW格式的图像保留了更多的细节和色彩信息,使您能够在后期处理中做出更多的调整。

高精度低成本游戏3D人脸重建方案,腾讯AI Lab ICCV 2023论文解读 高精度低成本游戏3D人脸重建方案,腾讯AI Lab ICCV 2023论文解读 Oct 27, 2023 pm 12:13 PM

3D人脸重建是一项广泛应用于游戏影视制作、数字人、AR/VR、人脸识别和编辑等领域的关键技术,其目标是从单张或多张图像中获取高质量的3D人脸模型。借助摄影棚中的复杂拍摄系统,当前业界成熟方案已可得到媲美真人的毛孔级精度的重建效果[2],但其制作成本高、周期长,一般仅用于S级影视或游戏项目。近年,基于低成本人脸重建技术的交互玩法(如游戏角色捏脸玩法、AR/VR虚拟形象生成等)受到市场欢迎。用户只需输入日常可获取的图片,如手机拍摄的单张或多张图片,即可快速得到3D模型。但现有方法成像质量不可控,重建

Java ASM使用logback日志级别动态切换方法 Java ASM使用logback日志级别动态切换方法 May 09, 2023 pm 01:25 PM

背景一切皆有因果,所有事情,都有事件驱动。本方案的日志级别切换是由这样的背景下产生的:单个生产环境上,有几百近千个微服务日志级别切换不重启服务,要求即时生效果由业务开发人员去修改代码或增加相关依赖配置等涉及面广,推动进度慢后期动态实时过滤垃圾日志,减少io和磁盘空间成本logback简介在跟敌人发起战争之前,只有先发解敌方的情况,才能做到百战百胜。要想对logback的日志级别做动态切换,首先至少对logback做个初步的了解、和看看它有没有提供现成的实现方案。下面简单介绍一下logback跟这

See all articles