分类: Oracle
2010-11-05 15:05:51
Ø
测试环境
VMWare WorkStation 6 + RedFlag DC Server 5.0 sp3 + Oracle 10g 10.2.0.1
Ø
前期准备
VMWare WorkStation 6中配置试验主机环境,除缺省配置外,另外增加4块虚拟硬盘用于ASM测试使用
安装RedFlag DC Server 5.0 sp3到虚拟主机,仅使用默认虚拟盘安装系统
使用oranavi工具安装oracle 10g DBMS到系统所在硬盘
以上两步基本不存在问题。
下面,开始着重介绍oracle asm的安装与配置:
本试验所使用的操作系统,在安装完成后已集成了oracle asm驱动、运行库及支持文件,不需要另行安装,可以直接进入配置环节。
Ø 配置ASMLib
# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded
on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer
will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n)
[y]: y
Writing
Oracle ASM library driver configuration [ OK ]
Creating
/dev/oracleasm mount
point [ OK ]
Loading
module
"oracleasm" [ OK ]
Mounting
ASMlib driver
filesystem [ OK ]
Scanning
system for ASM
disks [ OK ]
以上操作将加载oracleasm.o驱动,并且mount上ASM文件系统,同时我们可以通过以下命令来手工的卸载和加载ASMLib
# /etc/init.d/oracleasm disable
Writing
Oracle ASM library driver
configuration [ OK ]
Unmounting
ASMlib driver
filesystem [ OK ]
Unloading
module
"oracleasm" [ OK ]
# /etc/init.d/oracleasm enable
Writing
Oracle ASM library driver
configuration [ OK ]
Loading
module "oracleasm" [ OK ]
Mounting
ASMlib driver
filesystem [ OK ]
Scanning
system for ASM
disks [ OK ]
如果当前操作系统的内核和编译ASMLib的内核不同,那么上面的操作将会出错,请检查/var/log/messages文件,确认需要更新的系统内核版本。
Ø 添加init文件使系统启动时自动加载ASMLib
$ su –
# cd
/etc/rc5.d
# ln -s ../init.d/oracleasm
S99oracleasm
# cd /etc/rc0.d
# ln -s ../init.d/oracleasm
K01oracleasm
注意:文字几面与图形界面对应的目录分别是:/etc/rc2.d和
/etc/rc5.d;关机与重启对应的目录分别是:/etc/rc0.d和 /etc/rc6.d。注意目录的切换。
重新启动系统,确认ASMLib已经可以自动加载
#lsmod | grep oracleasm
oracleasm 14224 1
#dmesg | grep oracleasm
ASM: oracleasmfs mounted with options:
Ø 创建ASM磁盘
# /etc/init.d/oracleasm createdisk
VOL1 /dev/sdb
Marking
disk "/dev/sdb" as an ASM disk: asmtool: Device "/dev/sdb"
is not a partition [FAILED]
此处出现错误,原因是由于我们还没有对/dev/sdb这个设备文件所加载的磁盘进行分区,而且sdb也不是一个partition,因此我们先对sdb磁盘进行分区。
#
fdisk sdb
Device contains neither a
valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel.
Changes will remain in memory only,
until you decide to write
them. After that, of course, the previous
content won't be
recoverable.
Warning: invalid flag
0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
a
toggle a bootable flag
b
edit bsd disklabel
c
toggle the dos compatibility flag
d
delete a partition
l
list known partition types
m
print this menu
n
add a new partition
o
create a new empty DOS partition table
p
print the partition table
q
quit without saving changes
s
create a new empty Sun disklabel
t
change a partition's system id
u
change display/entry units
v
verify the partition table
w
write table to disk and exit
x
extra functionality (experts only)
Command (m for help): n
Command action
e
extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for
help):w
The partition table has
been altered!
Calling ioctl() to re-read
partition table.
Syncing disks.
这个时候系统中会出现一个sdb1这个设备文件。之后我们继续对sdc,sdd,sde以上面同样的方法来进行分区。
Ø 重新创建ASM磁盘
# /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 ]
# /etc/init.d/oracleasm createdisk
VOL4 /dev/sde1
Marking disk "/dev/sde1" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
如果要删除ASM磁盘通过以下命令:
#
/etc/init.d/oracleasm deletedisk VOL4
Removing ASM disk
"VOL4" [ OK ]
注意:如果是在RAC环境中的某一个节点中添加了ASM磁盘,那么需要在其它的节点上运行scandisk来获取这种变化。
#
/etc/init.d/oracleasm scandisks
Scanning
system for ASM disks [ OK ]
经过上述步骤,便安装好了ASMLib,且将磁盘标记为可用。
Ø 创建ASM实例,并构建一个使用ASM进行磁盘存储的数据库(最容易的方式—使用DBCA工具)
以 oracle 身份登录并启动 DBCA:
$ dbca
1.
欢迎
o
单击 Next。
2.
操作
o
选择 Create a Database。
3.
数据库模板
o
选择 General Purpose。
4.
数据库标识
o
输入全局数据库名称。
5.
管理选项
o
选择 Configure the Database with
Enterprise Manager。
o
选择 Use Database Control for Database
Management。
6.
数据库证书
o
选择 Use Same Password for All Accounts。
o
输入口令并确认。
7.
存储选项
o
选择 Automatic Storage Management (ASM)。
*注意,此步后需要先执行一个脚本启动Oracle的CSS(Cluster Synchronization Service)服务。
8.
创建 ASM 实例
o
输入 ASM 实例的口令并确认。
9.
弹出一个窗口,提示 DBCA 将立即创建并启动 ASM 实例。
o
单击 OK。
10. 创建 ASM 实例时弹出一个带齿轮箱窗口。
11. ASM 磁盘组
o
由于这是新 ASM 实例且您尚未创建任何 ASM 实例,因此该窗口未显示可用磁盘组。
o
单击 Create New。
12. 创建磁盘组
o
磁盘组名称
- 输入磁盘组名称,如 DATA1。
o
冗余
- High 镜像数据两次。
- Normal 镜像数据一次。
- External 不镜像 ASM 中的数据。如果外部 RAID 阵列提供冗余,则通常使用此选项。
o
选择成员磁盘
- 您必须手动指示 ASM 到什么地方查找 ASMLib 磁盘,因此,单击 Change Disk Discovery Path
- 弹出一个窗口,提示输入磁盘发现路径。如下所示将磁盘发现路径更改为“ORCL:*”。
- 单击 OK 继续。
o 您将返回到 Select Member Disks 窗口。您的所有 ASMLib 磁盘现在应显示在此窗口中。
单击该行开头的框,选择加入磁盘组的磁盘。完成后单击 OK。
13. ASM 磁盘组
o
您将返回到 ASM Disk Groups 窗口。此时,出现在上一步中创建的磁盘组。
o
单击该行开头的框选择此磁盘组。(在此实例中使用单个磁盘组。)
o
单击 Next。
14. 数据库文件位置
o
选择 Use Oracle-Managed Files。
o
确保已将 Database Area 设置为您创建的磁盘组。它包含一个前导加号 — 例如,+DATA1。
15. 恢复配置
o
选择 Specify Flash Recovery Area。
- 快速恢复区 — 输入要用于快速恢复的 ASM 磁盘组。
- 快速恢复区大小 — 接受默认值 2048。
o
如果要使用归档日志模式,则选中 Enable Archiving。对于评估数据库,可以不选该项。
16. 数据库内容
o
选择 Sample Schemas。
o
我们不使用定制脚本,因此单击 Next。
17. 初始化参数
o
接受默认值,然后单击 Next。
18. 数据库存储
o
接受默认值,然后单击 Next。
19. 创建选项
o
选择 Create Database(默认值)并单击 Finish。
20. 确认
o
检查完数据库详细信息后单击 OK。
21. DBCA 显示一个操作列表和一个进度条。根据硬件的不同,数据库创建可能需要几分钟到几小时的时间。
22. 当数据库创建完成时,将显示一个显示摘要窗口。记下 Enterprise Manager URL,然后单击 Exit。
Ø
参考资料
1.
chinaunix网友2010-11-05 16:56:24
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com