raw device
---------------------------------------------------------------
參考文件:
http://space.itpub.net/519536/viewspace-557694
http://www.lupaworld.com/home-space-do-blog-uid-26777-id-214009.html
使用 VMware Server 在 Oracle Enterprise Linux 上安裝 Oracle RAC 10g
---------------------------------------------------------------
iMB環境: Linux AS 4.0 , 2.6.9-42.ELsmp
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit
1. 儲存管理基本知識
PV(物理卷): 可以是單獨磁碟也可以是邏輯上的集合比如/dev/sda1 (RAID之後).
VG/PE(卷組): 卷組的基本單位是PE .
LV/LE: 在卷組中建立邏輯卷,邏輯卷的基本單位是LE .
2. 使用裸裝置 - 實戰
系統重新啟動後raw的屬組會改變,所以需要修改以下檔案的內容:
imbsmt1$pwd
/etc/udev/permissions.d
imbsmt1$vi 50-udev.permissions
# raw devices
ram*:root:disk:0660
# raw/*:root:disk:0660
raw/*:oracle:dba:0660
備註:
修改 /etc/udev/permissions.d/50-udev.permissions。原始裝置在引導時會重新對映。
預設情況下,在引導時原始裝置的擁有者將更改為root使用者。如果擁有者不是 oracle
使用者,則Oracle在訪問共享磁碟分割槽時會出現問題。
在 /etc/udev/permissions.d/50-udev.permissions 中為原始行“raw/*:root:disk:0660”
新增註釋,然後新增一個新行“raw/*:oracle:dba:0660” (如上)。
3. 磁碟分割槽建立PV
#fdisk /dev/sdb 劃分好分割槽後:
在分割槽的基礎上建立物理卷PV
#pvcreate /dev/sdb1 /dev/sdb2
4. 建立VG
在PV的基礎上建立卷組,語法:vgcreate vgname pvname .
[root@pridb dev]# vgcreate datavg /dev/sdb1 /dev/sdb2
Volume group "datavg" successfully created
4. 建立LV
在VG中建立邏輯卷,語法: lvcreate -n lvname -L size vgname .
[root@pridb dev]# lvcreate -n system -L 800m datavg
[root@pridb dev]# lvcreate -n sysaux -L 700m datavg
[root@pridb dev]# lvcreate -n users -L 50m datavg
[root@pridb dev]# lvcreate -n undotbs1 -L 2000m datavg
[root@pridb dev]# lvcreate -n temp -L 2000m datavg
[root@pridb dev]# lvcreate -n spfile -L 10m datavg
[root@pridb dev]# lvcreate -n control1 -L 100m datavg
[root@pridb dev]# lvcreate -n control2 -L 100m datavg
[root@pridb dev]# lvcreate -n control3 -L 100m datavg
[root@pridb dev]# lvcreate -n redo1 -L 50m datavg
[root@pridb dev]# lvcreate -n redo2 -L 50m datavg
[root@pridb dev]# lvcreate -n redo3 -L 50m datavg
建立完成後,可以在 /dev/datavg及/dev/mapper 下看到新建立的lv資訊。
備註: 刪除lv的命令類似
# lvremove /dev/datavg/sysaux
5. 建立裸裝置(可以寫在shell指令碼中批次執行)
備註: raw命令為
# raw /dev/raw/raw1 /dev/mapper/datavg-control1
# raw /dev/raw/raw2 /dev/mapper/datavg-control2
# raw /dev/raw/raw3 /dev/mapper/datavg-control3
# raw /dev/raw/raw4 /dev/mapper/datavg-redo1
# raw /dev/raw/raw5 /dev/mapper/datavg-redo2
# raw /dev/raw/raw6 /dev/mapper/datavg-redo3
# raw /dev/raw/raw7 /dev/mapper/datavg-spfile
# raw /dev/raw/raw8 /dev/mapper/datavg-sysaux
# raw /dev/raw/raw9 /dev/mapper/datavg-system
# raw /dev/raw/raw10 /dev/mapper/datavg-temp
# raw /dev/raw/raw11 /dev/mapper/datavg-undotbs1
# raw /dev/raw/raw12 /dev/mapper/datavg-users
備註: 如果想刪除建立的raw, 可以 # raw /dev/rawxx
5. 系統重啟自動掛載raw
修改/etc/sysconfig/rawdevices 檔案,使系統重啟後可自動掛載裸裝置。
/dev/raw/raw1 /dev/mapper/datavg-control1
/dev/raw/raw2 /dev/mapper/datavg-control2
....
6. 修改raw的許可權
在linux中,會在/dev下存在3個目錄:
a. /dev/raw 裸裝置目錄
b. /dev/mapper/ 裸裝置對應的塊裝置目錄
c. /dev/datavg/ 裸裝置和塊裝置的連結檔案目錄
修改以上3個目錄的許可權後,Oracle才能使用。 因為上面已經設定了
raw/*:oracle:dba:0660 ,此處就不需要執行了。 但如果許可權不正確,
可以將 /dev/raw下的裸裝置檔案屬組修改為oracle的,其他兩個目錄
可以不做修改。
7. 建立Oracle資料檔案
建立oracle的資料檔案和引數檔案,軟連線檔案,對應到每一個裸裝置檔案,編輯
oracle邏輯檔名與raw的對映檔案, 批次處理。
# ln -s /dev/raw/raw1 /u01/app/oracle/oradata/orcl/control1.ctl
# ln -s /dev/raw/raw2 /u01/app/oracle/oradata/orcl/control2.ctl
# ln -s /dev/raw/raw3 /u01/app/oracle/oradata/orcl/control3.ctl
# ln -s /dev/raw/raw4 /u01/app/oracle/oradata/orcl/redo1.ctl
# ln -s /dev/raw/raw5 /u01/app/oracle/oradata/orcl/redo2.ctl
# ln -s /dev/raw/raw6 /u01/app/oracle/oradata/orcl/redo3.ctl
# ln -s /dev/raw/raw7 /u01/app/oracle/oradata/orcl/system.ctl
# ln -s /dev/raw/raw8 /u01/app/oracle/oradata/orcl/sysaux.ctl
......
iMB 相關資訊:
-------------------------------------------------------------------------------------------
imbsmt1$cat rc.local | more
#!/bin/sh
#
# This script. will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style. init stuff.
touch /var/lock/subsys/local
route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.160.16.1 dev eth0
/usr/sbin/ntpdate -us 10.161.8.200;hwclock -w
vgscan ---- 掃描並顯示系統中的卷組
vgchange -a y ---- 啟用VG
/usr/bin/raw /dev/raw/raw1 /dev/pv/lvol1
/usr/bin/raw /dev/raw/raw2 /dev/pv/lvol2
/usr/bin/raw /dev/raw/raw3 /dev/pv/lvol3
/usr/bin/raw /dev/raw/raw4 /dev/pv/lvol4
/usr/bin/raw /dev/raw/raw5 /dev/pv/lvol5
/usr/bin/raw /dev/raw/raw6 /dev/pv/lvol6
/usr/bin/raw /dev/raw/raw7 /dev/pv/lvol7
/bin/chmod 600 /dev/raw/raw1
/bin/chmod 600 /dev/raw/raw2
/bin/chmod 600 /dev/raw/raw3
/bin/chmod 600 /dev/raw/raw4
/bin/chmod 600 /dev/raw/raw5
/bin/chmod 600 /dev/raw/raw6
/bin/chmod 600 /dev/raw/raw7
/bin/chown oracle.dba /dev/raw/raw1
/bin/chown oracle.dba /dev/raw/raw2
/bin/chown oracle.dba /dev/raw/raw3
/bin/chown oracle.dba /dev/raw/raw4
/bin/chown oracle.dba /dev/raw/raw5
/bin/chown oracle.dba /dev/raw/raw6
/bin/chown oracle.dba /dev/raw/raw7
ln -s /dev/raw/raw1 /opt/oracle/oradata/smt/CMQuorumFile
ln -s /dev/raw/raw2 /opt/oracle/oradata/smt/SharedSrvctlConfigFile
ln -s /dev/raw/raw3 /opt/oracle/oradata/smt/spfilesmt.ora
ln -s /dev/raw/raw4 /opt/oracle/oradata/smt/control01.ctl
ln -s /dev/raw/raw5 /opt/oracle/oradata/smt/control02.ctl
ln -s /dev/raw/raw6 /opt/oracle/oradata/smt/control03.ctl
ln -s /dev/raw/raw7 /opt/oracle/oradata/smt/indx01.dbf
ln -s /dev/raw/raw8 /opt/oracle/oradata/smt/system01.dbf
ln -s /dev/raw/raw9 /opt/oracle/oradata/smt/temp01.dbf
ln -s /dev/raw/raw10 /opt/oracle/oradata/smt/tools01.dbf
ln -s /dev/raw/raw11 /opt/oracle/oradata/smt/undotbs01.dbf
ln -s /dev/raw/raw12 /opt/oracle/oradata/smt/undotbs02.dbf
ln -s /dev/raw/raw13 /opt/oracle/oradata/smt/undotbs03.dbf
ln -s /dev/raw/raw14 /opt/oracle/oradata/smt/users01.dbf
ln -s /dev/raw/raw15 /opt/oracle/oradata/smt/xdb01.dbf
ln -s /dev/raw/raw16 /opt/oracle/oradata/smt/perfstat01.dbf
ln -s /dev/raw/raw17 /opt/oracle/oradata/smt/cwmlite01.dbf
ln -s /dev/raw/raw18 /opt/oracle/oradata/smt/example01.dbf
ln -s /dev/raw/raw19 /opt/oracle/oradata/smt/drsys01.dbf
ln -s /dev/raw/raw20 /opt/oracle/oradata/smt/odm01.dbf
ln -s /dev/raw/raw21 /opt/oracle/oradata/smt/redo01.log
ln -s /dev/raw/raw22 /opt/oracle/oradata/smt/redo02.log
ln -s /dev/raw/raw23 /opt/oracle/oradata/smt/redo03.log
ln -s /dev/raw/raw24 /opt/oracle/oradata/smt/smt_redo2_2.log
ln -s /dev/raw/raw25 /opt/oracle/oradata/smt/I_SWDL_DATA_01.dbf
ln -s /dev/raw/raw27 /opt/oracle/oradata/smt/D_SWDL_DATA_01.dbf
ln -s /dev/raw/raw28 /opt/oracle/oradata/smt/D_SFIS1_DATA_01a.dbf
ln -s /dev/raw/raw29 /opt/oracle/oradata/smt/D_SFISM4_DATA_01a.dbf
ln -s /dev/raw/raw30 /opt/oracle/oradata/smt/D_SFISM4_DATA_02a.dbf
ln -s /dev/raw/raw31 /opt/oracle/oradata/smt/D_SFISM4_DATA_01b.dbf
ln -s /dev/raw/raw32 /opt/oracle/oradata/smt/D_SMT_SCANDATA_DATA.dbf
ln -s /dev/raw/raw33 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_01a.dbf
ln -s /dev/raw/raw34 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_02a.dbf
ln -s /dev/raw/raw35 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_02b.dbf
ln -s /dev/raw/raw36 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_03a.dbf
ln -s /dev/raw/raw37 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_04a.dbf
ln -s /dev/raw/raw38 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_05a.dbf
ln -s /dev/raw/raw39 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_06a.dbf
ln -s /dev/raw/raw40 /opt/oracle/oradata/smt/D_SNDETAIL_DATA_07a.dbf
ln -s /dev/raw/raw41 /opt/oracle/oradata/smt/D_TEST_DATA_01a.dbf
ln -s /dev/raw/raw42 /opt/oracle/oradata/smt/D_WIPTRACKING_DATA_01a.dbf
ln -s /dev/raw/raw43 /opt/oracle/oradata/smt/I_SFIS1_DATA_01a.dbf
ln -s /dev/raw/raw44 /opt/oracle/oradata/smt/I_SFISM4_DATA_01a.dbf
ln -s /dev/raw/raw45 /opt/oracle/oradata/smt/I_SMT_SCANDATA.dbf
ln -s /dev/raw/raw46 /opt/oracle/oradata/smt/I_SNDETAIL_DATA_01a.dbf
ln -s /dev/raw/raw47 /opt/oracle/oradata/smt/I_SNDETAIL_DATA_01b.dbf
ln -s /dev/raw/raw49 /opt/oracle/oradata/smt/I_WIPTRACKING_DATA_01a.dbf
ln -s /dev/raw/raw56 /opt/oracle/oradata/smt/AGAENT_DATA.dbf
ln -s /dev/raw/raw57 /opt/oracle/oradata/smt/AGAENT_INDEX.dbf
ln -s /dev/raw/raw58 /opt/oracle/oradata/smt/smt_redo1_3.log
ln -s /dev/raw/raw59 /opt/oracle/oradata/smt/smt_redo2_3.log
chown -R oracle.dba /opt/oracle/oradata
. ~oracle/.bash_profile
rm -rf $ORACLE_HOME/oracm/log/*.ts
$ORACLE_HOME/oracm/bin/ocmstart.sh
su - oracle -c "gsdctl start"
#set oracle environment
ORACLE_HOME=/opt/oracle/product/9.2.0;export ORACLE_HOME
ORACLE_SID=smt1; export ORACLE_SID
su oracle -c "/opt/oracle/product/9.2.0/bin/sqlplus /nolog <
startup;
exit
EOF"
su oracle -c "/opt/oracle/product/9.2.0/bin/lsnrctl <
exit
EOF"
imbsmt1$ls
raw1 raw14 raw19 raw23 raw28 raw32 raw37 raw41 raw46 raw50 raw55 raw6 raw64 raw69
raw10 raw15 raw2 raw24 raw29 raw33 raw38 raw42 raw47 raw51 raw56 raw60 raw65 raw7
raw11 raw16 raw20 raw25 raw3 raw34 raw39 raw43 raw48 raw52 raw57 raw61 raw66 raw8
raw12 raw17 raw21 raw26 raw30 raw35 raw4 raw44 raw49 raw53 raw58 raw62 raw67 raw9
raw13 raw18 raw22 raw27 raw31 raw36 raw40 raw45 raw5 raw54 raw59 raw63 raw68
imbsmt1$ls -alhrt
total 0
crw------- 1 oracle dba 162, 1 Oct 1 16:46 raw1
crw------- 1 oracle dba 162, 2 Oct 1 16:46 raw2
crw------- 1 oracle dba 162, 3 Oct 1 16:46 raw3
crw------- 1 oracle dba 162, 4 Oct 1 16:46 raw4
crw------- 1 oracle dba 162, 5 Oct 1 16:46 raw5
crw------- 1 oracle dba 162, 7 Oct 1 16:46 raw7
crw------- 1 oracle dba 162, 8 Oct 1 16:46 raw8
crw------- 1 oracle dba 162, 6 Oct 1 16:46 raw6
crw------- 1 oracle dba 162, 9 Oct 1 16:46 raw9
crw------- 1 oracle dba 162, 10 Oct 1 16:46 raw10
crw------- 1 oracle dba 162, 11 Oct 1 16:46 raw11
drwxr-xr-x 2 root root 1.4K Oct 1 16:46 .
drwxr-xr-x 12 root root 6.0K Oct 1 16:46 ..
imbsmt1$ls
control pv-lvol15 pv-lvol22 pv-lvol3 pv-lvol37 pv-lvol44 pv-lvol51 pv-lvol59 pv-lvol66
pv-lvol0 pv-lvol16 pv-lvol23 pv-lvol30 pv-lvol38 pv-lvol45 pv-lvol52 pv-lvol6 pv-lvol67
pv-lvol1 pv-lvol17 pv-lvol24 pv-lvol31 pv-lvol39 pv-lvol46 pv-lvol53 pv-lvol60 pv-lvol68
pv-lvol10 pv-lvol18 pv-lvol25 pv-lvol32 pv-lvol4 pv-lvol47 pv-lvol54 pv-lvol61 pv-lvol69
pv-lvol11 pv-lvol19 pv-lvol26 pv-lvol33 pv-lvol40 pv-lvol48 pv-lvol55 pv-lvol62 pv-lvol7
pv-lvol12 pv-lvol2 pv-lvol27 pv-lvol34 pv-lvol41 pv-lvol49 pv-lvol56 pv-lvol63 pv-lvol8
pv-lvol13 pv-lvol20 pv-lvol28 pv-lvol35 pv-lvol42 pv-lvol5 pv-lvol57 pv-lvol64 pv-lvol9
pv-lvol14 pv-lvol21 pv-lvol29 pv-lvol36 pv-lvol43 pv-lvol50 pv-lvol58 pv-lvol65
imbsmt1$ls -alh
total 268K
drwxr-xr-x 2 oracle dba 4.0K Jul 30 11:11 .
drwxr-xr-x 3 oracle dba 4.0K Mar 7 2008 ..
lrwxrwxrwx 1 root root 14 Jun 6 2009 AGAENT_DATA.dbf -> /dev/raw/raw56
lrwxrwxrwx 1 root root 14 Jun 6 2009 AGAENT_INDEX.dbf -> /dev/raw/raw57
lrwxrwxrwx 1 root root 13 Mar 7 2008 CMQuorumFile -> /dev/raw/raw1
lrwxrwxrwx 1 root root 13 Mar 7 2008 control01.ctl -> /dev/raw/raw4
lrwxrwxrwx 1 root root 13 Mar 7 2008 control02.ctl -> /dev/raw/raw5
lrwxrwxrwx 1 root root 13 Mar 7 2008 control03.ctl -> /dev/raw/raw6
lrwxrwxrwx 1 root root 14 Mar 7 2008 cwmlite01.dbf -> /dev/raw/raw17
lrwxrwxrwx 1 root root 14 Mar 7 2008 drsys01.dbf -> /dev/raw/raw19
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFIS1_DATA_01a.dbf -> /dev/raw/raw28
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFISM4_DATA_01a.dbf -> /dev/raw/raw29
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFISM4_DATA_01b.dbf -> /dev/raw/raw31
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SFISM4_DATA_02a.dbf -> /dev/raw/raw30
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SMT_SCANDATA_DATA.dbf -> /dev/raw/raw32
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_01a.dbf -> /dev/raw/raw33
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_02a.dbf -> /dev/raw/raw34
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_02b.dbf -> /dev/raw/raw35
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_03a.dbf -> /dev/raw/raw36
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_04a.dbf -> /dev/raw/raw37
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_05a.dbf -> /dev/raw/raw38
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_06a.dbf -> /dev/raw/raw39
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SNDETAIL_DATA_07a.dbf -> /dev/raw/raw40
lrwxrwxrwx 1 oracle oinstall 14 Mar 7 2008 D_SWDL_DATA_01.dbf -> /dev/raw/raw27
檢視裸裝置的大小:
lslv lvsybase_data1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-709259/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- raw device, first blockdevBloC
- about raw device[zt]dev
- Raw Device vs File Systemdev
- redhat linux上不用dd清空raw device可以重複使用raw device嗎RedhatLinuxdev
- How to Choose Size of Datafile on Raw Devicedev
- [Oracle] Raw device上Create TablespaceOracledev
- 【轉】配置RAW Device磁碟組dev
- 如何遷移裸裝置raw device資料檔案到另一個raw devicedev
- 配置rhel4的raw device servicedev
- 在Linux上使用raw device方式Linuxdev
- Redhat 下raw device建庫介紹(ZT)Redhatdev
- ASM學習筆記_配置RAW Device磁碟組ASM筆記dev
- solaris 10_raw device_建立資料庫dev資料庫
- 建立raw device tablespace報Linux Error: 13: Permission denieddevLinuxError
- 【Raw Device】OEL4.8裸裝置對映方法dev
- linux下如何使用raw device來建立管理asm diskLinuxdevASM
- Red Hat Enterprise Linux AS 5.3 下配置裸裝置(raw device)Linuxdev
- Oracle9i RAC (raw device) 自動開啟(rc.local) 設定Oracledev
- oracle 10.2.0.3 dbca建庫報Failed to retrieve size of raw device 問題解決方法OracleAIdev
- 網友整理的一份Oracle10g RAC for all-version Linux -- raw deviceOracleLinuxdev
- Error:The specified shared raw partition /dev/raw/raw1...Errordev
- wrap devicedev
- device dirverdev
- platform devicePlatformdev
- RAW影像處理工具——RAW Power for MacMac
- RAW影像處理工具:RAW Power MacMac
- RAW Power for Mac(RAW影像處理軟體)Mac
- device-mapper create ioctl failed: Device or resource busydevAPPAI
- No space left on devicedev
- Camera Raw15 for mac(PS Raw增效工具)Mac
- Camera Raw 14 Mac(Raw格式影像ps外掛)Mac
- RAW影像處理工具:RAW Power for mac中文版Mac
- Multipath and Device MapperdevAPP
- Mac強大的raw影像處理軟體:RAW PowerMac
- 關於hextoraw()與utl_raw.cast_to_raw及rawtohex()AST
- 執行時報錯RuntimeError: expected device cpu but got device cuda:0ErrordevGo
- Powershell and Windows RAW SOCKETWindows
- Linux Raw DevicesLinuxdev