Redhat Linux操作系统下raw device创建Oracle数据库过程

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:54

Redhat Linux操作系统下裸设备raw device创建Oracle数据库过程

Redhat 下raw device建库介绍:
1、 Vmware下先虚拟一块新的磁盘,大小选择6G;启动redhat;

2、 在redhat下可以查看新磁盘情况:fdisk –l
看到新加的硬盘信息为:
Disk /dev/sdb: 6442MB *****

3、 先对磁盘/dev/sdb进行分区:
fdisk /dev/sdb
m是查看帮助信息
n创建新的分区:(d是删除分区)
选择是primary partition(1-4), extended
分区partition号,开始磁盘柱面,结束磁盘柱面;
创建后,可以选择p,显示分区信息;
最后w,保存退出;

4、 创建pv(pvcreate / pvremove/ pvdisplay)
fdisk –l可以看到新的分区情况,此时可看到一个device boot: /dev/sdb1
pvcreate /dev/sdb1

5、 创建vg (vgcreate/ vgremove/ vgdisplay)
vgcreate oravg /dev/sdb1

6、 创建lv(lvcreate/ lvremove /lvdisplay)
注意创建LV时必须比在将来数据库使用时多分配出一些空间:
A、建库时文件大小如果与LV大小相同会报错;
B、LV不能自动扩展;
[root@liqlx4 ~]# lvdisplay
[root@liqlx4 ~]# lvcreate -L 10m -n lv_spfile oravg
Rounding up size to full physical extent 12.00 MB
Logical volume "lv_spfile" created
[root@liqlx4 ~]# lvcreate -L 50m -n lv_control1 oravg
Rounding up size to full physical extent 52.00 MB
Logical volume "lv_control1" created
[root@liqlx4 ~]# lvcreate -L 50m -n lv_control2 oravg
Rounding up size to full physical extent 52.00 MB
Logical volume "lv_control2" created
[root@liqlx4 ~]# lvcreate -L 210m -n lv_redo111 oravg
Rounding up size to full physical extent 212.00 MB
Logical volume "lv_redo111" created
[root@liqlx4 ~]# lvcreate -L 210m -n lv_redo121 oravg
Rounding up size to full physical extent 212.00 MB
Logical volume "lv_redo121" created
[root@liqlx4 ~]# lvcreate -L 210m -n lv_redo131 oravg
Rounding up size to full physical extent 212.00 MB
Logical volume "lv_redo131" created
[root@liqlx4 ~]# lvcreate -L 1036m -n lv_system1 oravg
Logical volume "lv_system1" created
[root@liqlx4 ~]# lvcreate -L 1036m -n lv_temp1 oravg
Logical volume "lv_temp1" created
[root@liqlx4 ~]# lvcreate -L 520m -n lv_user1 oravg
Logical volume "lv_user1" created
[root@liqlx4 ~]# lvcreate -L 396m -n lv_sysaux1 oravg
Logical volume "lv_sysaux1" created
[root@liqlx4 ~]# lvcreate -L 1036m -n lv_undotbs1 oravg
Logical volume "lv_undotbs1" created
[root@liqlx4 ~]#

7、 将lv绑定对应的raw设备:
[root@liqlx4 ~]# cd /dev/raw
bash: cd: /dev/raw: No such file or directory
[root@liqlx4 ~]# cd /dev
[root@liqlx4 dev]# ls raw
ls: raw: No such file or directory
[root@liqlx4 dev]# raw /dev/raw/raw1 /dev/oravg/lv_spfile
/dev/raw/raw1: bound to major 253, minor 0
[root@liqlx4 dev]# ls raw
raw1
[root@liqlx4 dev]# pwd
/dev
[root@liqlx4 dev]# cd raw
[root@liqlx4 raw]# ls
raw1
[root@liqlx4 raw]# pwd
/dev/raw
[root@liqlx4 raw]#
[root@liqlx4 raw]# raw /dev/raw/raw2 /dev/oravg/lv_control1
/dev/raw/raw2: bound to major 253, minor 1
[root@liqlx4 raw]# raw /dev/raw/raw3 /dev/oravg/lv_control2
/dev/raw/raw3: bound to major 253, minor 2
[root@liqlx4 raw]# raw /dev/raw/raw4 /dev/oravg/lv_redo111
/dev/raw/raw4: bound to major 253, minor 3
[root@liqlx4 raw]# raw /dev/raw/raw5 /dev/oravg/lv_redo121
/dev/raw/raw5: bound to major 253, minor 4
[root@liqlx4 raw]# raw /dev/raw/raw6 /dev/oravg/lv_redo131
/dev/raw/raw6: bound to major 253, minor 5
[root@liqlx4 raw]# raw /dev/raw/raw7 /dev/oravg/lv_system1
/dev/raw/raw7: bound to major 253, minor 6
[root@liqlx4 raw]# raw /dev/raw/raw8 /dev/oravg/lv_temp1
/dev/raw/raw8: bound to major 253, minor 7
[root@liqlx4 raw]# raw /dev/raw/raw9 /dev/oravg/lv_user1
/dev/raw/raw9: bound to major 253, minor 8
[root@liqlx4 raw]# raw /dev/raw/raw10 /dev/oravg/lv_sysaux1
/dev/raw/raw10: bound to major 253, minor 9
[root@liqlx4 raw]# raw /dev/raw/raw11 /dev/oravg/lv_undotbs1
/dev/raw/raw11: bound to major 253, minor 10

8、 配置系统自动加载裸设备:
[root@liqlx4 raw]# cd /etc/sysconfig
[root@liqlx4 sysconfig]# vi rawdevices
/dev/raw/raw1 /dev/oravg/lv_spfile
/dev/raw/raw2 /dev/oravg/lv_control1
/dev/raw/raw3 /dev/oravg/lv_control2
/dev/raw/raw4 /dev/oravg/lv_redo111
/dev/raw/raw5 /dev/oravg/lv_redo121
/dev/raw/raw6 /dev/oravg/lv_redo131
/dev/raw/raw7 /dev/oravg/lv_system1
/dev/raw/raw8 /dev/oravg/lv_temp1
/dev/raw/raw9 /dev/oravg/lv_user1
/dev/raw/raw10 /dev/oravg/lv_sysaux1
/dev/raw/raw11 /dev/oravg/lv_undotbs1

9、 将相应RAW授权给ORACLE用户:
chown –R oracle:oinstall /dev/raw/*
chmod 777 /dev/raw/*
配置自动授权:
[root@liqlx4 rc.d]# pwd
/etc/rc.d
[root@liqlx4 rc.d]# vi rc.local
chown -R oracle:oinstall /dev/raw/*
chmod 777 /dev/raw/*

10、编写ORACLE裸设备配置文件,DBCA得到建库脚本:
创建DBCA 裸设备的dbca_raw_config配置文件:
控制文件信息:

数据文件信息:

选择生成脚本:

脚本生成完毕:

[oracle@liqlx4 dbs]$ pwd
/u01/app/oracle/product/ora10g/dbs
[oracle@liqlx4 dbs]$ vi dbca_raw_config
spfile=/dev/raw/raw1
control1=/dev/raw/raw2
control2=/dev/raw/raw3
redo1_1=/dev/raw/raw4
redo2_1=/dev/raw/raw5
redo3_1=/dev/raw/raw6
system=/dev/raw/raw7
temp=/dev/raw/raw8
users=/dev/raw/raw9
sysaux=/dev/raw/raw10
undotbs1=/dev/raw/raw11

dbca得到建库脚本;

11、运行建库脚本:
cd $ORACLE_BASE/admin/lx4raw10g/scripts
sh lx4raw10g.sh

12、进入数据库查看数据库状态是否正常:
Sqlplus “/ as sysdba”
SPFILE文件:
SQL> show parameter pfile;

NAME TYPE
------------------------------------ ----------------------
VALUE
------------------------------
spfile string
/dev/raw/raw1
控制文件:
SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/dev/raw/raw2
/dev/raw/raw3

SQL> select member from v$logfile order by group#;

MEMBER
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/dev/raw/raw4
/dev/raw/raw5
/dev/raw/raw6

数据表空间:
TABLESPACE_NAME FILE_NAME
--------------- ------------------------------
SYSAUX /dev/raw/raw10
UNDOTBS1 /dev/raw/raw11
SYSTEM /dev/raw/raw7
USERS /dev/raw/raw9

临时表空间:
TABLESPACE_NAME FILE_NAME
--------------- ------------------------------
TEMP /dev/raw/raw8

至此,裸设备全库创建完毕,状态正常。

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】