【ASM學習】在windows 環境下建立ASM例項

楊奇龍發表於2010-08-10

SQL> startup
ASM 例項已啟動
Total System Global Area  535662592 bytes                                      
Fixed Size                  1334380 bytes                                      
Variable Size             509162388 bytes                                      
ASM Cache                  25165824 bytes                                      
ORA-15110: no diskgroups mounted
SQL> show user
USER is "SYS"
SQL> col host_name for a15
SQL> col instance_name for a15
SQL> col version for a15
SQL> select host_name,instance_name,version,status from v$instance;
HOST_NAME       INSTANCE_NAME   VERSION         STATUS                         
--------------- --------------- --------------- ------------------------       
YQL             +asm            11.1.0.6.0      STARTED                        

SQL> col path for a30
SQL> select path ,mount_status from v$asm_disk order by disk_number;

PATH                           MOUNT_STATUS                                    
------------------------------ --------------                                  
F:\ORACL\ASM\ASMDISK1          CLOSED                                          
F:\ORACL\ASM\ASMDISK10         CLOSED                                          
F:\ORACL\ASM\ASMDISK2          CLOSED                                          
F:\ORACL\ASM\ASMDISK3          CLOSED                                          
F:\ORACL\ASM\ASMDISK4          CLOSED                                          
F:\ORACL\ASM\ASMDISK5          CLOSED                                          
F:\ORACL\ASM\ASMDISK6          CLOSED                                          
F:\ORACL\ASM\ASMDISK7          CLOSED                                          
F:\ORACL\ASM\ASMDISK8          CLOSED                                          
F:\ORACL\ASM\ASMDISK9          CLOSED                                          

10 rows selected.

SQL> select group_number,name, state,total_mb,free_mb from v$asm_diskgroup;
no rows selected

SQL> create diskgroup sys_data
  2  External Redundancy
  3  disk 'f:\oracl\asm\asmdisk1',
  4   'f:\oracl\asm\asmdisk2',
  5   'f:\oracl\asm\asmdisk3';
Diskgroup created.
SQL> create diskgroup flash_data
  2  External Redundancy
  3  disk 'f:\oracl\asm\asmdisk4',
  4   'f:\oracl\asm\asmdisk5';
Diskgroup created.

SQL> create diskgroup user_data
  2  Normal Redundancy
  3  failgroup user_fg_01 disk 'f:\oracl\asm\asmdisk6'
  4  failgroup user_fg_02 disk 'f:\oracl\asm\asmdisk7';
Diskgroup created.

SQL> create diskgroup test_data
  2  High Redundancy
  3  failgroup test_fg_01 disk 'f:\oracl\asm\asmdisk8'
  4  failgroup test_fg_02 disk 'f:\oracl\asm\asmdisk9'
  5  failgroup test_fg_03 disk 'f:\oracl\asm\asmdisk10';
Diskgroup created.

SQL> col path for a30
SQL> select path ,mount_status from v$asm_disk order by disk_number;

PATH                           MOUNT_STATUS                                    
------------------------------ --------------                                  
F:\ORACL\ASM\ASMDISK1          CACHED                                          
F:\ORACL\ASM\ASMDISK4          CACHED                                          
F:\ORACL\ASM\ASMDISK8          CACHED                                          
F:\ORACL\ASM\ASMDISK6          CACHED                                          
F:\ORACL\ASM\ASMDISK9          CACHED                                          
F:\ORACL\ASM\ASMDISK5          CACHED                                          
F:\ORACL\ASM\ASMDISK7          CACHED                                          
F:\ORACL\ASM\ASMDISK2          CACHED                                          
F:\ORACL\ASM\ASMDISK3          CACHED                                          
F:\ORACL\ASM\ASMDISK10         CACHED                                          

10 rows selected.
SQL> select group_number,name,sector_size,block_size,allocation_unit_size,
  2  state,type,total_mb,free_mb
  3  from v$asm_diskgroup;

GROUP_NUMBER NAME                                                              
------------ ------------------------------------------------------------      
SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE                  TYPE        
----------- ---------- -------------------- ---------------------- ------------
  TOTAL_MB    FREE_MB                                                          
---------- ----------                                                          
           1 SYS_DATA                                                          
        512       4096              1048576 MOUNTED                EXTERN      
      1500       1446                                                          
                                                                               
           2 FLASH_DATA                                                        
        512       4096              1048576 MOUNTED                EXTERN      
       400        348                                                          

GROUP_NUMBER NAME                                                              
------------ ------------------------------------------------------------      
SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE                  TYPE        
----------- ---------- -------------------- ---------------------- ------------
  TOTAL_MB    FREE_MB                                                          
---------- ----------                                                          
                                                                               
           3 USER_DATA                                                         
        512       4096              1048576 MOUNTED                NORMAL      
       200         98                                                          
                                                                               
           4 TEST_DATA                                                         
        512       4096              1048576 MOUNTED                HIGH        

GROUP_NUMBER NAME                                                              
------------ ------------------------------------------------------------      
SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE                  TYPE        
----------- ---------- -------------------- ---------------------- ------------
  TOTAL_MB    FREE_MB                                                          
---------- ----------                                                          
       300        147                                                          
                                                                               

SQL> col name for a12
SQL> col allocation_unit_size for a6
SQL> select group_number,name,sector_size,block_size,
  2  state,type,total_mb,free_mb
  3  from v$asm_diskgroup;

GROUP_NUMBER NAME         SECTOR_SIZE BLOCK_SIZE STATE                         
------------ ------------ ----------- ---------- ----------------------        
TYPE           TOTAL_MB    FREE_MB                                             
------------ ---------- ----------                                             
           1 SYS_DATA             512       4096 MOUNTED                       
EXTERN             1500       1446                                             
                                                                               
           2 FLASH_DATA           512       4096 MOUNTED                       
EXTERN              400        348                                             
                                                                               
           3 USER_DATA            512       4096 MOUNTED                       
NORMAL              200         98                                             
                                                                               

GROUP_NUMBER NAME         SECTOR_SIZE BLOCK_SIZE STATE                         
------------ ------------ ----------- ---------- ----------------------        
TYPE           TOTAL_MB    FREE_MB                                             
------------ ---------- ----------                                             
           4 TEST_DATA            512       4096 MOUNTED                       
HIGH                300        147                                             
                                                                                                
SQL> select group_number,name,
  2  state,type,total_mb,free_mb
  3  from v$asm_diskgroup;

GROUP_NUMBER NAME         STATE                  TYPE           TOTAL_MB       
------------ ------------ ---------------------- ------------ ----------       
   FREE_MB                                                                     
----------                                                                     
           1 SYS_DATA     MOUNTED                EXTERN             1500       
      1446                                                                     
                                                                               
           2 FLASH_DATA   MOUNTED                EXTERN              400       
       348                                                                     
                                                                               
           3 USER_DATA    MOUNTED                NORMAL              200       
        98                                                                     
                                                                               

GROUP_NUMBER NAME         STATE                  TYPE           TOTAL_MB       
------------ ------------ ---------------------- ------------ ----------       
   FREE_MB                                                                     
----------                                                                     
           4 TEST_DATA    MOUNTED                HIGH                300       
       147                                                                     
                                                                               
SQL> select group_number,name,
  2  type,total_mb,free_mb
  3  from v$asm_diskgroup;

GROUP_NUMBER NAME         TYPE           TOTAL_MB    FREE_MB                   
------------ ------------ ------------ ---------- ----------                   
           1 SYS_DATA     EXTERN             1500       1446                   
           2 FLASH_DATA   EXTERN              400        348                   
           3 USER_DATA    NORMAL              200         98                   
           4 TEST_DATA    HIGH                300        147                   

SQL> show parameter asm_disk

NAME                  TYPE                VALUE                       
--------             ----------------     ------------------------------            

asm_diskgroups string  SYS_DATA, FLASH_DATA, USER_DATA, TEST_DATA             

asm_diskstring      string               F:\ORACL\ASM\*                                                                 
SQL> shutdown immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> host orapwd file=F:\ORACL\product\11.1.0\db_1\database\PWDasm.ora password=yang entries=10

在引數檔案里加入asm_diskgroups='SYS_DATA', 'FLASH_DATA', 'USER_DATA', 'TEST_DATA' --根據實際情況作出修改!
SQL> startup
ASM instance started
Total System Global Area  535662592 bytes                                      
Fixed Size                  1334380 bytes                                      
Variable Size             509162388 bytes                                      
ASM Cache                  25165824 bytes                                      
ASM diskgroups mounted
SQL> create spfile from pfile;
File created.

----成功!以後可以在ASM上折騰了。。。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-670708/,如需轉載,請註明出處,否則將追究法律責任。

相關文章