Windows XP环境配置ASM环境


转自:http://www.365testing.com/bbs/thread-15868-1-1.html

以前一直想在本机(Windows XP)环境配置ASM环境,可是总是在磁盘组配置时无法选择磁盘。由于ASM需要磁盘组或者多块磁盘,而我们一般的机器都只有一块硬盘,所以一直无法测试。今天老师讲了Windows环境下ASM磁盘虚拟工具ASMTOOL,现在决定测试一下:
1.创建虚拟磁盘:
    asmtool 是ORACLE for 10g windows的一个自带工具,位于ORACLE_HOME\bin目录下。
C:\Documents and Settings\Kugooo>asmtool -create D:\oracle\product\10.2.0\+ASM\asmdisk1 500
C:\Documents and Settings\Kugooo>asmtool -create D:\oracle\product\10.2.0\+ASM\asmdisk2 500
C:\Documents and Settings\Kugooo>asmtool -create D:\oracle\product\10.2.0\+ASM\asmdisk3 500
C:\Documents and Settings\Kugooo>asmtool -create D:\oracle\product\10.2.0\+ASM\asmdisk4 500
2. 配置CSS(Cluster Synchronization Services)
    CSS主要用来同步ASM instance和它的client,也即database instance。可以由Oracle自带的localconfig命令来完成。Localconfig命令也位于ORACLE_HOME\bin目录下。
D:\oracle\product\10.2.0\db_1\BIN>localconfig add
Step 1:  creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'kugooo', privgrp ''..
Operation successful.
Step 2:  creating new CSS service
successfully created local CSS service
successfully added CSS to home
    检查CSS daemon状态:
D:\oracle\product\10.2.0\db_1\BIN>crsctl check cssd
CSS appears healthy
“CSS appears healthy”表明该进程正在运行.
3. 创建ASM Instance的initial文件
    ASM Instance有自己的初始参数文件,可以为spfile或者文本文件。通过在文件名中嵌入SID,来区分ASM Instance和Database Instance。
*._asm_allow_only_raw_disks=FALSE
*.asm_diskstring='D:\oracle\product\10.2.0\+ASM\*'
*.background_dump_dest='d:\oracle\product\10.2.0\admin\+ASM\bdump'
*.core_dump_dest='d:\oracle\product\10.2.0\admin\+ASM\cdump'
*.instance_type='ASM'
*.large_pool_size=12M
*.remote_login_passwordfile='SHARED'
*.user_dump_dest='d:\oracle\product\10.2.0\admin\+ASM\udump'
此处"_asm_allow_only_raw_disks"为隐含参数,设为FALSE是为了允许ASM使用非裸设备,为必设项!
4. 用oradim创建Oracle ASM实例
D:\oracle\product\10.2.0\db_1\BIN>oradim -new -asmsid +ASM -STARTMODE auto
实例已创建。
5.连接到ASM Instance
D:\oracle\product\10.2.0\db_1\BIN>set ORACLE_SID=+ASM
D:\oracle\product\10.2.0\db_1\BIN>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 11月 27 21:27:46 2008
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> set linesize 1000
SQL> show parameter instance_type
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_type                        string                 ASM
SQL> select status from v$instance;
STATUS
------------------------
STARTED
6. 创建磁盘组
SQL> col path for a50
SQL> col mount_status for a30
SQL> select path,mount_status from v$asm_disk;
PATH                                               MOUNT_STATUS
-------------------------------------------------- ------------------------------
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK1             CLOSED
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK4             CLOSED
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK3             CLOSED
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK2             CLOSED
    MOUNT_STATUS为"CLOSED",因为磁盘组还没创建。下面创建磁盘组:
SQL> create diskgroup dgroup1 normal redundancy disk
  2  'D:\ORACLE\PRODUCT\10.2.0\+ASM\asmdisk1',
  3  'D:\ORACLE\PRODUCT\10.2.0\+ASM\asmdisk2',
  4  'D:\ORACLE\PRODUCT\10.2.0\+ASM\asmdisk3',
  5  'D:\ORACLE\PRODUCT\10.2.0\+ASM\asmdisk4';
磁盘组已创建。
SQL> select path,mount_status from v$asm_disk;
PATH                                               MOUNT_STATUS
-------------------------------------------------- ------------------------------
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK1             CACHED
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK2             CACHED
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK3             CACHED
D:\ORACLE\PRODUCT\10.2.0\+ASM\ASMDISK4             CACHED
    再检查磁盘状态,MOUNT_STATUS变成"CACHED",表示磁盘已经成为磁盘组的一部分,并且正在被ASM Instance访问。
关闭ASM Instance,在init+ASM.ora中加入参数 ASM_DISKGROUPS='DGROUP1',并创建spfile。
SQL> shutdown immediate
ASM 磁盘组已卸装
ASM 实例已关闭
SQL> create spfile from pfile='D:\oracle\product\10.2.0\db_1\database\INIT+asm.ORA';
文件已创建。
SQL> startup
ASM 实例已启动
Total System Global Area   83886080 bytes
Fixed Size                  1247420 bytes
Variable Size              57472836 bytes
ASM Cache                  25165824 bytes
ASM 磁盘组已装载
SQL> show parameter spfile
NAME              TYPE                   VALUE
---------------- ---------------------- ------------------------------
spfile              string                 D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SPFILE+ASM.ORA
    这样我们就建成了ASM Instance和Disk Group,并将ASM的initial文件转成spfile。

你可能感兴趣的:(windows)