Chinaunix首页 | 论坛 | 博客
  • 博客访问: 624019
  • 博文数量: 825
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 4980
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-27 14:19
文章分类

全部博文(825)

文章存档

2011年(1)

2008年(824)

我的朋友

分类:

2008-10-27 14:28:34

    1、建立以下perl脚本,创建4个200m的文件模拟4块asm磁盘,脚本保存为h:/asmdisk.txt

   my $s='0' x 2**20;
  open(DF1,">h:/asmdisks/_file_disk1") || die "Cannot create file - $!n";
  open(DF2,">h:/asmdisks/_file_disk2") || die "Cannot create file - $!n";
  open(DF3,">h:/asmdisks/_file_disk3") || die "Cannot create file - $!n";
  open(DF4,">h:/asmdisks/_file_disk4") || die "Cannot create file - $!n";
  for (my $i=1; $i<200; $i++) {
  print DF1 $s;
  print DF2 $s;
  print DF3 $s;
  print DF4 $s;
  }
  exit

  2、运行刚才建立的perl脚本

  C:/WINDOWS>perl h:/asmdisk.txt


  3、配置服务。asm在实际的工作中需要 Cluster Synchronization Services在数据库和asm之间同步数据和消息,所以在创建asm实例之前,必须配置服务

   C:/WINDOWS>localconfig add
  Step 1: creating new OCR repository
  Successfully accumulated necessary OCR keys.
  Creating OCR keys for user 'administrator', privgrp ''..
  Operation successful.
  Step 2: creating new service
  successfully created local CSS service
  successfully added CSS to home

  4、创建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

    5、建立asm实例的参数文件F:/oracle/product/admin/+asm/pfile/init+asm.ora。由于是通过文件模拟磁盘,需要用到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=10.2.0.1.0
  large_pool_size=12M
  remote_login_passwordfile=exclusive

  6、使用oradim创建asm实例,windows下必须,和unix下不需要

  C:/WINDOWS>oradim -new -asmsid +asm

  Instance created..
  7、启动asm实例,并创建asm实例的spfile

   C:/WINDOWS>set ORACLE_SID=+asm
  C:/WINDOWS>sqlplus "/as sysdba"
  SQL*Plus: Release 10.2.0.1.0 - Production on Sat Mar 22 20:39:02 2008
  Copyright (c) 1982, 2005, . All rights reserved.
  Connected to an idle instance.
  idle>startup nomount pfile='F:/oracle/product/admin/+asm/pfile/init+asm.ora'
  asm instance started
  Total System Global Area 83886080 bytes
  Fixed Size 1247420 bytes
  Variable Size 57472836 bytes
  asm Cache 25165824 bytes
  idle>create spfile from pfile='F:/oracle/product/admin/+asm/pfile/init+asm.ora';
  File created.

  8、重启数据库实例,在shutdown和startup时出现ORA-15100和ORA-15110是因为目前还没有创建diskgroup,没有任何问题

   idle>shut immediate
  ORA-15100: invalid or missing diskgroup name
  asm instance shutdown
  idle>startup
  asm instance started
  Total System Global Area 83886080 bytes
  Fixed Size 1247420 bytes
  Variable Size 57472836 bytes
  asm Cache 25165824 bytes
  ORA-15110: no diskgroups mounted

    9、创建diskgroup,假设DISK1、DISK2在一个failgroup,DISK3、DISK4在另一个failgroup

   idle>create diskgroup test normal redundancy
  2 failgroup controller1 disk 'H:/asmDISKS/_FILE_DISK1','H:/asmDISKS/_FILE_DISK2'
  3 failgroup controller2 disk 'H:/asmDISKS/_FILE_DISK3','H:/asmDISKS/_FILE_DISK4';
  Diskgroup created.

  从v$asm_disk视图查看asm disk的情况

   idle>col group_number heading gNo for 99
  idle>col disk_number heading dNo for 99
  idle>col mount_status heading mstatus for a6
  idle>col header_status heading hstatus for a9
  idle>col path for a40
  idle>SELECT group_number, disk_number, mount_status, header_status, state, path from v$asm_disk;
  gNo dNo mstatu hstatus STATE PATH
  --- --- ------ --------- ---------------- ----------------------------------------
  1 1 CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK2
  1 2 CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK3
  1 3 CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK4
  1 0 CACHED MEMBER NORMAL H:/asmDISKS/_FILE_DISK1

  从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
  --- ---------- ---------- ---------- ---------------------- ------------
  1 TEST 796 641 MOUNTED NORMAL


  asm实例创建成功,以后可以再添加、删除磁盘和磁盘组。在通过DBCA创建数据库时,就可以选择这里创建好的磁盘组做为选项了。

【责编:Ken】

--------------------next---------------------

阅读(423) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~