当前位置:  数据库>oracle

Oracle使用raw via lvm

    来源: 互联网  发布时间:2017-05-20

    本文导语: 早上为另外一个公司的一个生产库处理raw使用的问题,现场人员说要把新的lvm的空间给Oracle使用,已经化好lv了,也绑定了映射,但是一直看不到raw;检查了下相关绑定规则参数,而且已经有在使用的规则绑定,他只是copy了新的...

早上为另外一个公司的一个生产库处理raw使用的问题,现场人员说要把新的lvm的空间给Oracle使用,已经化好lv了,也绑定了映射,但是一直看不到raw;检查了下相关绑定规则参数,而且已经有在使用的规则绑定,他只是copy了新的规则并稍作修改,但是就是不生效。以下是测试过程。

[root@o564gtser1 ~]# fdisk -l Disk /dev/sdd

Disk /dev/sdd: 524 MB, 524288000 bytes
255 heads, 63 sectors/track, 63 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table
[root@o564gtser1 ~]# fdisk /dev/sdd
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.

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-63, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-63, default 63):
Using default value 63

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@o564gtser1 ~]# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created
[root@o564gtser1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdd1 lvm2 a- 494.16M 494.16M
[root@o564gtser1 ~]# pvdisplay
"/dev/sdd1" is a new physical volume of "494.16 MB"
--- NEW Physical volume ---
PV Name /dev/sdd1
VG Name
PV Size 494.16 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID bgfuhw-eOve-5n87-gKoV-ApCh-GDuv-0WKzJ3

[root@o564gtser1 ~]# vgcreate oravg /dev/sdd1
Volume group "oravg" successfully created
[root@o564gtser1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
oravg 1 0 0 wz--n- 492.00M 492.00M
[root@o564gtser1 ~]# vgdisplay
--- Volume group ---
VG Name oravg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 492.00 MB
PE Size 4.00 MB
Total PE 123
Alloc PE / Size 0 / 0
Free PE / Size 123 / 492.00 MB
VG UUID 6KYQkB-3W81-fMAa-vBJ0-9UXk-jaRd-XRMOUQ

[root@o564gtser1 ~]# vgs oravg
VG #PV #LV #SN Attr VSize VFree
oravg 1 0 0 wz--n- 492.00M 492.00M
[root@o564gtser1 ~]# vgdisplay oravg
--- Volume group ---
VG Name oravg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 492.00 MB
PE Size 4.00 MB
Total PE 123
Alloc PE / Size 0 / 0
Free PE / Size 123 / 492.00 MB
VG UUID 6KYQkB-3W81-fMAa-vBJ0-9UXk-jaRd-XRMOUQ

[root@o564gtser1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdd1 oravg lvm2 a- 492.00M 492.00M
[root@o564gtser1 ~]# lvcreate -L200MB -n oralv1 oravg
Logical volume "oralv1" created
[root@o564gtser1 ~]# lvcreate -L200MB -n oralv2 oravg
Logical volume "oralv2" created
[root@o564gtser1 ~]# vgdisplay -v
Finding all volume groups
Finding volume group "oravg"
--- Volume group ---
VG Name oravg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size 492.00 MB
PE Size 4.00 MB
Total PE 123
Alloc PE / Size 100 / 400.00 MB
Free PE / Size 23 / 92.00 MB
VG UUID 6KYQkB-3W81-fMAa-vBJ0-9UXk-jaRd-XRMOUQ

--- Logical volume ---
LV Name /dev/oravg/oralv1
VG Name oravg
LV UUID p5LNXk-X32Y-hAV7-sZQZ-7SId-OOPp-7QCpFK
LV Write Access read/write
LV Status available
# open 0
LV Size 200.00 MB
Current LE 50
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Name /dev/oravg/oralv2
VG Name oravg
LV UUID 7gFlM5-miH2-ARpg-1LTc-FQb5-zQX6-Hk0d5u
LV Write Access read/write
LV Status available
# open 0
LV Size 200.00 MB
Current LE 50
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

--- Physical volumes ---
PV Name /dev/sdd1
PV UUID bgfuhw-eOve-5n87-gKoV-ApCh-GDuv-0WKzJ3
PV Status allocatable
Total PE / Free PE 123 / 23

[root@o564gtser1 ~]# ls -lL /dev/oravg/oralv*
brw-rw---- 1 root disk 253, 0 04-18 12:27 /dev/oravg/oralv1
brw-rw---- 1 root disk 253, 1 04-18 12:27 /dev/oravg/oralv2
[root@o564gtser1 ~]# ls /dev/mapper/* -l
crw------- 1 root root 10, 62 04-18 12:20 /dev/mapper/control
brw-rw---- 1 root disk 253, 0 04-18 12:27 /dev/mapper/oravg-oralv1
brw-rw---- 1 root disk 253, 1 04-18 12:27 /dev/mapper/oravg-oralv2
[root@o564gtser1 ~]# vi /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
"/etc/udev/rules.d/60-raw.rules" 11L, 472C written

[root@o564gtser1 ~]# cat /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.


ACTION=="add", KERNEL=="/dev/oravg/oralv1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="/dev/oravg/oralv2", RUN+="/bin/raw /dev/raw/raw4 %N"
KERNEL=="raw[3-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
[root@o564gtser1 ~]# start_udev
启动 udev: [确定]
[root@o564gtser1 ~]# raw -aq
/dev/raw/raw1: bound to major 8, minor 16
/dev/raw/raw2: bound to major 8, minor 32
重启os,还是无效看不到raw3和raw4.
[root@o564gtser1 ~]# cat /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.


ACTION=="add", KERNEL=="/dev/oravg/oralv1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="/dev/oravg/oralv2", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="253", ENV{MINOR}=="0", RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", ENV{MAJOR}=="253", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw4 %M %m"
KERNEL=="raw[3-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
重启os,还是无效看不到raw3和raw4.
[root@o564gtser1 ~]# cat /etc/udev/rules.d/60-raw.rules
# Enter raw device bindings here.
#
# An example would be:
# ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
# ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.


ACTION=="add", KERNEL=="/dev/mapper/oravg-oralv1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="/dev/mapper/oravg-oralv2", RUN+="/bin/raw /dev/raw/raw4 %N"
#ACTION=="add", ENV{MAJOR}=="253", ENV{MINOR}=="0", RUN+="/bin/raw /dev/raw/raw3 %M %m"
#ACTION=="add", ENV{MAJOR}=="253", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw4 %M %m"
KERNEL=="raw[3-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
重启os,还是无效看不到raw3和raw4.
使用手工测试了下发现是可以的:
[root@o564gtser1 ~]# /bin/raw /dev/raw/raw3 /dev/mapper/oravg-oralv1
/dev/raw/raw3: bound to major 253, minor 0
[root@o564gtser1 ~]# /bin/raw /dev/raw/raw4 /dev/mapper/oravg-oralv2
/dev/raw/raw4: bound to major 253, minor 1
[root@o564gtser1 ~]# raw -qa
/dev/raw/raw1: bound to major 8, minor 16
/dev/raw/raw2: bound to major 8, minor 32
/dev/raw/raw3: bound to major 253, minor 0
/dev/raw/raw4: bound to major 253, minor 1
[root@o564gtser1 ~]# ll /dev/raw/*
crw-r----- 1 oracle oinstall 162, 1 04-18 13:03 /dev/raw/raw1
crw-r----- 1 oracle oinstall 162, 2 04-18 13:03 /dev/raw/raw2
crw-r----- 1 oracle oinstall 162, 3 04-18 13:09 /dev/raw/raw3
crw-r----- 1 oracle oinstall 162, 4 04-18 13:10 /dev/raw/raw4
只好将上述两行命令写入/etc/rc.d/rc.local :
#add by gtlions test for lvm used in oracle
/bin/raw /dev/raw/raw3 /dev/mapper/oravg-oralv1
/bin/raw /dev/raw/raw4 /dev/mapper/oravg-oralv2
chown oracle:oinstall /dev/raw/raw3
chown oracle:oinstall /dev/raw/raw4
chmod 640 /dev/raw/raw3
chmod 640 /dev/raw/raw4
并删除/etc/udev/rules.d/60-raw.rules内的原来设置的内容即可。
这样就可以在Oracle中使用了:
[oracle@o564gtser1 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Apr 18 13:25:48 2013

Copyright (c) 1982, 2010, Oracle. All Rights Reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 281018368 bytes
Fixed Size 2095672 bytes
Variable Size 96470472 bytes
Database Buffers 176160768 bytes
Redo Buffers 6291456 bytes
Database mounted.
Database opened.
SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA01/gt10g/datafile/system.260.812537713
+DATA01/gt10g/datafile/undotbs1.261.812537743
+DATA01/gt10g/datafile/sysaux.262.812537763
+DATA01/gt10g/datafile/users.264.812537785
SQL> create tablespace test datafile '/dev/raw/raw3' size 190m autoextend off;

Tablespace created.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA01/gt10g/datafile/system.260.812537713
+DATA01/gt10g/datafile/undotbs1.261.812537743
+DATA01/gt10g/datafile/sysaux.262.812537763
+DATA01/gt10g/datafile/users.264.812537785
/dev/raw/raw3
看来是要直接写入到/etc/rc.d/rc.local。


    
 
 

您可能感兴趣的文章:

  • linux下安装oracle后使用命令行启动的方法 linux启动oracle
  • Oracle9i 9.0.1的JDBC Drivers 可以给Oracle 8.0.5使用马?
  • Suse linux使用oracle问题
  • 请问:在使用oracle数据库作开发时,是使用pro*c作开发好些,还是使用库函数如oci等好一些啊?或者它们有什么区别或者优缺点啊?
  • jbuilder中使用oracle的问题
  • 求redhat linux 9.0下可以使用的oracle 10g或9i,还有redhat linux 9.0下可以使用的eclipse下载地址
  • Oracle事务!使用游标提交过程
  • 在Jbuilder7下,使用DbPilot.exe连接oracle,报错!请教高手!
  • AIX 64位系统上如何使用32位OCI oracle driver
  • Oracle中SQL语句连接字符串的符号使用介绍
  • 编程技术其它 iis7站长之家
  • C++使用OCCI连Oracle10g的错误
  • 使用工具 plsqldev将Excel导入Oracle数据库
  • Linux下Oracle的sqlplus使用光标上下左右方法
  • Oracle 数据 使用游标
  • oracle使用sql脚本生成csv文件案例学习
  • ORACLE 修改表结构 之ALTER CONSTAINTS的使用
  • Linux中Oracle使用相关知识集锦
  • Oracle密码文件的使用和维护第1/3页
  • Oracle 触发器的使用小结
  • Oracle中的Raw类型解释
  • 高分求救:谁用过JSP处理ORACLE数据库中的LONG RAW类型字段
  •  
    本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
    本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍
  • SCO unix下安装oracle,但没有光盘,请大家推荐一个oracle下载站点(unix版本的)。谢谢!!!!
  • oracle中如何把表中具有相同值列的多行数据合并成一行
  • 请问大家用oracle数据库, 用import oracle.*;下的东西么? 还是用标准库?
  • Oracle 数据库(oracle Database)性能调优技术详解
  • Linux /$ORACLE_HOME $ORACLE_HOME
  • ORACLE日期相关操作
  • Linux系统下Oracle的启动与Oracle监听的启动
  • ORACLE数据库常用字段数据类型介绍
  • 请问在solaris下安装ORACLE,用root用户和用oracle用户安装有什么区别么?
  • Oracle 12c的九大最新技术特性介绍
  • 网间Oracle的连接,远程连接Oracle服务器??


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,