熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

使用普通文件創建ASM實例

2013-11-13 22:13:07  來源: Oracle 

  建立以下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創建數據庫時就可以選擇這裡創建好的磁盤組做為存儲選項了


From:http://tw.wingwit.com/Article/program/Oracle/201311/18510.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.