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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- oracle 11G RAC的建立(VM虛擬環境)Oracle
- Oracle 11.2.0.4 rac for aix acfs異常環境的克隆環境ASM磁碟組掛載緩慢OracleAIASM
- Oracle RAC一鍵部署001(主機環境校驗)Oracle
- 通過ORACLE VM virtualbox環境安裝oracle 11G RAC(ASM)OracleASM
- RAC和ASM環境下打patchASM
- Oracle RAC 環境下的連線管理Oracle
- 達夢資料庫初體驗-單機環境部署記錄資料庫
- RAC環境下建立物理DATAGUARD(1)
- RAC環境下建立物理DATAGUARD(2)
- 超大記憶體環境下的Oracle RAC引數設定建議記憶體Oracle
- Oracle RAC 環境 引數檔案的啟動順序Oracle
- Oracle RAC環境新增新的network和listener(未完成)Oracle
- 10. Oracle常用高可用方案——10.2. RACOracle
- Oracle RAC ASM磁碟組擴容時遇到的VIP漂移OracleASM
- Oracle資料庫從Linux x86單機遷移到Solaries雙節點RAC叢集經驗分享-測試環境驗證Oracle資料庫Linux
- RAC環境修改spfile的位置
- 非域環境下SQL Server mirror建立SQLServer
- RAC+DG(asm單例項)ASM單例
- Overview of Oracle Flex ASM In Oracle 19c RAC-20220111ViewOracleFlexASM
- Windows環境下ELK簡單搭建記錄Windows
- 如何檢視Oracle RAC的asm磁碟的udev對應關係OracleASMdev
- Oracle RAC日常運維-ASM磁碟擴容Oracle運維ASM
- 非空校驗在oracle和mysql中的用法OracleMySql
- Networker恢復oracle rac到單機Oracle
- ORACLE 12C RAC 生產環境搭建介紹Oracle
- Oracle資料庫從Linux x86單機遷移到Solaries雙節點RAC叢集經驗分享-生產環境切換Oracle資料庫Linux
- 如何在rac環境中增加監聽
- goldengate + asm + racGoASM
- Oracle搭建rac到單庫的adgOracle
- 記錄一次Oracle 11.2.0.4 RAC異地恢復到單例項Oracle單例
- 簡單建立VC + DDK的驅動開發環境開發環境
- 【ASK_ORACLE】Oracle RAC配置ASM Filter Driver(ASMFD)(一)ASMFD簡介OracleASMFilter
- Docker環境編譯時的錯誤記錄Docker編譯
- 【DB寶4】只需2步即可擁有Oracle19c的ASM+DB環境OracleASM
- 學習筆記:openstack實驗環境安裝筆記
- 16位簡單ASM題的記錄——[HGAME 2022 week1]easyasmASMGAM
- RAC+ASM+DATAGUARDASM
- Oracle 12C RAC的單機Standby returning error ORA-16191OracleError