ASM的配置與管理
--首先需要配置css服務
[root@rhel /]# cd /home/db/oracle/product/10.2.0/bin
[root@rhel bin]# ./localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized
Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
rhel
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@rhel bin]# ps -ef|grep d.bin
oracle 16501 16273 1 06:50 ? 00:00:00 /home/db/oracle/product/10.2.0/bin/ocssd.bin
root 16519 15239 0 06:51 pts/0 00:00:00 grep d.bin
--編輯asm初始化引數檔案
[root@rhel bin]# su - oracle
[oracle@rhel ~]$ vi $ORACLE_HOME/dbs/init+ASM.ora
INSTANCE_TYPE = ASM
ASM_DISKSTRING='/dev/sd*'
[oracle@rhel ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Wed Aug 29 06:54:44 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount;
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1272096 bytes
Variable Size 53253856 bytes
ASM Cache 25165824 bytes
SQL> select name, header_status, path from v$asm_disk;
NAME HEADER_STATU PATH
------------------------------ ------------ ------------------------------
CANDIDATE /dev/sda1
CANDIDATE /dev/sdb1
--建立磁碟組
SQL> CREATE DISKGROUP DG1 NORMAL REDUNDANCY
2 FAILGROUP controller1 DISK
3 '/dev/sda1'
4 FAILGROUP controller2 DISK
5 '/dev/sdb1';
Diskgroup created.
SQL> select name,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,TYPE,TOTAL_MB,FREE_MB from v$asm_diskgroup;
NAME SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB
---------- ----------- ---------- -------------------- ----------- ------ ---------- ----------
DG1 512 4096 1048576 MOUNTED NORMAL 2038 1936
SQL> select name, header_status, path from v$asm_disk;
NAME HEADER_STATU PATH
---------- ------------ ------------------------------
DG1_0001 MEMBER /dev/sdb1
DG1_0000 MEMBER /dev/sda1
--磁碟組的mount與umount
SQL> startup nomount
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1272096 bytes
Variable Size 53253856 bytes
ASM Cache 25165824 bytes
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /home/db/oracle/product/10.2.0
/dbs/spfile+ASM.ora
SQL> show parameter disk
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string
asm_diskstring string /dev/sd*
disk_asynch_io boolean TRUE
SQL> alter diskgroup dg1 mount;
Diskgroup altered.
SQL> show parameter asm_diskgroups
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string DG1
--為了使磁碟組能自動被mount,需要將asm_diskgroups='DG1' 加入到初始化引數檔案中:
SQL> alter system set asm_diskgroups='DG1' scope=both;
System altered.
SQL> show parameter asm_diskgroups
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskgroups string DG1
SQL> shutdown
ASM diskgroups dismounted
ASM instance shutdown
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@rhel ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Wed Aug 29 07:41:09 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup mount;
ASM instance started
Total System Global Area 79691776 bytes
Fixed Size 1272096 bytes
Variable Size 53253856 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> col name for a10
SQL> set lines 132
SQL> select name,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,TYPE,TOTAL_MB,FREE_MB from v$asm_diskgroup;
NAME SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TYPE TOTAL_MB FREE_MB
---------- ----------- ---------- -------------------- ----------- ------ ---------- ----------
DG1 512 4096 1048576 MOUNTED NORMAL 2038 1936
---這一次,diskgroup被自動掛載了
--刪除磁碟組,如果磁碟上有檔案,需要加including contents
SQL> drop diskgroup dg1 including contents;
Diskgroup dropped.
SQL> select name, header_status, path from v$asm_disk;
NAME HEADER_STATU PATH
------------------------- ------------ ---------------
FORMER /dev/sdb1
FORMER /dev/sda1
--重新建立磁碟組
SQL> CREATE DISKGROUP DG1 external redundancy disk
2 '/dev/sd*';
Diskgroup created.
SQL> select name, header_status, path from v$asm_disk;
NAME HEADER_STATU PATH
------------------------- ------------ ---------------
DG1_0000 MEMBER /dev/sdb1
DG1_0001 MEMBER /dev/sda1
--新增磁碟到磁碟組中
---首先將磁碟分割槽並修改分割槽許可權
[root@rhel ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-130, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-130, default 130):
Using default value 130
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rhel ~]# chown oracle:dba /dev/sdc1
--啟動ASM例項,檢視磁碟
SQL> select name, header_status, path from v$asm_disk;
NAME HEADER_STATU PATH
------------------------------ ------------ ----------
CANDIDATE /dev/sdc1
DG1_0000 MEMBER /dev/sdb1
DG1_0001 MEMBER /dev/sda1
--可見/dev/sdc1已經被發現,將該磁碟加入到磁碟組dg1中:
SQL> ALTER DISKGROUP dg1 ADD DISK '/dev/sdc1';
Diskgroup altered.
--觀察v$asm_operation檢視,可見正在進行rebalnce操作:
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
1 REBAL RUN 1 1 121 419 230 1
---檢視v$asm_disk檢視,可見資料已經被移到了新加的磁碟上,且分佈均勻:
SQL> select DISK_NUMBER,name,PATH,TOTAL_MB,FREE_MB from v$asm_disk;
DISK_NUMBER NAME PATH TOTAL_MB FREE_MB
----------- ------------------------------ ---------- ---------- ----------
2 DG1_0002 /dev/sdc1 1019 604
0 DG1_0000 /dev/sdb1 1019 603
1 DG1_0001 /dev/sda1 1019 603
--建立一個表空間,然後再次檢視v$asm_disk檢視:
SQL> create tablespace users datafile '+DG1/oradata/mbs/users01.dbf' size 200m;
Tablespace created.
--可以發現資料檔案被均勻的分佈在各個磁碟上:
SQL> select DISK_NUMBER,name,PATH,TOTAL_MB,FREE_MB from v$asm_disk;
DISK_NUMBER NAME PATH TOTAL_MB FREE_MB
----------- ------------------------------ ---------- ---------- ----------
2 DG1_0002 /dev/sdc1 1019 536
0 DG1_0000 /dev/sdb1 1019 536
1 DG1_0001 /dev/sda1 1019 536
以上是在oracle 10g環境下測試通過
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10972173/viewspace-742254/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- asm 的管理ASM
- 【ASM學習】ASM 管理ASM
- ASM的安裝配置ASM
- ASM管理ASM
- Mysql管理與配置MySql
- Oracle11g RAC下ASM 的管理與維護OracleASM
- Oracle ASM 管理OracleASM
- ASM 管理篇ASM
- SElinux配置與管理Linux
- 網路防火牆的配置與管理防火牆
- ASM 磁碟、目錄的管理ASM
- ASM管理的內部工具ASM
- 簡單配置ASMASM
- asm重新配置ASM
- Solaris下配置ASMASM
- 配置並建立ASMASM
- Flex ASM的配置和轉換FlexASM
- Oracle listener log配置與管理Oracle
- docker儲存配置與管理Docker
- 管理 ASM 例項ASM
- ASM簡單管理ASM
- asm磁碟管理篇ASM
- ASM管理手冊ASM
- ASM 管理歸檔ASM
- 配置管理與IT資產管理:差異與協同共生
- ASM常用基礎管理命令[ASM基礎]ASM
- 配置ASM磁碟-轉載ASM
- Oracle ASM 配置錯誤OracleASM
- ASM基本配置問題ASM
- linux下ASM配置LinuxASM
- ORACLE 11.2.0.3配置ASMOracleASM
- Oracle ASM 的redundancy與failgroupOracleASMAI
- ASM表空間管理ASM
- oracle asm 管理容量OracleASM
- ASM學習筆記_磁碟的管理ASM筆記
- oracle10g中的asm的配置(轉)OracleASM
- asm 相容性、asm instance 主要引數管理ASM
- Apache基礎配置與日誌管理Apache