我的环境很简单,vm workstation下面装了一个linux 4,oracle 10g版本,由于不属于trouble shooting和performance tuning
而只是搭建一套裸设备的数据库,所以我这里不查看详细的linux和oracle版本信息,由于是基于LVM
的存储管理,所以只需要确保linux下面安装了lvm包,rmp -qa | grep lvm即可查询。
而只是搭建一套裸设备的数据库,所以我这里不查看详细的linux和oracle版本信息,由于是基于LVM
的存储管理,所以只需要确保linux下面安装了lvm包,rmp -qa | grep lvm即可查询。
1.首先我在linux虚拟机下加了一块大小为10g的磁盘,我将该磁盘分两个区,两个分区建两个对应的pv,两个pv建一个名称为oradatavg的卷组,在该vg下建创建数据库
文件的裸设备,关于linux如何分区和lvm的内容可以参考我相关的日志,此处不介绍,创建完成后vgdisplay命令查看我的vg信息如下:
[root@localhost ~]# vgdisplay oradatavg
--- Volume group ---
VG Name oradatavg
System ID
Format lvm2
Metadata Areas 2
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 2
Act PV 2
VG Size 9.19 GB
PE Size 4.00 MB
Total PE 2352
Alloc PE / Size 0 / 0
Free PE / Size 2352 / 9.19 GB
VG UUID N2iygE-18cd-AXuR-3ZEu-4UXr-XYfd-v9IKU0
[root@localhost ~]#
可以看出两块PV,vg大小9.19G。
文件的裸设备,关于linux如何分区和lvm的内容可以参考我相关的日志,此处不介绍,创建完成后vgdisplay命令查看我的vg信息如下:
[root@localhost ~]# vgdisplay oradatavg
--- Volume group ---
VG Name oradatavg
System ID
Format lvm2
Metadata Areas 2
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 2
Act PV 2
VG Size 9.19 GB
PE Size 4.00 MB
Total PE 2352
Alloc PE / Size 0 / 0
Free PE / Size 2352 / 9.19 GB
VG UUID N2iygE-18cd-AXuR-3ZEu-4UXr-XYfd-v9IKU0
[root@localhost ~]#
可以看出两块PV,vg大小9.19G。
2.创建lv:
lvcreate -L 8M -n lv_spfile oradatavg
lvcreate -L 20M -n lv_control01 oradatavg
lvcreate -L 20M -n lv_control02 oradatavg
lvcreate -L 20M -n lv_redo01 oradatavg
lvcreate -L 20M -n lv_redo02 oradatavg
lvcreate -L 500M -n lv_system01 oradatavg
lvcreate -L 500M -n lv_sysaux01 oradatavg
lvcreate -L 500M -n lv_users01 oradatavg
lvcreate -L 20M -n lv_undo01 oradatavg
lvcreate -L 20M -n lv_temp01 oradatavg
lvcreate -L 8M -n lv_spfile oradatavg
lvcreate -L 20M -n lv_control01 oradatavg
lvcreate -L 20M -n lv_control02 oradatavg
lvcreate -L 20M -n lv_redo01 oradatavg
lvcreate -L 20M -n lv_redo02 oradatavg
lvcreate -L 500M -n lv_system01 oradatavg
lvcreate -L 500M -n lv_sysaux01 oradatavg
lvcreate -L 500M -n lv_users01 oradatavg
lvcreate -L 20M -n lv_undo01 oradatavg
lvcreate -L 20M -n lv_temp01 oradatavg
创建完成后lvscan浏览如下:
[root@localhost ~]# lvscan
ACTIVE '/dev/oradatavg/lv_spfile' [8.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_control01' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_control02' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_redo01' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_redo02' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_system01' [500.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_sysaux01' [500.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_users01' [500.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_undo01' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_temp01' [20.00 MB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [12.91 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit
[root@localhost ~]#
ACTIVE '/dev/oradatavg/lv_spfile' [8.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_control01' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_control02' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_redo01' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_redo02' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_system01' [500.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_sysaux01' [500.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_users01' [500.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_undo01' [20.00 MB] inherit
ACTIVE '/dev/oradatavg/lv_temp01' [20.00 MB] inherit
ACTIVE '/dev/VolGroup00/LogVol00' [12.91 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit
[root@localhost ~]#
3.绑定裸设备
raw /dev/raw/raw1 /dev/oradatavg/lv_spfile
raw /dev/raw/raw2 /dev/oradatavg/lv_control01
raw /dev/raw/raw3 /dev/oradatavg/lv_control02
raw /dev/raw/raw4 /dev/oradatavg/lv_redo01
raw /dev/raw/raw5 /dev/oradatavg/lv_redo02
raw /dev/raw/raw6 /dev/oradatavg/lv_system01
raw /dev/raw/raw7 /dev/oradatavg/lv_sysaux01
raw /dev/raw/raw8 /dev/oradatavg/lv_users01
raw /dev/raw/raw9 /dev/oradatavg/lv_undo01
raw /dev/raw/raw10 /dev/oradatavg/lv_temp01
raw /dev/raw/raw1 /dev/oradatavg/lv_spfile
raw /dev/raw/raw2 /dev/oradatavg/lv_control01
raw /dev/raw/raw3 /dev/oradatavg/lv_control02
raw /dev/raw/raw4 /dev/oradatavg/lv_redo01
raw /dev/raw/raw5 /dev/oradatavg/lv_redo02
raw /dev/raw/raw6 /dev/oradatavg/lv_system01
raw /dev/raw/raw7 /dev/oradatavg/lv_sysaux01
raw /dev/raw/raw8 /dev/oradatavg/lv_users01
raw /dev/raw/raw9 /dev/oradatavg/lv_undo01
raw /dev/raw/raw10 /dev/oradatavg/lv_temp01
raw -qa:
[root@localhost ~]# raw -qa
/dev/raw/raw1: bound to major 253, minor 2
/dev/raw/raw2: bound to major 253, minor 3
/dev/raw/raw3: bound to major 253, minor 4
/dev/raw/raw4: bound to major 253, minor 5
/dev/raw/raw5: bound to major 253, minor 6
/dev/raw/raw6: bound to major 253, minor 7
/dev/raw/raw7: bound to major 253, minor 8
/dev/raw/raw8: bound to major 253, minor 9
/dev/raw/raw9: bound to major 253, minor 10
/dev/raw/raw10: bound to major 253, minor 11
[root@localhost ~]#
[root@localhost ~]# raw -qa
/dev/raw/raw1: bound to major 253, minor 2
/dev/raw/raw2: bound to major 253, minor 3
/dev/raw/raw3: bound to major 253, minor 4
/dev/raw/raw4: bound to major 253, minor 5
/dev/raw/raw5: bound to major 253, minor 6
/dev/raw/raw6: bound to major 253, minor 7
/dev/raw/raw7: bound to major 253, minor 8
/dev/raw/raw8: bound to major 253, minor 9
/dev/raw/raw9: bound to major 253, minor 10
/dev/raw/raw10: bound to major 253, minor 11
[root@localhost ~]#
将裸设备信息加入文件/etc/sysconfig/rawdevices,以便开机时自动加载裸设备:
/dev/raw/raw1 /dev/oradatavg/lv_spfile
/dev/raw/raw2 /dev/oradatavg/lv_control01
/dev/raw/raw3 /dev/oradatavg/lv_control02
/dev/raw/raw4 /dev/oradatavg/lv_redo01
/dev/raw/raw5 /dev/oradatavg/lv_redo02
/dev/raw/raw6 /dev/oradatavg/lv_system01
/dev/raw/raw7 /dev/oradatavg/lv_sysaux01
/dev/raw/raw8 /dev/oradatavg/lv_users01
/dev/raw/raw9 /dev/oradatavg/lv_undo01
/dev/raw/raw10 /dev/oradatavg/lv_temp01
/dev/raw/raw1 /dev/oradatavg/lv_spfile
/dev/raw/raw2 /dev/oradatavg/lv_control01
/dev/raw/raw3 /dev/oradatavg/lv_control02
/dev/raw/raw4 /dev/oradatavg/lv_redo01
/dev/raw/raw5 /dev/oradatavg/lv_redo02
/dev/raw/raw6 /dev/oradatavg/lv_system01
/dev/raw/raw7 /dev/oradatavg/lv_sysaux01
/dev/raw/raw8 /dev/oradatavg/lv_users01
/dev/raw/raw9 /dev/oradatavg/lv_undo01
/dev/raw/raw10 /dev/oradatavg/lv_temp01
4.修改卷组属主和访问访问权限:
chown oracle:oinstall /dev/oradatavg
chmod 777 /dev/raw/*
chmod 777 /dev/raw/
chown oracle:oinstall /dev/oradatavg
chmod 777 /dev/raw/*
chmod 777 /dev/raw/
5.创建数据文件指向裸设备的软链接:
ln -s /dev/raw/raw1 /oracle/oradata/rawdb/spfile
ln -s /dev/raw/raw2 /oracle/oradata/rawdb/control01.ctl
ln -s /dev/raw/raw3 /oracle/oradata/rawdb/control02.ctl
ln -s /dev/raw/raw4 /oracle/oradata/rawdb/redo01.log
ln -s /dev/raw/raw5 /oracle/oradata/rawdb/redo02.log
ln -s /dev/raw/raw6 /oracle/oradata/rawdb/system01.dbf
ln -s /dev/raw/raw7 /oracle/oradata/rawdb/sysaux01.dbf
ln -s /dev/raw/raw8 /oracle/oradata/rawdb/users01.dbf
ln -s /dev/raw/raw9 /oracle/oradata/rawdb/undo01.dbf
ln -s /dev/raw/raw10 /oracle/oradata/rawdb/temp01.dbf
ln -s /dev/raw/raw1 /oracle/oradata/rawdb/spfile
ln -s /dev/raw/raw2 /oracle/oradata/rawdb/control01.ctl
ln -s /dev/raw/raw3 /oracle/oradata/rawdb/control02.ctl
ln -s /dev/raw/raw4 /oracle/oradata/rawdb/redo01.log
ln -s /dev/raw/raw5 /oracle/oradata/rawdb/redo02.log
ln -s /dev/raw/raw6 /oracle/oradata/rawdb/system01.dbf
ln -s /dev/raw/raw7 /oracle/oradata/rawdb/sysaux01.dbf
ln -s /dev/raw/raw8 /oracle/oradata/rawdb/users01.dbf
ln -s /dev/raw/raw9 /oracle/oradata/rawdb/undo01.dbf
ln -s /dev/raw/raw10 /oracle/oradata/rawdb/temp01.dbf
6.创建裸设备映射文件DBCA_RAW_CONFIG.txt
spfile=/oracle/oradata/rawdb/spfile
control1=/oracle/oradata/rawdb/control01.ctl
control2=/oracle/oradata/rawdb/control02.ctl
redo1_1=/oracle/oradata/rawdb/redo01.log
redo2_1=/oracle/oradata/rawdb/redo02.log
system=/oracle/oradata/rawdb/system01.dbf
sysaux=/oracle/oradata/rawdb/sysaux01.dbf
users=/oracle/oradata/rawdb/users01.dbf
undotbs1=/oracle/oradata/rawdb/undo01.dbf
temp=/oracle/oradata/rawdb/temp01.dbf
7.运行DBCA创建数据库
export DBCA_RAW_CONFIG=/oracle/DBCA_RAW_CONFIG.txt
在安装的step 6 选择要用于数据库的存储机制,选择裸设备,由于设定了环境变量DBCA_RAW_CONFIG,所以指定裸设备映射文件项自动选择了指定的
映射文件.
export DBCA_RAW_CONFIG=/oracle/DBCA_RAW_CONFIG.txt
在安装的step 6 选择要用于数据库的存储机制,选择裸设备,由于设定了环境变量DBCA_RAW_CONFIG,所以指定裸设备映射文件项自动选择了指定的
映射文件.
安装中我主要遇到了以下三个问题,上述的脚本都是我在错误的基础上修改正确的版本:
1.SYSTEM property not set in mapping file或者redo1_1 property not set in mapping file
原因是你在映射文件中比如把system改成system01或者redo1_1改成redo01就会报,应该是安装裸设备数据库的映射文件oracle固定了一些名称,必须要按照它指定的名称来
设,不然就会报错。
1.SYSTEM property not set in mapping file或者redo1_1 property not set in mapping file
原因是你在映射文件中比如把system改成system01或者redo1_1改成redo01就会报,应该是安装裸设备数据库的映射文件oracle固定了一些名称,必须要按照它指定的名称来
设,不然就会报错。
2.Oracle可使用的裸设备"/oracle/oradata/rawdb/redo01.log"
的物理大小"20480K"小于要求的大小"51200K",请指定
更大的裸设备或增大裸设备的大小。
的物理大小"20480K"小于要求的大小"51200K",请指定
更大的裸设备或增大裸设备的大小。
由于我刚开始设置的是20M,所以报这个错误,报错后我用lvextend扩展了lv之后问题解决:
lvextend -L 512M /dev/oradatavg/lv_redo01
lvextend -L 512M /dev/oradatavg/lv_redo02
lvextend -L 512M /dev/oradatavg/lv_redo01
lvextend -L 512M /dev/oradatavg/lv_redo02
3.ORA-01119:error in creating database file '/oracle/oradata/rawdb/temp01.dbf'
ORA-27042:not enough space on raw partition to fulfillrequest
这个问题是由于上面我将temp表空间文件设置为20M太小,将temp文件设置大后便解决这个问题。
ORA-27042:not enough space on raw partition to fulfillrequest
这个问题是由于上面我将temp表空间文件设置为20M太小,将temp文件设置大后便解决这个问题。
如下,一个实例名为rawdb的裸设备数据库安装成功。
SQL> select instance_name,status from v$instance;
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
rawdb OPEN
---------------- ------------
rawdb OPEN
SQL>
转载于:https://blog.51cto.com/hunter8888/1332357