Oracle 10.2的單機(非RAC)環境中建立ASM的實驗記錄
這是在Oracle 10.2的單機(非RAC)環境中建立ASM的實驗記錄。
主要的步驟如下:
1、使用新增的磁碟建立vg及lv
2、將lv對映為raw
3、編輯ASM例項的pfile,啟動例項
4、建立ASM DiskGroup
我這裡主要是實驗目的,所以使用了lvm以及raw,一般在生產環境中的ASM是不推薦使用lvm的,因為lvm隱藏了物理磁碟架構,可能導致ASM效率低下,具體說明可以參考官方文件。
我使用的作業系統是CentOS 5,已經整合了asmlib。如果使用其他沒有整合asmlib的Linux,參照 下載安裝。
詳細的操作過程如下:
[@more@]1、使用新增的磁碟建立vg及lv
1.1、檢視新增加的磁碟
[root@oracle /]# ls -l /dev/sd* brwxrwxrwx 1 oracle dba 8, 0 Dec 17 10:10 /dev/sda brwxrwxrwx 1 oracle dba 8, 16 Dec 17 10:10 /dev/sdb |
1.2、使用fdisk命令為兩個新增加的磁碟分割槽,都只分一個區,使用最大容量
[root@oracle /]# fdisk /dev/sda The number of cylinders for this disk is set to 1044. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1044, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): Using default value 1044 Command (m for help): p Disk /dev/sda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 1044 8385898+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@oracle /]# fdisk /dev/sdb The number of cylinders for this disk is set to 1044. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1044, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): Using default value 1044 Command (m for help): p Disk /dev/sdb: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 1044 8385898+ 83 Linux Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. |
1.2、為新建的分割槽建立pv
[root@oracle /]# pvcreate sdb1 /dev/sdb1 Device sdb1 not found (or ignored by filtering). Physical volume "/dev/sdb1" successfully created [root@oracle /]# pvcreate sda1 /dev/sda1 Device sda1 not found (or ignored by filtering). Physical volume "/dev/sda1" successfully created |
1.3、建立名稱為vg_asm的vg
[root@oracle /]# vgcreate vg_asm /dev/sda1 /dev/sdb1 Volume group "vg_asm" successfully created |
1.4、在vg_asm上建立lv,名稱為lv_asm123
[root@oracle /]# lvcreate -L 4G -n lv_asm1 vg_asm Logical volume "lv_asm1" created [root@oracle /]# lvcreate -L 4G -n lv_asm2 vg_asm Logical volume "lv_asm2" created [root@oracle /]# lvcreate -L 3.99G -n lv_asm3 vg_asm Rounding up size to full physical extent 3.99 GB Logical volume "lv_asm3" created [root@oracle /]# ls -l /dev/vg_asm/ total 0 lrwxrwxrwx 1 root root 26 Dec 17 10:43 lv_asm1 -> /dev/mapper/vg_asm-lv_asm1 lrwxrwxrwx 1 root root 26 Dec 17 10:43 lv_asm2 -> /dev/mapper/vg_asm-lv_asm2 lrwxrwxrwx 1 root root 26 Dec 17 10:44 lv_asm3 -> /dev/mapper/vg_asm-lv_asm3 |
1.5、將3個新建立的lv對映為裸裝置
編輯/etc/sysconfig/rawdevices檔案,增加如下三行/dev/raw/raw1 /dev/vg_asm/lv_asm1 /dev/raw/raw2 /dev/vg_asm/lv_asm2 /dev/raw/raw3 /dev/vg_asm/lv_asm3 |
執行如下命令,使新增加的裸裝置生效
[root@oracle /]# service rawdevices restart Assigning devices: /dev/raw/raw1 --> /dev/vg_asm/lv_asm1 /dev/raw/raw1: bound to major 253, minor 2 /dev/raw/raw2 --> /dev/vg_asm/lv_asm2 /dev/raw/raw2: bound to major 253, minor 3 /dev/raw/raw3 --> /dev/vg_asm/lv_asm3 /dev/raw/raw3: bound to major 253, minor 4 done |
檢視新增加的裸裝置狀態
[root@oracle /]# ls -l /dev/raw/ total 0 crw------- 1 root root 162, 1 Dec 17 10:46 raw1 crw------- 1 root root 162, 2 Dec 17 10:46 raw2 crw------- 1 root root 162, 3 Dec 17 10:46 raw3 [root@oracle /]# |
建立裸裝置的連結到oradata目錄,這一步可以省略,這裡只是為了方便以後檢視各個裸裝置的用途
[root@oracle /]# ln -s /dev/raw/raw1 /oracle/oradata/asm1 ln -s /dev/raw/raw2 /oracle/oradata/asm2 ln -s /dev/raw/raw3 /oracle/oradata/asm3 [root@oracle /]# ln -s /dev/raw/raw2 /oracle/oradata/asm2 [root@oracle /]# ln -s /dev/raw/raw3 /oracle/oradata/asm3 [root@oracle /]# [root@oracle /]# [root@oracle /]# ls -l /oracle/oradata total 8 lrwxrwxrwx 1 root root 13 Dec 17 10:48 asm1 -> /dev/raw/raw1 lrwxrwxrwx 1 root root 13 Dec 17 10:48 asm2 -> /dev/raw/raw2 lrwxrwxrwx 1 root root 13 Dec 17 10:48 asm3 -> /dev/raw/raw3 |
設定裸裝置的使用許可權
[root@oracle /]# chown oracle:oinstall /dev/raw/raw1 chown oracle:oinstall /dev/raw/raw2 chown oracle:oinstall /dev/raw/raw3 chmod 600 /dev/raw/raw1 chmod 600 /dev/raw/raw2 chmod 600 /dev/raw/raw3 [root@oracle /]# chown oracle:oinstall /dev/raw/raw2 [root@oracle /]# chown oracle:oinstall /dev/raw/raw3 [root@oracle /]# chmod 600 /dev/raw/raw1 [root@oracle /]# chmod 600 /dev/raw/raw2 [root@oracle /]# chmod 600 /dev/raw/raw3 [root@oracle /]# [root@oracle /]# [root@oracle /]# ls -l /dev/raw/raw1 total 0 crw------- 1 oracle oinstall 162, 1 Dec 17 10:46 raw1 crw------- 1 oracle oinstall 162, 2 Dec 17 10:46 raw2 crw------- 1 oracle oinstall 162, 3 Dec 17 10:46 raw3 |
將設定裸裝置使用許可權的語句寫入自動啟動指令碼中
編輯 /etc/rc.local 檔案,增加如下內容
chown oracle:oinstall /dev/raw/raw1 chown oracle:oinstall /dev/raw/raw2 chown oracle:oinstall /dev/raw/raw3 chmod 600 /dev/raw/raw1 chmod 600 /dev/raw/raw2 chmod 600 /dev/raw/raw3 |
3、編輯ASM例項的pfile,啟動例項
以下操需要使用oracle使用者完成,所以先su到oracle使用者
[root@oracle oradata]# su - oracle |
進入$ORACLE_HOME/dbs目錄
[oracle@oracle ~]$ cd $ORACLE_HOME/dbs [oracle@oracle dbs]$ pwd /oracle/app/10.1/dbs |
在這個目錄下建立名稱為init+ASM.ora的檔案,內容如下:
instance_type=asm |
設定ORACLE_SID環境變數
[oracle@oracle dbs]$ export ORACLE_SID=+ASM |
登入資料庫,啟動ASM例項
[oracle@oracle dbs]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 17 10:54:18 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount pfile='/oracle/app/10.1/dbs/init+ASM.ora'; ASM instance started Total System Global Area 79691776 bytes Fixed Size 1217812 bytes Variable Size 53308140 bytes ASM Cache 25165824 bytes |
--------begin 異常情況處理 begin--------
如果啟動的時候報如下錯誤
ORA-29701: unable to connect to Cluster Manager |
這需要用root使用者執行localconfig add命令(在$ORACLE_HOME/bin目錄下),啟動cssd程式,如下:
[root@oracle bin]# pwd /oracle/app/10.1/bin [root@oracle 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 90 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. oracle CSS is active on all nodes. Oracle CSS service is installed and running under init(1M) [root@oracle bin]# ps -ef|grep css|grep -v grep root 5126 1 0 09:44 ? 00:00:00 /bin/su -l oracle -c sh -c 'cd /oracle/app/10.1/log/oracle/cssd; ulimit -c unlimited; exec /oracle/app/10.1/bin/ocssd ' oracle 5229 5126 0 09:45 ? 00:00:00 /oracle/app/10.1/bin/ocssd.bin |
----------end 異常情況處理 end----------
使用pfile檔案生成spfile
SQL> create spfile from pfile='/oracle/app/10.1/dbs/init+ASM.ora'; File created. |
使用spfile重啟ASM例項
SQL> shutdown abort; ASM instance shutdown SQL> startup nomount; ASM instance started Total System Global Area 79691776 bytes Fixed Size 1217812 bytes Variable Size 53308140 bytes ASM Cache 25165824 bytes |
4、建立ASM DiskGroup
SQL> create diskgroup data external redundancy disk '/dev/raw/raw1','/dev/raw/raw2','/dev/raw/raw3'; Diskgroup created. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options |
5、檢查新建立的磁碟組
[oracle@oracle dbs]$ asmcmd ASMCMD> lsdg State Type Rebal Unbal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name MOUNTED EXTERN N N 512 4096 1048576 12280 12226 0 12226 0 DATA/ ASMCMD> ls DATA/ ASMCMD> exit |
--end--
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22049049/viewspace-1029758/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 刪除Linux非rac環境下的ASM例項LinuxASM
- 單機搭建ASM環境ASM
- 刪除Linux非rac環境下的ASM例項(轉)LinuxASM
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- Oracle10g RAC ASM 環境日常管理OracleASM
- (轉)Oracle rac環境下清除asm例項OracleASM
- 如何在 RAC 叢集或單機 ASM 環境中對已經存在的 Diskgroup 新增新磁碟(最佳實踐)ASM
- ORACLE RAC環境下某節點的+ASM註冊到CRS資源中OracleASM
- 單機環境配置ASM例項ASM
- oracle 11G RAC的建立(VM虛擬環境)Oracle
- Oracle RAC一鍵部署001(主機環境校驗)Oracle
- CentOS7下單機部署RabbltMQ環境的操作記錄CentOSMQ
- CentOS大資料實驗環境更改記錄CentOS大資料
- RAC環境建立額外的THREADthread
- RAC環境ASM磁碟組間修改spfile的位置ASM
- 利用TAR恢復ORACLE RAC環境的軟體目錄Oracle
- Oracle 11.2.0.4 rac for aix acfs異常環境的克隆環境ASM磁碟組掛載緩慢OracleAIASM
- ASM單例項(Oracle 11.2.0.4)環境(一)ASM單例Oracle
- ASM單例項(Oracle 11.2.0.4)環境(二)ASM單例Oracle
- RAC和ASM環境下打patchASM
- 單機環境安裝配置ASM例項ASM
- 使用 runcluvfy 校驗Oracle RAC安裝環境Oracle
- oracle rac 無法建立asm磁碟OracleASM
- linux_oracle10g_rac_asm_命令列配置rac記錄LinuxOracleASM命令列
- 從單例項資料庫轉換到RAC環境——RAC的建立和配置單例資料庫
- RAC環境在ASM上建立表空間出錯ORA-569ASM
- 將資料庫遷移到ASM的實驗記錄資料庫ASM
- oracle 10G RAC 安裝環境驗證Oracle 10g
- RAC環境中的TNSNAMES檔案
- 通過ORACLE VM virtualbox環境安裝oracle 11G RAC(ASM)OracleASM
- oracle實驗記錄 (手動建立 physical datagurad)Oracle
- Oracle RAC 環境下的連線管理Oracle
- oracle實驗記錄 (CKPT的觸發)Oracle
- oracle實驗記錄 (oracle 10G dataguard(8)rman 建立dg)Oracle
- oracle11gR2 RAC 環境測試修改節點VIP的測試操作記錄Oracle
- oracle rac 環境檢測Oracle
- 【ASM學習】在windows 環境下建立ASM例項ASMWindows
- 【RMAN】RAC資料恢復至單機環境資料恢復