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  --&gt   /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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26217983/viewspace-1123876/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值