您好,欢迎访问一九零五行业门户网

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

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 devicesintroductionpartition the disksasmlib installationraw device setupasm creationdatabase creationswitching from raw devices to asmlibswitching from asmlib to raw devicesperformance comparisonrelated articles.
automatic storage management (asm) in oracle database 10gusing nfs with asmautomatic storage manager (asm) enhancements in oracle database 11g release 1udev scsi rules configuration for asm in oracle linux 5 and 6introductionautomatic 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 disksboth 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/sdbdevice contains neither a valid dos partition table, nor sun, sgi or osf disklabelbuilding a new dos disklabel. changes will remain in memory only,until you decide to write them. after that, of course, the previouscontent 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): ncommand action e extended p primary partition (1-4)ppartition number (1-4): 1first cylinder (1-1305, default 1):using default value 1last cylinder or +size or +sizem or +sizek (1-1305, default 1305):using default value 1305command (m for help): wthe 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 installationthis 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 -r2.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.rpmoracleasmlib-2.0.1-1.i386.rpmoracleasm-2.6.9-34.elsmp-2.0.1-1.i686.rpminstall 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.rpmpreparing... ########################################### [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 configureconfiguring the oracle asm library driver.this will configure the on-boot properties of the oracle asm librarydriver. the following questions will determine whether the driver isloaded on boot and what permissions it will have. the current valueswill be shown in brackets ('[]'). hitting without typing ananswer will keep that current value. ctrl-c will abort.default user to own the driver interface []: oracledefault group to own the driver interface []: oinstallstart oracle asm library driver on boot (y/n) [n]: yfix 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 ]#

once the kernel module is loaded, stamp (or label) the partitions created earlier as asm disks.
# /etc/init.d/oracleasm createdisk vol1 /dev/sdb1marking disk /dev/sdb1 as an asm disk: [ ok ]# /etc/init.d/oracleasm createdisk vol2 /dev/sdc1marking disk /dev/sdc1 as an asm disk: [ ok ]# /etc/init.d/oracleasm createdisk vol3 /dev/sdd1marking 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 scandisksscanning system for asm disks: [ ok ]#

the stamped disks are listed as follows.
# /etc/init.d/oracleasm listdisksvol1vol2vol3#

the disks are now ready to be used by asm.
raw device setupthis 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/raw1chown oracle:oinstall /dev/raw/raw2chown oracle:oinstall /dev/raw/raw3chmod 600 /dev/raw/raw1chmod 600 /dev/raw/raw2chmod 600 /dev/raw/raw3

the asm raw device disks are now configured.
asm creationcreation 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.
select the configure automatic storage management option, then click the next button.
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.
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 initializedadding to inittabstartup 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. centos2css 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.
on the confirmation screen, click the ok button.
wait while the asm instance is created.
once the asm instance is created, you are presented with the asm disk groups screen. click the create new button.
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.
when using raw devices, the candidate discs are listed using the devide names.
on the asm disk groups screen. click the finish button.
click the yes button to perform another operation.
you are now ready to create a database instance using asm.
database creationbefore 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 startlsnrctl for linux: version 10.2.0.1.0 - production on 29-apr-2006 14:35:46copyright (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 - productionlog messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener .loglistening on: (description=(address=(protocol=tcp)(host=centos2.localdomain)(por t=1521)))connecting to (address=(protocol=tcp)(host=)(port=1521))status of the listener------------------------alias listenerversion tnslsnr for linux: version 10.2.0.1.0 - productionstart date 29-apr-2006 14:35:47uptime 0 days 0 hr. 0 min. 0 sectrace level offsecurity on: local os authenticationsnmp offlistener log file /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.loglistening endpoints summary... (description=(address=(protocol=tcp)(host=centos2.localdomain)(port=1521)))the listener supports no servicesthe 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 sysdbasql*plus: release 10.2.0.1.0 - production on sat apr 29 14:37:06 2006copyright (c) 1982, 2005, oracle. all rights reserved.connected to:oracle database 10g enterprise edition release 10.2.0.1.0 - productionwith the partitioning, olap and data mining optionssql> alter system register;system altered.sql> exitdisconnected from oracle database 10g enterprise edition release 10.2.0.1.0 - pr oductionwith the partitioning, olap and data mining options$

checking the status of the listener shows that the asm instance is now registered.
$ lsnrctl statuslsnrctl for linux: version 10.2.0.1.0 - production on 29-apr-2006 14:37:32copyright (c) 1991, 2005, oracle. all rights reserved.connecting to (address=(protocol=tcp)(host=)(port=1521))status of the listener------------------------alias listenerversion tnslsnr for linux: version 10.2.0.1.0 - productionstart date 29-apr-2006 14:35:47uptime 0 days 0 hr. 1 min. 46 sectrace level offsecurity on: local os authenticationsnmp offlistener log file /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.loglistening 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.
enter the asm password if prompted, then click the ok button.
select the data disk group, then clicking the next button.
accept the default oracle-managed files database location by clicking the next button.
enable the flash recovery area and archiving, using the +data disk group for both.
continue with the rest of the dbca, selecting the required options along the way.
switching from raw devices to asmlibshutdown 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 dismountedasm instance shutdownsql>

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 vol1renaming disk /dev/sdb1 to vol1: [ ok ]# /etc/init.d/oracleasm renamedisk /dev/sdc1 vol2renaming disk /dev/sdc1 to vol2: [ ok ]# /etc/init.d/oracleasm renamedisk /dev/sdd1 vol3renaming disk /dev/sdd1 to vol3: [ ok ]#

notice, the stamp matches the discovery string set earlier. the asm instance can now be started.
sql> startupasm instance startedtotal system global area 83886080 bytesfixed size 1217836 bytesvariable size 57502420 bytesasm cache 25165824 bytesasm diskgroups mountedsql>



the asm instance is now using asmlib, rather than raw devices. all dependent databases can now be started.
switching from asmlib to raw devicesshutdown 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 dismountedasm instance shutdownsql>

perform all the steps listed in the raw device setup, then start the asm instance.
sql> startupasm instance startedtotal system global area 83886080 bytesfixed size 1217836 bytesvariable size 57502420 bytesasm cache 25165824 bytesasm diskgroups mountedsql>



the asm instance is now using the disks as raw devices, rather than as asmlib disks. all dependent databases can now be started.
performance comparisonsome 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=db10gsqlplus / as sysdbacreate 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_usercreate 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 ondeclare 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 852updates (1000) 956 1287deletes (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 asmlibmigrating raw devices to asmlibautomatic storage management (asm) in oracle database 10goracle database 10g release 2 (10.2.0.1) rac installation on linux (centos 4) using vmware serverconfiguring i/o for raw partitionshope this helps. regards tim...
back to the top.
introductionpartition the disksasmlib installationraw device setupasm creationdatabase creationswitching from raw devices to asmlibswitching from asmlib to raw devicesperformance comparisonrelated articles.
automatic storage management (asm) in oracle database 10gusing nfs with asmautomatic storage manager (asm) enhancements in oracle database 11g release 1udev scsi rules configuration for asm in oracle linux 5 and 6introductionautomatic 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 disksboth 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/sdbdevice contains neither a valid dos partition table, nor sun, sgi or osf disklabelbuilding a new dos disklabel. changes will remain in memory only,until you decide to write them. after that, of course, the previouscontent 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): ncommand action e extended p primary partition (1-4)ppartition number (1-4): 1first cylinder (1-1305, default 1):using default value 1last cylinder or +size or +sizem or +sizek (1-1305, default 1305):using default value 1305command (m for help): wthe 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 installationthis 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 -r2.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.rpmoracleasmlib-2.0.1-1.i386.rpmoracleasm-2.6.9-34.elsmp-2.0.1-1.i686.rpminstall 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.rpmpreparing... ########################################### [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 configureconfiguring the oracle asm library driver.this will configure the on-boot properties of the oracle asm librarydriver. the following questions will determine whether the driver isloaded on boot and what permissions it will have. the current valueswill be shown in brackets ('[]'). hitting without typing ananswer will keep that current value. ctrl-c will abort.default user to own the driver interface []: oracledefault group to own the driver interface []: oinstallstart oracle asm library driver on boot (y/n) [n]: yfix 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 ]#

once the kernel module is loaded, stamp (or label) the partitions created earlier as asm disks.
# /etc/init.d/oracleasm createdisk vol1 /dev/sdb1marking disk /dev/sdb1 as an asm disk: [ ok ]# /etc/init.d/oracleasm createdisk vol2 /dev/sdc1marking disk /dev/sdc1 as an asm disk: [ ok ]# /etc/init.d/oracleasm createdisk vol3 /dev/sdd1marking 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 scandisksscanning system for asm disks: [ ok ]#

the stamped disks are listed as follows.
# /etc/init.d/oracleasm listdisksvol1vol2vol3#

the disks are now ready to be used by asm.
raw device setupthis 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/raw1chown oracle:oinstall /dev/raw/raw2chown oracle:oinstall /dev/raw/raw3chmod 600 /dev/raw/raw1chmod 600 /dev/raw/raw2chmod 600 /dev/raw/raw3

the asm raw device disks are now configured.
asm creationcreation 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.
select the configure automatic storage management option, then click the next button.
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.
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 initializedadding to inittabstartup 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. centos2css 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.
on the confirmation screen, click the ok button.
wait while the asm instance is created.
once the asm instance is created, you are presented with the asm disk groups screen. click the create new button.
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.
when using raw devices, the candidate discs are listed using the devide names.
on the asm disk groups screen. click the finish button.
click the yes button to perform another operation.
you are now ready to create a database instance using asm.
database creationbefore 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 startlsnrctl for linux: version 10.2.0.1.0 - production on 29-apr-2006 14:35:46copyright (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 - productionlog messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener .loglistening on: (description=(address=(protocol=tcp)(host=centos2.localdomain)(por t=1521)))connecting to (address=(protocol=tcp)(host=)(port=1521))status of the listener------------------------alias listenerversion tnslsnr for linux: version 10.2.0.1.0 - productionstart date 29-apr-2006 14:35:47uptime 0 days 0 hr. 0 min. 0 sectrace level offsecurity on: local os authenticationsnmp offlistener log file /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.loglistening endpoints summary... (description=(address=(protocol=tcp)(host=centos2.localdomain)(port=1521)))the listener supports no servicesthe 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 sysdbasql*plus: release 10.2.0.1.0 - production on sat apr 29 14:37:06 2006copyright (c) 1982, 2005, oracle. all rights reserved.connected to:oracle database 10g enterprise edition release 10.2.0.1.0 - productionwith the partitioning, olap and data mining optionssql> alter system register;system altered.sql> exitdisconnected from oracle database 10g enterprise edition release 10.2.0.1.0 - pr oductionwith the partitioning, olap and data mining options$

checking the status of the listener shows that the asm instance is now registered.
$ lsnrctl statuslsnrctl for linux: version 10.2.0.1.0 - production on 29-apr-2006 14:37:32copyright (c) 1991, 2005, oracle. all rights reserved.connecting to (address=(protocol=tcp)(host=)(port=1521))status of the listener------------------------alias listenerversion tnslsnr for linux: version 10.2.0.1.0 - productionstart date 29-apr-2006 14:35:47uptime 0 days 0 hr. 1 min. 46 sectrace level offsecurity on: local os authenticationsnmp offlistener log file /u01/app/oracle/product/10.2.0/db_1/network/log/listen er.loglistening 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.
enter the asm password if prompted, then click the ok button.
select the data disk group, then clicking the next button.
accept the default oracle-managed files database location by clicking the next button.
enable the flash recovery area and archiving, using the +data disk group for both.
continue with the rest of the dbca, selecting the required options along the way.
switching from raw devices to asmlibshutdown 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 dismountedasm instance shutdownsql>

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 vol1renaming disk /dev/sdb1 to vol1: [ ok ]# /etc/init.d/oracleasm renamedisk /dev/sdc1 vol2renaming disk /dev/sdc1 to vol2: [ ok ]# /etc/init.d/oracleasm renamedisk /dev/sdd1 vol3renaming disk /dev/sdd1 to vol3: [ ok ]#

notice, the stamp matches the discovery string set earlier. the asm instance can now be started.
sql> startupasm instance startedtotal system global area 83886080 bytesfixed size 1217836 bytesvariable size 57502420 bytesasm cache 25165824 bytesasm diskgroups mountedsql>



the asm instance is now using asmlib, rather than raw devices. all dependent databases can now be started.
switching from asmlib to raw devicesshutdown 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 dismountedasm instance shutdownsql>

perform all the steps listed in the raw device setup, then start the asm instance.
sql> startupasm instance startedtotal system global area 83886080 bytesfixed size 1217836 bytesvariable size 57502420 bytesasm cache 25165824 bytesasm diskgroups mountedsql>



the asm instance is now using the disks as raw devices, rather than as asmlib disks. all dependent databases can now be started.
performance comparisonsome 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=db10gsqlplus / as sysdbacreate 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_usercreate 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 ondeclare 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 852updates (1000) 956 1287deletes (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 asmlibmigrating raw devices to asmlibautomatic storage management (asm) in oracle database 10goracle database 10g release 2 (10.2.0.1) rac installation on linux (centos 4) using vmware serverconfiguring i/o for raw partitionshope this helps. regards tim...
back to the top.
其它类似信息

推荐信息