`

How To Set Up Oracle ASM on Ubuntu Gutsy Gibbon

阅读更多

I’ve recently moved to Ubuntu Linux, and this post describes my attempt to play around with Oracle ASM on Ubuntu. For this demonstration, I used Oracle 11.1.0.6 on Gutsy Gibbon. I hope it will be useful to somebody out there.

Important Notice: What I describe below is among the worst thing you can ever do with ASM. You can use it to play around but never use it with anything other than test data. If you lose something because of me, you’ll be the only one to blame !

Question #1: How do you simulate a disk from a file?

(See here for more details.)

If you have a free partition or disk to be used as an ASM disk, just skip this step. If you don’t, you can create a file with the dd command and create a device that actually loops to the file with the losetup command.

Let’s assume you’ve created a directory named /asmdisks (and you have write access to it). Run the command below to create a file named disk1 that is 3GB in size:

$ dd if=/dev/zero of=/asmdisks/disk1 bs=1024k count=3072
3072+0 records in
3072+0 records out
3221225472 bytes (3.2 GB) copied, 80.9113 seconds, 39.8 MB/s

Once you’ve created the file, map it to a device named loopN in /dev. You can list the used loop devices with the losetup -a command.

Once you’ve made sure the one you plan to used is free, e.g. /dev/loop1, you can map the device to the file with the following commands (you have to be root) :

# losetup /dev/loop1 /asmdisks/disk1
# losetup -a
/dev/loop1: [0802]:7438407 (/asmdisks/disk1)

Question #2: How do you create an interface to the disk that is usable by ASM?

 

Actually, the preferred way to access a disk from ASM on Linux is ASMLib. To be fair, I must say I didn’t even give it a try. Of course, I’d be more than interested if anybody could make it work on Ubuntu. You’ll have to recompile the source code and I doubt I’ll be able to do it myself.

So you may think, why not use Raw Devices? Because you don’t need raw devices. You can just map the ASM disks to your disk/partition or loop devices.

So the only thing you need to do to start is change the ownership of the device so that ASM can access it in read/write mode as oracle:

# chown oracle:dba /dev/loop1
# ls -l /dev/loop1
brw-rw—- 1 oracle dba 7, 1 2008-02-06 23:32 /dev/loop1

If you have a real disk partition (e.g. /dev/sdb1):

# chown oracle:dba /dev/sdb1
# ls -l /dev/sdb1

Note 1:
I couldn’t manage to demonstrate 11g’s very cool offline ASM without ASMLib or raw devices. Nonetheless, I’ll describe how to set up raw devices on Gutsy later in this post.

Note 2:
If you want losetup run and ownership set up automatically at boot time, you’ll have to define the correct rules in /etc/udev/rules.d.

Question #3: How do you start up the Cluster Synchronization Service Daemon?

You may not have paid attention to it before, but ASM relies on the CSS Daemon. Who cares? I do, because CSSD relies on /etc/inittab to startup and there is no such a file in Ubuntu. Nevermind, run the setup script as root :

# /u01/app/oracle/product/11.1.0/db_1/bin/localconfig reset
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root’, privgrp ‘root’..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process…
Expecting the CRS daemons to be up within 600 seconds.

Once you get the message about the 600 seconds, hit CRTL+C to stop the script, and then run the command below to actually run the CSS Daemon:

# nohup /etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null &

Note 3: If you want the CSSD daemon to startup automatically, you’ll have to create a service in Ubuntu.

Question #4: How do you create the ASM instance, add a diskgroup, etc?

This is not really the subject of this post, but assuming you’ve already installed Oracle 11g accordingly to Augusto’s Installing Oracle 11g on Ubuntu Linux 7.10 (Gutsy Gibbon) and you’ve setup the PATH, ORACLE_HOME and ORACLE_BASE variables, you can do everything in one command:

$ dbca -silent -configureASM             \
       -asmSysPassword change_on_install \
       -diskString "/dev/loop*"          \
       -diskList /dev/loop1              \
       -diskGroupName DG1                \
       -redundancy EXTERNAL

Once that is done, you can connect to the ASM instance with SQL*Plus:

$ source oraenv
ORACLE_SID = [oracle] ?+ASM
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 is /u01/app/oracle
$ sqlplus / as sysdba
SQL> select NAME, TOTAL_MB
       from v$asm_diskgroup;

NAME TOTAL_MB
---- --------
DG1      3072

Or you can use ASMCMD as below:

$ source oraenv
ORACLE_SID = [oracle] ?+ASM
The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 is /u01/app/oracle
$ asmcmd
ASMCMD> ls
DG1/

Question #5: How do you create a database that uses ASM?

I cannot resist providing the syntax for 11g (totalMemory will have to be replaced by memoryPercentage in 10g):

$ dbca -silent -createDatabase              \
       -templateName General_Purpose.dbc    \
       -gdbName BLUJ                        \
       -sysPassword change_on_install       \
       -systemPassword manager              \
       -emConfiguration NONE                \
       -storageType ASM                     \
          -asmSysPassword change_on_install \
          -diskGroupName DG1                \
       -characterSet WE8ISO8859P15          \
       -totalMemory  250

ulimit: 1: Illegal option -u
ulimit: 1: Illegal option -u
ulimit: 1: Illegal option -u
ulimit: 1: Illegal option -u
Copying database files
1% complete
3% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
77% complete
88% complete
100% complete
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/BLUJ/BLUJ.log” for further details.

Question #2 (Revisited): How do you create an interface to the disk that is usable by ASM ?

For 11g ASM offline tests, raw devices can actually be useful. And, despite the missing pieces, creating a raw device that maps the loop device (or real disk/partition) is straightforward. The first step consists in filling the holes in Ubuntu, i.e. in creating some character files that are not created by default on Gutsy Gibbon (rawctl, raw0 . . . raw1).

Run the set of commands below as root:

# mknod /dev/rawctl c 162 0
# mknod /dev/raw/raw0 c 162 1
# mknod /dev/raw/raw1 c 162 2
# ln -s /dev/rawctl /dev/raw/rawctl

Once the missing pieces rebuilt, mapping a raw devices to your disk or loop interface is as easy as:

# raw /dev/raw/raw1 /dev/loop1

Or if you use a partition named /dev/sdb1:

# raw /dev/raw/raw1 /dev/sdb1

You can display the result of your settings with the command below.

# raw -qa
/dev/raw/raw1:  bound to major 7, minor 0

The raw devices won’t change anything but the path to the device when you’ll go from Question #3 to Question #5.

Note 4: If you want the raw devices to be setup automatically at boot time, you’ll have to define the correct rules in /etc/udev/rules.d.

Conclusion

What I really like about Oracle is that once you’ve done something, you have ten different ways to go. I hope this post will enable you to explore some 11g’s new features on your favorite operating system.

分享到:
评论

相关推荐

    redhat/centos6.9 kmod-oracleasm/oracleasm-support/oracleasm rpm包

    kmod-oracleasm-2.0.8-15.el6_9.x86_64 oracleasm-support-2.1.8-1.el6.x86_64 oracleasmlib-2.0.4-1.el6.x86_64 安装顺序: rpm -ivh kmod-oracleasm-2.0.8-15.el6_9.x86_64.rpm rpm -ivh oracleasm-support-2.1.8...

    各种oracleasm rpm包(Linux下配置ASM使用)

    包含如下oracleasm包: kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm oracleasm-2.0.8-4.el6_6.src.rpm oracleasm-2.0.8-6.el6_7.src.rpm oracleasm-2.0.8-8.el7.src.rpm oracleasm-2.0.8-15.el7.centos.src.rpm ...

    安装oracle ASM所需的系统包:oracleasmlib、oracleasm-support

    Oracle ASM(Automatic Storage Management)是Oracle数据库系统中用于管理存储的一种高效、集成的解决方案。它提供了自动化的磁盘管理和故障恢复功能,简化了数据库管理员的工作。在安装Oracle ASM之前,必须先安装...

    oracle-support oracleasmlib kmod-oracleasm包

    Oracle Support for Oracle ASM (Automatic Storage Management) 和 Kmod-OracleASM 包是Oracle数据库系统在Linux环境下进行存储管理的关键组件。这些包确保了在Red Hat Enterprise Linux (RHEL)、CentOS以及Oracle ...

    rh*-kmod-oracleasm

    Oracle ASM (Automatic Storage Management) 是 Oracle 公司推出的一种集成化的存储管理解决方案,它为数据库提供了高性能、高可用性和易于管理的存储环境。在Linux系统中,Oracle ASM 需要与特定的驱动程序协同工作...

    kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm和Oracleasmlib、Oracleasm-support

    Oracle ASM (Automatic Storage Management) 是 Oracle 公司提供的一种高效、自动化的磁盘管理解决方案,尤其在Oracle数据库环境中被广泛使用。它简化了存储管理,提供了高性能、高可用性和高可扩展性。Oracleasmlib...

    oracleasmlib以及 kmod-oracleasm驱动包

    Oracle ASM (Automatic Storage Management) 是 Oracle 公司提供的一种先进的存储管理解决方案,它为数据库和其他应用程序提供了统一的、高性能的磁盘管理功能。Oracle ASMLib(Oracle ASM Library)是与ASM配套使用...

    oracleasm oracle rac rpm包

    oracleasm-2.6.18-128.el5-2.0.5-1.el5.i686.rpm oracleasmlib-2.0.4-1.el5.i386.rpm oracleasm-support-2.1.1-1.el4.i386.rpm X64: oracleasm-support-2.1.8-1.el5.x86_64.rpm oracleasmlib-2.0.4-1.el5.x86_64....

    oracleasmlib和oracleasm-support两个依赖包.zip

    Oracle ASM (Automatic Storage Management) 是Oracle数据库管理系统中的一个组件,用于高效管理数据库的存储。它提供了集成的卷管理和文件系统,简化了存储管理和性能优化。在Oracle ASM环境中,Oracle ASMLib ...

    redhat6.5 oracle ASM驱动

    Oracle ASM(Automatic Storage Management)是Oracle数据库公司提供的一种先进的存储管理解决方案,专为Oracle数据库设计。它整合了文件系统和卷管理器的功能,为数据库提供高效、可靠的存储管理。在Red Hat ...

    oracleasm RPM包

    Oracle ASM(Automatic Storage Management)是Oracle数据库公司提供的一种高级存储管理解决方案,主要用于简化和优化Oracle数据库的存储管理。Oracle ASM可以自动地管理和分配磁盘空间,提供数据冗余和容错功能,...

    oracle-rac使用的asmlib的kmod-oracleasm*.RPM包集合 6.6-7.5全集

    kmod-oracleasm-*,oracleasmlib*,oracleasm-support*。 虽然现在oracle-rac基本上已经都是用UEDV的来固化UUID了但是有些同学还不太会,然后看的教程都是使用asmlib来制作的,但是自己上机以后发现根本装不上啊,...

    oracleasm5,oracleasm6安装包

    oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm oracleasmlib-2.0.4-1.el5.x86_64.rpm oracleasm-support-2.1.7-1.el5.x86_64.rpm kmod-oracleasm-2.0.8-15.el6_9.x86_64.rpm oracleasmlib-2.0.4-1.el6.x86_64....

    kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm

    Oracle ASM(Automatic Storage Management)是Oracle数据库系统中的一个组件,用于提供高效、自动化的存储管理功能。在Linux环境中安装Oracle 11g数据库时,ASM是必不可少的一部分,它可以帮助管理员轻松管理和配置...

    kmod-oracleasm-2.0.6.rh1-2.el6.x86_64.rar

    Oracle ASM(Automatic Storage Management)是Oracle数据库公司提供的一种先进的存储管理解决方案,主要用于简化数据库和相关应用的数据存储。kmod-oracleasm是Oracle ASM在Linux操作系统上的内核模块,它允许系统...

    centos7.4-7.6 oracle asm安装包

    centos 7.4 asm安装包包括三个(kmod-oracleasm-2.0.8-19.0.1.el7.x86_64,oracleasmlib-2.0.12-1.el7.x86_64,oracleasm-support-2.1.8-3.el7.x86_64)

    kmod-oracleasm(centos6.4-6.9,centos7.1-7.6)下载

    Oracle ASM (Automatic Storage Management) 是Oracle数据库系统中的一个重要组件,用于提供高效、自动化的存储管理。kmod-oracleasm 是一个专门为CentOS操作系统编译的内核模块,它允许操作系统与Oracle ASM进行...

    oracle不使用oracleasm的包配置ASM磁盘配置方法

    ### Oracle 不使用 OracleASM 的包配置 ASM 磁盘配置方法 #### 概述 在 Oracle 数据库系统中,自动存储管理(ASM)是用于管理数据库文件的一种高性能、高可用性的解决方案。通常情况下,ASM 依赖于 Oracle 提供的 ...

    oracleasm资源包

    Oracle ASM(Automatic Storage Management)是Oracle数据库公司提供的一种先进的存储管理解决方案,专为Oracle数据库设计。它简化了存储管理,提供了高性能、高可用性和高扩展性。在Oracle RAC(Real Application ...

Global site tag (gtag.js) - Google Analytics