建立以下perl脚本创建个m的文件模拟块asm磁盘脚本保存为h:/asmdisktxt my $s= x **; open(DF>h:/asmdisks/_file_disk) || die Cannot create file $!n; open(DF>h:/asmdisks/_file_disk) || die Cannot create file $!n; open(DF>h:/asmdisks/_file_disk) || die Cannot create file $!n; open(DF>h:/asmdisks/_file_disk) || die Cannot create file $!n; for (my $i=; $i<; $i++) { print DF $s; print DF $s; print DF $s; print DF $s; } exit 运行刚才建立的perl脚本 C:/WINDOWS>perl h:/asmdisktxt 配置CSS服务asm在实际的工作中需要Oracle Cluster Synchronization Services在数据库和asm之间同步数据和消息所以在创建asm实例之前必须配置CSS服务 C:/WINDOWS>localconfig add Step : creating new OCR repository Successfully accumulated necessary OCR keys Creating OCR keys for user administrator privgrp Operation successful Step : creating new CSS service successfully created local CSS service successfully added CSS to home 创建asm实例的管理目录 %ORACLE_BASE%/admin/+asm/bdump %ORACLE_BASE%/admin/+asm/cdump %ORACLE_BASE%/admin/+asm/hdump %ORACLE_BASE%/admin/+asm/pfile %ORACLE_BASE%/admin/+asm/udump 建立asm实例的参数文件F:/oracle/product/admin/+asm/pfile/init+asmora由于是通过文件模拟磁盘需要用到asm的一个隐含参数_asm_allow_only_raw_disks默认情况下这个参数的值为true仅允许裸设备作为asm的磁盘;这里将该参数设置为false可以用文件模拟asm磁盘 _asm_allow_only_raw_disks=false asm_diskstring=h:/asmdisks/_file* background_dump_dest=F:/oracle/product/admin/+asm/bdump core_dump_dest=F:/oracle/product/admin/+asm/cdump user_dump_dest=F:/oracle/product/admin/+asm/udump instance_type=asm compatible= large_pool_size=M remote_login_passwordfile=exclusive 使用oradim创建asm实例windows下必须linux和unix下不需要 C:/WINDOWS>oradim new asmsid +asm Instance created 启动asm实例并创建asm实例的spfile C:/WINDOWS>set ORACLE_SID=+asm C:/WINDOWS>sqlplus /as sysdba SQL*Plus: Release Production on Sat Mar :: Copyright (c) Oracle All rights reserved Connected to an idle instance idle>startup nomount pfile=F:/oracle/product/admin/+asm/pfile/init+asmora asm instance started Total System Global Area bytes Fixed Size bytes Variable Size bytes asm Cache bytes idle>create spfile from pfile=F:/oracle/product/admin/+asm/pfile/init+asmora; File created 重启数据库实例在shutdown和startup时出现ORA和ORA是因为目前还没有创建diskgroup没有任何问题 idle>shut immediate ORA: invalid or missing diskgroup name asm instance shutdown idle>startup asm instance started Total System Global Area bytes Fixed Size bytes Variable Size bytes asm Cache bytes ORA: no diskgroups mounted 创建diskgroup假设DISKDISK在一个failgroupDISKDISK在另一个failgroup idle>create diskgroup test normal redundancy failgroup controller disk H:/asmDISKS/_FILE_DISKH:/asmDISKS/_FILE_DISK failgroup controller disk H:/asmDISKS/_FILE_DISKH:/asmDISKS/_FILE_DISK; Diskgroup created 从v$asm_disk视图查看asm disk的情况 idle>col group_number heading gNo for idle>col disk_number heading dNo for idle>col mount_status heading mstatus for a idle>col header_status heading hstatus for a idle>col path for a idle>SELECT group_number disk_number mount_status header_status state path from v$asm_disk; gNo dNo mstatu hstatus STATE PATH CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK 从v$asm_diskgroup视图查看asm diskgroup的情况 idle>select group_number name total_mb free_mb state type from v$asm_diskgroup; gNo NAME TOTAL_MB FREE_MB STATE TYPE TEST MOUNTED NORMAL asm实例创建成功以后可以再添加删除磁盘和磁盘组在通过DBCA创建数据库时就可以选择这里创建好的磁盘组做为存储选项了 |