ITPub博客

首页 > Linux操作系统 > Linux操作系统 > AIX使用raw device做数据文件

AIX使用raw device做数据文件

原创 Linux操作系统 作者:ddba 时间:2019-04-13 16:27:07 0 删除 编辑
摘自http://www.itpub.net/705738.html 一个好案例~[@more@]

在AIX下使用裸设备做数据文件失败,下面是过程:

# oslevel
5.2.0.0

# mklv -y 'raw000' -t 'raw' oravg 4
raw000

# ls -l /dev/raw000
brw-rw---- 1 root system 35, 16 Jan 14 10:38 /dev/raw000

# chmod 777 /dev/raw000

# chown oracle:dba /dev/raw000
# ls -l /dev/raw000
brwxrwxrwx 1 oracle dba 35, 16 Jan 14 10:38 /dev/raw000

# su - oracle
$ sqlplus "/ as sysdba"
SQL> create tablespace raw000
2 datafile '/dev/raw000' size 100m;
create tablespace raw000
*
ERROR at line 1:
ORA-01119: error in creating database file '/dev/raw000'
ORA-27038: skgfrcre: file exists



$ lslv raw000
LOGICAL VOLUME: raw000 VOLUME GROUP: oravg
LV IDENTIFIER: 005d666a00004c000000010cf7316165.16 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/syncd
TYPE: raw WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 64 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 4 PPs: 4
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 32
MOUNT POINT: N/A LABEL: None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO
$

toms_zhang:

数据文件的名字写错了
你要用rraw000这个设备,不是那个块设备
chown oracle:dba /dev/rraw000
create tablespace raw000
datafile '/dev/rraw000' size 100m;

kamus:

lsvg -l vgname得到的是lv的名字,裸设备的话则是rlv*

这是我们在AIX的raw device上创建数据库的命令,你可以参考一下,包括了控制文件,表空间,redo

CREATE DATABASE fwsk
CONTROLFILE REUSE
MAXINSTANCES 32
MAXLOGHISTORY 0
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
DATAFILE '/dev/rlvfwsk_system' SIZE 1023M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE '/dev/rlvfwsk_temp01' SIZE 10000M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE "UNDOTBS1" DATAFILE '/dev/rlvfwsk_undotbs1' SIZE 10000M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
LOGFILE
GROUP 1 ('/dev/rlvfwsk_log11a', '/dev/rlvfwsk_log11b') SIZE 510M reuse,
GROUP 2 ('/dev/rlvfwsk_log12a', '/dev/rlvfwsk_log12b') SIZE 510M reuse,
GROUP 3 ('/dev/rlvfwsk_log13a', '/dev/rlvfwsk_log13b') SIZE 510M reuse,
GROUP 4 ('/dev/rlvfwsk_log14a', '/dev/rlvfwsk_log14b') SIZE 510M reuse;

结论:

创建lv时会同时生成2个设备,一个为字符设备,一个为块设备。
字符设备,C打头,在传输数据时一次传输一个字符,被称为裸设备,空间管理由数据库引擎来完成,而且由于使用的是原始分区避免了空间管理的开销,所以比文件系统在i/o方面更快些。
块设备,B打头,在传输时要经过cache。

再次试验:
# mklv -y 'rawtbs' -t 'raw' oravg 4
rawtbs
# ls -l /dev/*rawtbs*
brw-rw---- 1 root system 35, 17 Jan 14 15:08 /dev/rawtbs
crw-rw---- 1 root system 35, 17 Jan 14 15:08 /dev/rrawtbs
# lslv rawtbs
LOGICAL VOLUME: rawtbs VOLUME GROUP: oravg
LV IDENTIFIER: 005d666a00004c000000010cf7316165.17 PERMISSION: read/write
VG STATE: active/complete LV STATE: closed/syncd
TYPE: raw WRITE VERIFY: off
MAX LPs: 512 PP SIZE: 64 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 4 PPs: 4
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 32
MOUNT POINT: N/A LABEL: None
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO

# chmod 775 /dev/rrawtbs
# chown oracle:dba /dev/rrawtbs
# ls -l /dev/*rawtbs*
brw-rw---- 1 root system 35, 17 Jan 14 15:08 /dev/rawtbs
crwxrwxr-x 1 oracle dba 35, 17 Jan 14 15:08 /dev/rrawtbs
# su - oracle
$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.1.0 - Production on Sun Jan 14 15:10:10 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

SQL> drop tablespace rawtbs including contents and datafiles;
drop tablespace rawtbs including contents and datafiles
*
ERROR at line 1:
ORA-00959: tablespace 'RAWTBS' does not exist


SQL> create tablespace rawtbs
2 datafile '/dev/rrawtbs' size 255m;

Tablespace created.

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
$ ls -l /dev/*rawtbs*
brw-rw---- 1 root system 35, 17 Jan 14 15:08 /dev/rawtbs
crwxrwxr-x 1 oracle dba 35, 17 Jan 14 15:11 /dev/rrawtbs
$

blue_prince:

用祼设备做数据文件建议创建软LINK,这样就像维护文件系统一样简单了,如:
ln -s /dev/rlv_test_8g_138 /u01/oracle/oradata/test/test_34.dbf

这样添加数据文件时,直接add datafile '/u01/oracle/oradata/test/test_34.dbf '

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7794469/viewspace-890437/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2006-09-21

  • 博文量
    31
  • 访问量
    23956