Redhat5.8 X64建立裸裝置
Redhat5.8 X64建立裸裝置
1) 裸裝置建立在sdb上
# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 268 2048287+ 82 Linux swap / Solaris
/dev/sda3 269 2610 18812115 83 Linux
Disk /dev/sdb: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
2) 建立分割槽
# fdisk /dev/sdb
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.
The number of cylinders for this disk is set to 1958.
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)
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-1958, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1958, default 1958): +1024M
//分1GB
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
3) 檢視分割槽
# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 268 2048287+ 82 Linux swap / Solaris
/dev/sda3 269 2610 18812115 83 Linux
Disk /dev/sdb: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 125 1004031 83 Linux
4) 利用分割槽建立PV
# pvcreate /dev/sdb1
Writing physical volume data to disk "/dev/sdb1"
Physical volume "/dev/sdb1" successfully created
5) 檢視PV資訊
# pvdisplay /dev/sdb1
"/dev/sdb1" is a new physical volume of "980.50 MB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 980.50 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID KhQgMz-onKa-6gAL-Nybp-jt59-ux7O-CItJef
6) 建立VG
# vgcreate oravg /dev/sdb1
Volume group "oravg" successfully created
檢視VG
# vgs
VG #PV #LV #SN Attr VSize VFree
oravg 1 0 0 wz--n- 980.00M 980.00M
7) 建立LV
# lvcreate -n test_lv -L 512M oravg
# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
test_lv oravg -wi-a- 512.00M
# ls -l /dev/oravg/
total 0
lrwxrwxrwx 1 root root 25 Oct 20 22:39 test_lv -> /dev/mapper/oravg-test_lv
lvremove /dev/oravg/ test_lv --刪除lv
8) 繫結裸裝置
# raw /dev/raw/raw1 /dev/mapper/oravg-test_lv
/dev/raw/raw1: bound to major 253, minor 0
--注意,之前是沒有/dev/raw目錄的,執行後會自動建立
查詢裸裝置
# raw -qa
/dev/raw/raw1: bound to major 253, minor 0
9) 給新建立的裸裝置增加許可權,以使oracle能使用
# chown -R oracle:oinstall /dev/mapper/oravg-test_lv
重啟許可權會丟失,寫到開機啟動裡
vi /etc/rc.d/rc.local
chown -R oracle:oinstall /dev/mapper/oravg-test_lv
10) 為了保證重啟後,可以掛載裸裝置,修改下面檔案,新增內容
# vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/mapper/oravg-test_lv
重啟裸裝置服務,檢視裝置是否存在
# /etc/init.d/rawdevices restart
Assigning devices:
/dev/raw/raw1 --> /dev/mapper/oravg-test_lv
/dev/raw/raw1: bound to major 253, minor 0
done
[root@oracle mapper]# ls -l /dev/mapper/
total 0
crw------- 1 root root 10, 60 Oct 20 22:28 control
brw-rw---- 1 oracle oinstall 253, 0 Oct 20 22:39 oravg-test_lv
11) 建立ORACLE表空間
SQL> create tablespace test datafile '/dev/mapper/oravg-test_lv';
Tablespace created.
SQL> select file_name,tablespace_name,bytes/1024/1024 MB from dba_data_files;
FILE_NAME TABLESPACE_NAME MB
----------------------------------- ------------------------------ ----------
/u01/oradata/oral/system01.dbf SYSTEM 700
/u01/oradata/oral/sysaux01.dbf SYSAUX 560
/u01/oradata/oral/undotbs01.dbf UNDOTBS1 890
/u01/oradata/oral/users01.dbf USERS 5
/dev/mapper/oravg-test_lv TEST 511.992188
-- SQL> drop tablespace test; --裸裝置上drop表空間,不需要帶including ... and ... ,否則會連裸裝置也刪除了
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26217983/viewspace-1123876/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 建立裸裝置庫
- Linux-建立裸裝置RawLinux
- linux上建立裸裝置問答Linux
- linux 使用裸裝置建立表空間Linux
- 字元裝置、塊裝置與裸裝置字元
- 字元裝置、塊裝置、裸裝置、RAW裝置 .字元
- Oracle RAC--在Linux中建立裸裝置OracleLinux
- RHEL5中裸裝置的建立簡介
- linux下使用裸裝置建立oracle表空間LinuxOracle
- aix5.3上使用裸裝置建立表空間AI
- AIX 上建立裸裝置lv出現的問題AI
- raw 裸裝置資料檔案更改其他raw裸裝置位置
- udev 裸裝置 安裝racdev
- 裸裝置、字元裝置、塊裝置不全面比較字元
- 裸裝置與塊裝置的區別
- 建立資料庫時用裸裝置的配置檔案資料庫
- 在unix下和linux下建立裸裝置總結Linux
- AIX中的裸裝置AI
- oracle 裸裝置(轉載)Oracle
- 為ASM生成裸裝置ASM
- linux裸裝置操作Linux
- Linux裸裝置總結Linux
- 【儲存】裸裝置和OracleOracle
- linux下新增裸裝置Linux
- 裸裝置基礎知識
- linux下配置裸裝置Linux
- oracle安裝使用裸裝置問題Oracle
- Linux下基於裸裝置建立10g資料庫Linux資料庫
- linux udev裸裝置繫結Linuxdev
- linux下裸裝置的使用Linux
- Linux裸裝置管理詳解Linux
- 裸裝置基礎知識(轉)
- Linux裸裝置管理學習Linux
- Linux裸裝置總結(ZT)Linux
- LINUX下裸裝置的操作Linux
- LINUX裸裝置取消繫結Linux
- 用裸裝置安裝RAC 10g
- DM7使用裸裝置搭建DMRAC