ITPub博客

首页 > 数据库 > Oracle > [Oracle] Raw device上Create Tablespace

[Oracle] Raw device上Create Tablespace

原创 Oracle 作者:tolilong 时间:2016-05-21 14:35:58 0 删除 编辑
[root@iphone ~]# vgdisplay vg00
  --- Volume group ---
  VG Name               vg00
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  8
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               15.99 GiB
  PE Size               4.00 MiB
  Total PE              4094
  Alloc PE / Size       512 / 2.00 GiB
  Free  PE / Size       3582 / 13.99 GiB
  VG UUID               Ui6Kbe-yuAV-KxTB-rIwc-BqQo-0nag-AvNfRF
   
[root@iphone ~]# pvcreate /dev/sdd
  Physical volume "/dev/sdd" successfully created
[root@iphone ~]# vgextend vg00 /dev/sdd
  Volume group "vg00" successfully extended
[root@iphone ~]# vgdisplay vg00
  --- Volume group ---
  VG Name               vg00
  System ID             
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  9
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               23.99 GiB
  PE Size               4.00 MiB
  Total PE              6141
  Alloc PE / Size       512 / 2.00 GiB
  Free  PE / Size       5629 / 21.99 GiB
  VG UUID               Ui6Kbe-yuAV-KxTB-rIwc-BqQo-0nag-AvNfRF
 
[root@iphone ~]# lvcreate -L 8G vg00 -n lv01
  Logical volume "lv01" created
 
SQL> create tablespace vgtbs datafile '/dev/vg00/lv01' size 8G;
create tablespace vgtbs datafile '/dev/vg00/lv01' size 8G
*
ERROR at line 1:
ORA-01119: error in creating database file '/dev/vg00/lv01'
ORA-27041: unable to open file
Linux-x86_64 Error: 13: Permission denied
Additional information: 1

[root@iphone ~]# cd /dev/vg00
[root@iphone vg00]# ll
total 0
lrwxrwxrwx. 1 root root 7 May 21 06:24 lv00 -> ../dm-3
lrwxrwxrwx. 1 root root 7 May 21 06:24 lv01 -> ../dm-4
[root@iphone vg00]# chown oracle:dba lv01

SQL> create tablespace vgtbs datafile '/dev/vg00/lv01' size 8G;
create tablespace vgtbs datafile '/dev/vg00/lv01' size 8G
*
ERROR at line 1:
ORA-01119: error in creating database file '/dev/vg00/lv01'
ORA-27042: not enough space on raw partition to fullfill request
Additional information: 1

SQL> create tablespace vgtbs datafile '/dev/vg00/lv01' size 8090M;

Tablespace created.

SQL> select file_name,tablespace_name,bytes/1024/1024 from dba_data_files;

FILE_NAME                                                    TABLESPACE_NAME                BYTES/1024/1024
------------------------------------------------------------ ------------------------------ ---------------
/u01/oracle/oradata/yangxu/users01.dbf                       USERS                                        5
/u01/oracle/oradata/yangxu/undotbs01.dbf                     UNDOTBS1                                    90
/u01/oracle/oradata/yangxu/sysaux01.dbf                      SYSAUX                                     720
/u01/oracle/oradata/yangxu/system01.dbf                      SYSTEM                                     700
/u01/oracle/oradata/yangxu/example01.dbf                     EXAMPLE                                    100
/u01/oracle/oradata/yangxu/bu2.dbf                           BU2                                       1024
/u01/oracle/oradata/yangxu/bu2_01.dbf                        BU2                                      10240
/u01/oracle/oradata/yangxu/bu2_index.dbf                     BU2_INDEX                                 1024
/dev/vg00/lv01                                               VGTBS                                     8090

9 rows selected.

SQL> create table vgtb tablespace vgtbs as select * from all_objects;

Table created.

SQL> insert into vgtb select * from vgtb;

72554 rows created.

SQL> commit;

Commit complete.

SQL> /

Commit complete.

SQL> insert into vgtb select * from vgtb;

145108 rows created.

SQL> /

290216 rows created.

SQL> /

580432 rows created.

SQL> /

1160864 rows created.

SQL> /

2321728 rows created.

SQL> commit;

Commit complete.

SQL> select segment_name,segment_type,tablespace_name,bytes/1024/1024 from dba_segments where segment_name='VGTB';

SEGMENT_NAME         SEGMENT_TYPE       TABLESPACE_NAME                BYTES/1024/1024
-------------------- ------------------ ------------------------------ ---------------
VGTB                 TABLE              VGTBS                                      520

SQL> drop tablespace vgtbs including contents;

Tablespace dropped.

SQL> select file_name,tablespace_name from dba_data_files;

FILE_NAME                                                    TABLESPACE_NAME
------------------------------------------------------------ ------------------------------
/u01/oracle/oradata/yangxu/users01.dbf                       USERS
/u01/oracle/oradata/yangxu/undotbs01.dbf                     UNDOTBS1
/u01/oracle/oradata/yangxu/sysaux01.dbf                      SYSAUX
/u01/oracle/oradata/yangxu/system01.dbf                      SYSTEM
/u01/oracle/oradata/yangxu/example01.dbf                     EXAMPLE
/u01/oracle/oradata/yangxu/bu2.dbf                           BU2
/u01/oracle/oradata/yangxu/bu2_01.dbf                        BU2
/u01/oracle/oradata/yangxu/bu2_index.dbf                     BU2_INDEX

8 rows selected.

SQL> select * from dba_segments where segment_name='VGTB';

no rows selected

[root@iphone vg00]# cd /dev/vg00
[root@iphone vg00]# ll
total 0
lrwxrwxrwx. 1 root root 7 May 21 05:35 lv00 -> ../dm-3
lrwxrwxrwx. 1 root root 7 May 21 05:57 lv01 -> ../dm-4

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

下一篇: [Linux] PV,VG,LV相关
请登录后发表评论 登录
全部评论

注册时间:2010-07-13

  • 博文量
    406
  • 访问量
    1208664