天天看點

Linux RH5平台下使用Oracle ASM建立資料庫

作業系統: linux 5.4

實驗目标

Linux RH5平台下使用Oracle ASM建立資料庫

實驗步驟

1.安裝oracleasm支援包

建立asm資料庫,首先需要ASMLib驅動程式包,可以從相關的網站下載下傳到和作業系統對應的rpm檔案,分别為oracleasm-support-2.0.3-1、oracleasm-2.6.18-8.el5-2.0.4-1.el5、oracleasmlib-2.0.3-1.el5。

# rpm -Uvh oracleasm*.rpm

# rpm -qa|grep oracleasm

oracleasm-support-2.0.3-1

oracleasm-2.6.18-8.el5-2.0.4-1.el5

oracleasmlib-2.0.3-1.el5

2.添加磁盤

關閉VMware,添加一塊磁盤并格式化。

# fdisk /dev/sdb

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 1044.

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-1044, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044):

Using default value 1044

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@server oracleasmlib]# fdisk -l

Disk /dev/sda: 17.1 GB, 17179869184 bytes

255 heads, 63 sectors/track, 2088 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 2088 16667437+ 8e Linux LVM

Disk /dev/sdb: 8589 MB, 8589934592 bytes

255 heads, 63 sectors/track, 1044 cylinders

/dev/sdb1 1 1044 8385898+ 83 Linux

3.啟動rawdevices

# start_udev

Starting udev: [ OK ]

4.配置oracleasm

以root使用者登陸,執行

# /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 [dba]:

Start Oracle ASM library driver on boot (y/n) [y]:

Fix permissions of Oracle ASM disks on boot (y/n) [y]:

Writing Oracle ASM library driver configuration: [ OK ]

Loading module "oracleasm": [ OK ]

Mounting ASMlib driver filesystem: [ OK ]

Scanning system for ASM disks:

[ OK ]

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

Marking disk "/dev/sdb1" as an ASM disk: [ OK ]

#

[root@server oracleasmlib]# /etc/init.d/oracleasm listdisks

VOL1

[root@server oracleasmlib]# /etc/init.d/oracleasm scandisks

二、建立ASM執行個體

1.建立初始化檔案

$ su – oracle

$ cd $ORACLE_HOME/dbs

$ vi init+ASM.ora

*.asm_diskstring='ORCL:VOL*'

*.background_dump_dest='/oracle/admin/+ASM/bdump'

*.core_dump_dest='/oracle/admin/+ASM/cdump'

*.instance_type='asm'

*.large_pool_size=12M

*.remote_login_passwordfile='SHARED'

*.user_dump_dest='/oracle/admin/+ASM/udump'

2.建立密碼檔案

$ orapwd file=orapw+ASM password=dba

3. 建立目錄結構

$ mkdir –p $ORALCE_BASE/admin/+ASM/udump

$ mkdir –p $ORALCE_BASE/admin/+ASM/bdump

$ mkdir –p $ORALCE_BASE/admin/+ASM/cdump

4. 啟動執行個體

$ export ORACLE_SID=+ASM

$ sqlplus / as sysdba

SQL> startup

ASM instance started

Total System Global Area 100663296 bytes

Fixed Size 777616 bytes

Variable Size 99885680 bytes

Database Buffers 0 bytes

Redo Buffers 0 bytes

ORA-15110: no diskgroups mounted

因為我們是首次啟動asm執行個體,還沒有建立diskgroup,是以顯示15110錯誤是正常的。

如果啟動執行個體的時候碰到如下報錯:

ORA-29701: unable to connect to Cluster Manager

那麼請檢查/etc/inittab 檔案,看看是否有下面這行

h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null

如果沒有請添加,如果被注釋了請取消注釋。

5.用dbca 建立執行個體資料 選擇asm安裝

途中需要執行這兩個腳本

使用root使用者來執行該腳本,分别執行/opt/app/oracle/oraInventory/orainstRoot.sh和/opt/app/oracle/product/10.2.0/db_1/root.sh

本文轉自東方之子736651CTO部落格,原文連結:http://blog.51cto.com/ecloud/1184003 ,如需轉載請自行聯系原作者