oracle raw device create tablespace

本文介绍了一个具体的Oracle数据库实例配置过程,包括逻辑卷管理器(LVM)配置、原始设备(raw device)绑定及数据库文件的符号链接创建等步骤。通过这些配置实现了不同数据库文件与系统中特定逻辑卷的映射。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  
[root@vmfs sysconfig]# lvdisplay |grep db_d
  LV Name                /dev/db_v4/db_d_22
  LV Name                /dev/db_v4/db_d_23
  LV Name                /dev/db_v4/db_d_24
  LV Name                /dev/db_v4/db_d_25
  LV Name                /dev/db_v4/db_d_26
  LV Name                /dev/db_v3/db_d_13_ct1
  LV Name                /dev/db_v3/db_d_14_ct2
  LV Name                /dev/db_v3/db_d_15_ct3
  LV Name                /dev/db_v3/db_d_16_redo1
  LV Name                /dev/db_v3/db_d_17_redo2
  LV Name                /dev/db_v3/db_d_18_redo3
  LV Name                /dev/db_v3/db_d_19
  LV Name                /dev/db_v3/db_d_20
  LV Name                /dev/db_v3/db_d_21
  LV Name                /dev/db_v1/db_d_1
  LV Name                /dev/db_v1/db_d_2
  LV Name                /dev/db_v1/db_d_3
  LV Name                /dev/db_v1/db_d_4
  LV Name                /dev/db_v1/db_d_5
  LV Name                /dev/db_v1/db_d_6
  LV Name                /dev/db_v1/db_d_7
  LV Name                /dev/db_v1/db_d_8
  LV Name                /dev/db_v1/db_d_9
  LV Name                /dev/db_v1/db_d_10
  LV Name                /dev/db_v1/db_d_11
  LV Name                /dev/db_v1/db_d_12_sp
  LV Name                /dev/db_v1/db_d_27

 

[root@vmfs raw]# lvdisplay

 

...

...


  --- Logical volume ---
  LV Name                /dev/db_v1/db_d_27
  VG Name                db_v1
  LV UUID                ODbHk1-IjFs-83Aq-Vkhe-3mWJ-05cN-9KGTqa
  LV Write Access        read/write
  LV Status              available
  # open                 5
  LV Size                20.00 MB
  Current LE             5
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:26
  
[root@vmfs raw]#  
[root@vmfs sysconfig]#
[root@vmfs sysconfig]# pwd
/etc/sysconfig

[root@vmfs sysconfig]# ls
amd          dund              keyboard            radvd
apmd         exim              kudzu               rawdevices
apm-scripts  firstboot         lm_sensors          rhn
arpwatch     grub              mouse               samba
auditd       harddisks         named               saslauthd
authconfig   hidd              netdump             selinux
autofs       httpd             netdump_id_dsa      sendmail
bluetooth    hwconf            netdump_id_dsa.pub  spamassassin
clock        i18n              network             squid
console      init              networking          syslog
crond        installinfo       network-scripts     sysstat
cyrus-imapd  ip6tables-config  ntpd                system-config-securitylevel
desktop      ipmi              openib.conf         system-config-users
dhcp6r       iptables-config   pand                system-logviewer
dhcp6s       irda              pcmcia              tux
dhcpd        irqbalance        pgsql               vncservers
dhcrelay     iscsi             prelink             xinetd
diskdump     kernel            quagga              yppasswdd
[root@vmfs sysconfig]#
[root@vmfs sysconfig]#

[root@vmfs sysconfig]# vi rawdevices

 

# raw device bindings
# format:  <rawdev> <major> <minor>
#          <rawdev> <blockdev>
# example: /dev/raw/raw1 /dev/sda1
#          /dev/raw/raw2 8 5

##add by hxg
/dev/raw/raw1 /dev/db_v1/db_d_12_sp
/dev/raw/raw2 /dev/db_v3/db_d_13_ct1
/dev/raw/raw3 /dev/db_v3/db_d_14_ct2
/dev/raw/raw4 /dev/db_v3/db_d_15_ct3
/dev/raw/raw5 /dev/db_v3/db_d_16_redo1
/dev/raw/raw6 /dev/db_v3/db_d_17_redo2
/dev/raw/raw7 /dev/db_v3/db_d_18_redo3
/dev/raw/raw8 /dev/db_v1/db_d_1
/dev/raw/raw9 /dev/db_v1/db_d_2
/dev/raw/raw10 /dev/db_v1/db_d_3
/dev/raw/raw11 /dev/db_v1/db_d_4
/dev/raw/raw12 /dev/db_v1/db_d_5
/dev/raw/raw13 /dev/db_v1/db_d_6
/dev/raw/raw14 /dev/db_v1/db_d_7
/dev/raw/raw15 /dev/db_v1/db_d_8
/dev/raw/raw16 /dev/db_v1/db_d_9
/dev/raw/raw17 /dev/db_v1/db_d_10
/dev/raw/raw18 /dev/db_v1/db_d_11
/dev/raw/raw19 /dev/db_v3/db_d_19
/dev/raw/raw20 /dev/db_v3/db_d_20
/dev/raw/raw21 /dev/db_v3/db_d_21
/dev/raw/raw22 /dev/db_v4/db_d_22
/dev/raw/raw23 /dev/db_v4/db_d_23
/dev/raw/raw24 /dev/db_v4/db_d_24
/dev/raw/raw25 /dev/db_v4/db_d_25
/dev/raw/raw26 /dev/db_v4/db_d_26
/dev/raw/raw27 /dev/db_v1/db_d_27
"rawdevices" 37L, 1234C written                                           
[root@vmfs sysconfig]#
[root@vmfs sysconfig]#

[root@vmfs sysconfig]#
[root@vmfs sysconfig]# /sbin/service rawdevices restart
Assigning devices:
           /dev/raw/raw1  -->   /dev/db_v1/db_d_12_sp
/dev/raw/raw1:  bound to major 253, minor 25
           /dev/raw/raw2  -->   /dev/db_v3/db_d_13_ct1
Error setting raw device (Device or resource busy)
           /dev/raw/raw3  -->   /dev/db_v3/db_d_14_ct2
Error setting raw device (Device or resource busy)
           /dev/raw/raw4  -->   /dev/db_v3/db_d_15_ct3
Error setting raw device (Device or resource busy)
           /dev/raw/raw5  -->   /dev/db_v3/db_d_16_redo1
Error setting raw device (Device or resource busy)
           /dev/raw/raw6  -->   /dev/db_v3/db_d_17_redo2
Error setting raw device (Device or resource busy)
           /dev/raw/raw7  -->   /dev/db_v3/db_d_18_redo3
Error setting raw device (Device or resource busy)
           /dev/raw/raw8  -->   /dev/db_v1/db_d_1
Error setting raw device (Device or resource busy)
           /dev/raw/raw9  -->   /dev/db_v1/db_d_2
Error setting raw device (Device or resource busy)
           /dev/raw/raw10  -->   /dev/db_v1/db_d_3
Error setting raw device (Device or resource busy)
           /dev/raw/raw11  -->   /dev/db_v1/db_d_4
Error setting raw device (Device or resource busy)
           /dev/raw/raw12  -->   /dev/db_v1/db_d_5
Error setting raw device (Device or resource busy)
           /dev/raw/raw13  -->   /dev/db_v1/db_d_6
/dev/raw/raw13: bound to major 253, minor 19
           /dev/raw/raw14  -->   /dev/db_v1/db_d_7
/dev/raw/raw14: bound to major 253, minor 20
           /dev/raw/raw15  -->   /dev/db_v1/db_d_8
/dev/raw/raw15: bound to major 253, minor 21
           /dev/raw/raw16  -->   /dev/db_v1/db_d_9
/dev/raw/raw16: bound to major 253, minor 22
           /dev/raw/raw17  -->   /dev/db_v1/db_d_10
/dev/raw/raw17: bound to major 253, minor 23
           /dev/raw/raw18  -->   /dev/db_v1/db_d_11
/dev/raw/raw18: bound to major 253, minor 24
           /dev/raw/raw19  -->   /dev/db_v3/db_d_19
/dev/raw/raw19: bound to major 253, minor 11
           /dev/raw/raw20  -->   /dev/db_v3/db_d_20
/dev/raw/raw20: bound to major 253, minor 12
           /dev/raw/raw21  -->   /dev/db_v3/db_d_21
/dev/raw/raw21: bound to major 253, minor 13
           /dev/raw/raw22  -->   /dev/db_v4/db_d_22
/dev/raw/raw22: bound to major 253, minor 0
           /dev/raw/raw23  -->   /dev/db_v4/db_d_23
/dev/raw/raw23: bound to major 253, minor 1
           /dev/raw/raw24  -->   /dev/db_v4/db_d_24
/dev/raw/raw24: bound to major 253, minor 2
           /dev/raw/raw25  -->   /dev/db_v4/db_d_25
/dev/raw/raw25: bound to major 253, minor 3
           /dev/raw/raw26  -->   /dev/db_v4/db_d_26
/dev/raw/raw26: bound to major 253, minor 4
           /dev/raw/raw27  -->   /dev/db_v1/db_d_27
/dev/raw/raw27: bound to major 253, minor 26
done

[root@vmfs sysconfig]# cd /dev/raw
[root@vmfs raw]# ll
total 0
crw-rw----  1 oracle dba 162,  1 Apr  7 12:40 raw1
crw-rw----  1 oracle dba 162, 10 Apr  7 11:52 raw10
crw-rw----  1 oracle dba 162, 11 Apr  7 11:52 raw11
crw-rw----  1 oracle dba 162, 12 Apr  7 11:52 raw12
crw-rw----  1 oracle dba 162, 13 Apr  7 12:40 raw13
crw-rw----  1 oracle dba 162, 14 Apr  7 12:40 raw14
crw-rw----  1 oracle dba 162, 15 Apr  7 12:40 raw15
crw-rw----  1 oracle dba 162, 16 Apr  7 12:40 raw16
crw-rw----  1 oracle dba 162, 17 Apr  7 12:40 raw17
crw-rw----  1 oracle dba 162, 18 Apr  7 12:40 raw18
crw-rw----  1 oracle dba 162, 19 Apr  7 12:40 raw19
crw-rw----  1 oracle dba 162,  2 Apr  7 11:52 raw2
crw-rw----  1 oracle dba 162, 20 Apr  7 12:40 raw20
crw-rw----  1 oracle dba 162, 21 Apr  7 12:40 raw21
crw-rw----  1 oracle dba 162, 22 Apr  7 12:40 raw22
crw-rw----  1 oracle dba 162, 23 Apr  7 12:40 raw23
crw-rw----  1 oracle dba 162, 24 Apr  7 12:40 raw24
crw-rw----  1 oracle dba 162, 25 Apr  7 12:40 raw25
crw-rw----  1 oracle dba 162, 26 Apr  7 12:40 raw26
crw-rw----  1 oracle dba 162, 27 Apr  7 12:40 raw27
crw-rw----  1 oracle dba 162,  3 Apr  7 11:52 raw3
crw-rw----  1 oracle dba 162,  4 Apr  7 11:52 raw4
crw-rw----  1 oracle dba 162,  5 Apr  7 11:52 raw5
crw-rw----  1 oracle dba 162,  6 Apr  7 11:52 raw6
crw-rw----  1 oracle dba 162,  7 Apr  7 11:52 raw7
crw-rw----  1 oracle dba 162,  8 Apr  7 11:52 raw8
crw-rw----  1 oracle dba 162,  9 Apr  7 11:52 raw9
[root@vmfs raw]#

[root@vmfs raw]#
[root@vmfs raw]# su - oracle
vmfs->  ln -sf /dev/raw/raw27 /fs/demo/test_dbf1
vmfs-> pwd
/fs/demo
vmfs-> ll
total 0
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_ctl1 -> /dev/raw/raw2
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_ctl2 -> /dev/raw/raw3
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_ctl3 -> /dev/raw/raw4
lrwxrwxrwx  1 oracle oinstall 14 Apr  5 14:40 demo_pwd -> /dev/raw/raw13
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_redo1 -> /dev/raw/raw5
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_redo2 -> /dev/raw/raw6
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_redo3 -> /dev/raw/raw7
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 demo_spfile -> /dev/raw/raw1
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 sysaux_dbf1 -> /dev/raw/raw9
lrwxrwxrwx  1 oracle oinstall 13 Apr  5 14:40 system_dbf1 -> /dev/raw/raw8
lrwxrwxrwx  1 oracle oinstall 14 Apr  5 14:40 temptbs_dbf -> /dev/raw/raw12
lrwxrwxrwx  1 oracle oinstall 14 Apr  7 12:42 test_dbf1 -> /dev/raw/raw27
lrwxrwxrwx  1 oracle oinstall 14 Apr  5 14:40 undotbs_dbf -> /dev/raw/raw11
lrwxrwxrwx  1 oracle oinstall 14 Apr  5 14:40 users_dbf1 -> /dev/raw/raw10
vmfs->


vmfs-> cat oracle_raw.conf
test=/fs/demo/test_dbf1
system=/fs/demo/system_dbf1
sysaux=/fs/demo/sysaux_dbf1
undotbs1=/fs/demo/undotbs_dbf
users=/fs/demo/users_dbf1
temp=/fs/demo/temptbs_dbf
redo1_1=/fs/demo/demo_redo1
redo1_2=/fs/demo/demo_redo2
redo1_3=/fs/demo/demo_redo3
control1=/fs/demo/demo_ctl1
control2=/fs/demo/demo_ctl2
control3=/fs/demo/demo_ctl3
spfile=/fs/demo/demo_spfile
pwdfile=/fs/demo/demo_pwd

vmfs->
SQL> show parameter pfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /fs/demo/demo_spfile
SQL> select tablespace_name,file_name from dba_data_files;

TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
USERS
/fs/demo/users_dbf1

SYSAUX
/fs/demo/sysaux_dbf1

UNDOTBS1
/fs/demo/undotbs_dbf


TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
SYSTEM
/fs/demo/system_dbf1
SQL> create tablespace test datafile '/fs/demo/test_dbf1' size 10m autoextend off;

Tablespace created.
SQL> select tablespace_name,file_name from dba_data_files;

TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
USERS
/fs/demo/users_dbf1

SYSAUX
/fs/demo/sysaux_dbf1

UNDOTBS1
/fs/demo/undotbs_dbf


TABLESPACE_NAME
------------------------------
FILE_NAME
--------------------------------------------------------------------------------
SYSTEM
/fs/demo/system_dbf1

TEST
/fs/demo/test_dbf1


SQL> select * from dba_Data_files where tablespace_name ='TEST';

FILE_NAME
--------------------------------------------------------------------------------
   FILE_ID TABLESPACE_NAME                     BYTES     BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT   MAXBYTES  MAXBLOCKS INCREMENT_BY USER_BYTES USER_BLOCKS
------------ --- ---------- ---------- ------------ ---------- -----------
ONLINE_
-------
/fs/demo/test_dbf1
         5 TEST                             10485760       1280 AVAILABLE
           5 NO           0          0            0   10420224        1272
ONLINE


SQL> select * from dba_tablespaces  where tablespace_name ='TEST';

TABLESPACE_NAME                BLOCK_SIZE INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS
------------------------------ ---------- -------------- ----------- -----------
MAX_EXTENTS PCT_INCREASE MIN_EXTLEN STATUS    CONTENTS  LOGGING   FOR EXTENT_MAN
----------- ------------ ---------- --------- --------- --------- --- ----------
ALLOCATIO PLU SEGMEN DEF_TAB_ RETENTION   BIG
--------- --- ------ -------- ----------- ---
TEST                                 8192          65536                       1
 2147483645                   65536 ONLINE    PERMANENT LOGGING   NO  LOCAL
SYSTEM    NO  AUTO   DISABLED NOT APPLY   NO


SQL> create user test identified by test default tablespace test temporary tablespace temp account unlock;

User created.

SQL> grant resource to test;

Grant succeeded.

SQL> grant connect to test;

Grant succeeded.

SQL> grant create session to test;

Grant succeeded.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
vmfs-> sqlplus test/test

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 7 12:47:50 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select * from user_objects;

no rows selected

SQL> create table test1 (a number,b varchar2(20));

Table created.

SQL> insert into test1 values(1,'aaaa');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from test1;

         A B
---------- --------------------
         1 aaaa

SQL>

 

SQL> select file#,STATUS,ENABLED,LAST_TIME,ONLINE_TIME,BYTES ,BLOCKS,CREATE_BYTES ,BLOCK_SIZE,NAME ,PLUGGED_IN ,BLOCK1_OFFSET,AUX_NAME, FIRST_NONLOGGED_SCN,FIRST_NONLOGGED_TIME from v$datafile where file#=5;

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------
         5 ONLINE  READ WRITE                       10485760       1280

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------
    10485760       8192

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------
/fs/demo/test_dbf1

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------
         0          8192

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------
NONE

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------
                  0

     FILE# STATUS  ENABLED    LAST_TIME ONLINE_TI      BYTES     BLOCKS
---------- ------- ---------- --------- --------- ---------- ----------
CREATE_BYTES BLOCK_SIZE
------------ ----------
NAME
--------------------------------------------------------------------------------
PLUGGED_IN BLOCK1_OFFSET
---------- -------------
AUX_NAME
--------------------------------------------------------------------------------
FIRST_NONLOGGED_SCN FIRST_NON
------------------- ---------


SQL>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值