linux 使用裸设备创建表空间
短信预约 -IT技能 免费直播动态提醒
环境
系统环境
[root@node1 ~]# uname -a
Linux node1 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@node1 ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
[root@node1 ~]#
oracle环境
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
查看磁盘
[root@node1 ~]# 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 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 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/sdb1 1 2610 20964793+ 83 Linux
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
给/dev/sdc 划分一个1g的分区 用作裸设备
[root@node1 ~]# fdisk /dev/sdc
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 1044.
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): +1024M
Command (m for help): p
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 125 1004031 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
修改/etc/udev/rules.d/60-raw.rules 文件
[root@node1 ~]# 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.
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="3", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", ENV{MAJOR}=="7", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
~
启动裸设备
[root@node1 ~]# start_udev
Starting udev: [ OK ]
[root@node1 ~]#
修改裸设备的主设备号和复设备号
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 8, minor 33
[root@node1 ~]# raw /dev/raw/raw1 1 1
/dev/raw/raw1: bound to major 1, minor 1
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 1, minor 1
删除裸设备,当然还必须修改/etc/udev/rules.d/60-raw.rules 文件
[root@node1 ~]# raw /dev/raw/raw1 0 0
/dev/raw/raw1: bound to major 0, minor 0
[root@node1 ~]# raw -qa
[root@node1 ~]# raw /dev/raw/raw1 1 1
/dev/raw/raw1: bound to major 1, minor 1
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 1, minor 1
修改裸设备的权限
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 8, minor 33
/dev/raw/raw2: bound to major 8, minor 34
[root@node1 ~]# cd /dev/raw
[root@node1 raw]# ls -l
total 0
crw------- 1 root root 162, 1 Apr 7 18:03 raw1
crw------- 1 root root 162, 2 Apr 7 18:03 raw2
[root@node1 raw]# chown oracle:oinstall raw1
[root@node1 raw]# chown oracle:oinstall raw2
[root@node1 raw]# chmod 775 raw1 raw2
[root@node1 raw]# ls -l
total 0
crwxrwxr-x 1 oracle oinstall 162, 1 Apr 7 18:03 raw1
crwxrwxr-x 1 oracle oinstall 162, 2 Apr 7 18:03 raw2
查看裸设备的可用空间
[root@node1 raw]# blockdev --getsize /dev/raw/raw1
2008062
[root@node1 raw]# blockdev --getsize /dev/raw/raw2
2008125
2008125*512/1024/1024=980M
在oracle中添加裸设备为数据文件的表空间
SQL> create tablespace tbs_raw datafile'/dev/raw/raw1' size 950m;
Tablespace created.
系统环境
[root@node1 ~]# uname -a
Linux node1 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@node1 ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
[root@node1 ~]#
oracle环境
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
查看磁盘
[root@node1 ~]# 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 2610 20860402+ 8e Linux LVM
Disk /dev/sdb: 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/sdb1 1 2610 20964793+ 83 Linux
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
给/dev/sdc 划分一个1g的分区 用作裸设备
[root@node1 ~]# fdisk /dev/sdc
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 1044.
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): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1044, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): +1024M
Command (m for help): p
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 125 1004031 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
修改/etc/udev/rules.d/60-raw.rules 文件
[root@node1 ~]# 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.
ACTION=="add", KERNEL=="sdc1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="3", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", ENV{MAJOR}=="7", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
~
启动裸设备
[root@node1 ~]# start_udev
Starting udev: [ OK ]
[root@node1 ~]#
修改裸设备的主设备号和复设备号
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 8, minor 33
[root@node1 ~]# raw /dev/raw/raw1 1 1
/dev/raw/raw1: bound to major 1, minor 1
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 1, minor 1
删除裸设备,当然还必须修改/etc/udev/rules.d/60-raw.rules 文件
[root@node1 ~]# raw /dev/raw/raw1 0 0
/dev/raw/raw1: bound to major 0, minor 0
[root@node1 ~]# raw -qa
[root@node1 ~]# raw /dev/raw/raw1 1 1
/dev/raw/raw1: bound to major 1, minor 1
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 1, minor 1
修改裸设备的权限
[root@node1 ~]# raw -qa
/dev/raw/raw1: bound to major 8, minor 33
/dev/raw/raw2: bound to major 8, minor 34
[root@node1 ~]# cd /dev/raw
[root@node1 raw]# ls -l
total 0
crw------- 1 root root 162, 1 Apr 7 18:03 raw1
crw------- 1 root root 162, 2 Apr 7 18:03 raw2
[root@node1 raw]# chown oracle:oinstall raw1
[root@node1 raw]# chown oracle:oinstall raw2
[root@node1 raw]# chmod 775 raw1 raw2
[root@node1 raw]# ls -l
total 0
crwxrwxr-x 1 oracle oinstall 162, 1 Apr 7 18:03 raw1
crwxrwxr-x 1 oracle oinstall 162, 2 Apr 7 18:03 raw2
查看裸设备的可用空间
[root@node1 raw]# blockdev --getsize /dev/raw/raw1
2008062
[root@node1 raw]# blockdev --getsize /dev/raw/raw2
2008125
2008125*512/1024/1024=980M
在oracle中添加裸设备为数据文件的表空间
SQL> create tablespace tbs_raw datafile'/dev/raw/raw1' size 950m;
Tablespace created.
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
linux 使用裸设备创建表空间
下载Word文档到电脑,方便收藏和打印~
下载Word文档
猜你喜欢
linux 使用裸设备创建表空间
环境系统环境[root@node1 ~]# uname -aLinux node1 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
2023-06-06
2024-04-02
2024-04-02
2024-04-02
Navicat中怎么创建和使用表空间
在Navicat中创建和使用表空间,可以按照以下步骤进行操作:打开Navicat连接到你的数据库服务器。在连接窗口中选择你的数据库,右键点击该数据库,选择“新建表空间”选项。在弹出的对话框中填写表空间的名称、存储引擎、字符集等信息,然后
2024-05-11
2024-04-02
2024-04-02
2024-04-02
2024-04-02
2024-04-02
2024-04-02
Oracle 创建表空间和用户脚本
=============================================================== /*第1步:创建临时表空间(注意:D:ProjectOracleTableSpaceFHADMIN 手动创建路径)
2015-11-21
2024-04-02
plsql怎么创建表空间和用户
要在PL/SQL中创建表空间和用户,可以按照以下步骤进行操作:1. 创建表空间:```CREATE TABLESPACE tablespace_nameDATAFILE 'path_to_datafile'SIZE size_in_byte
2023-09-09
2024-04-02
oracle如何创建用户和表空间
要在Oracle数据库中创建用户和表空间,您需要具有适当的权限。以下是创建用户和表空间的步骤:创建表空间:CREATE TABLESPACE tablespace_nameDATAFILE 'path_to_datafile.d
2024-04-09
2024-04-02
2024-04-02
oracle如何创建用户指定表空间
要在Oracle中创建一个用户并指定表空间,可以按照以下步骤进行操作:1. 以具有适当权限的用户登录到Oracle数据库。2. 使用以下语法创建用户:```sqlCREATE USER username IDENTIFIED BY pass
2023-08-23
oracle 创建表空间、用户 4个步骤
create temporary tablespace C##FHADMIN_TEMP tempfile "D:P
2019-08-17