本文主要验证lvm+raw设备 表空间的最大可用空间大小
- --1.建表空间之前的准备,/dev/raw/raw14大小为8M
- [oracle@master ~]$ ln -s /dev/raw/raw14 /oracle/oradata/rawt/test01.dbf
- --2.创建表空间
- SQL> create tablespace test
- datafile '/oracle/oradata/rawt/test01.dbf' size 2M
- autoextend on;
- --3.查看文件大小,并插入数据直到空间不足
- SQL> select bytes/1024/1024,maxbytes/1024/1024 from dba_data_files where file_id=5;
- BYTES/1024/1024 MAXBYTES/1024/1024
- --------------- ------------------
- 2 32767.9844 --创建表空间时,没有指定最大值,这个地方为约32G
- SQL>
- SQL>
- SQL>
- SQL>
- SQL> select count(*) from dba_objects;
- COUNT(*)
- ----------
- 50032
- SQL> create table t (id int,name varchar2(20)) tablespace test;
- Table created.
- SQL> insert into t select rownum,'1111111111' from dba_objects where rownum<50000;
- 49999 rows created.
- SQL> commit;
- Commit complete.
- SQL> insert into t select rownum,'1111111111' from dba_objects where rownum<50000;
- 49999 rows created.
- SQL> commit;
- Commit complete.
- SQL> insert into t select rownum,'1111111111' from dba_objects where rownum<50000;
- 49999 rows created.
- SQL> insert into t select rownum,'1111111111' from dba_objects where rownum<50000;
- 49999 rows created.
- SQL> insert into t select rownum,'1111111111' from dba_objects where rownum<50000;
- 49999 rows created.
- SQL> insert into t select rownum,'1111111111' from dba_objects where rownum<50000;
- insert into t select rownum,'1111111111' from dba_objects where rownum<50000
- *
- ERROR at line 1:
- ORA-01653: unable to extend table SYS.T by 128 in tablespace TEST
- SQL> commit;
- Commit complete.
- --4.从这里可以看出该文件最大可以使用7M
- SQL> select bytes/1024/1024,maxbytes/1024/1024 from dba_data_files where file_id=5;
- BYTES/1024/1024 MAXBYTES/1024/1024
- --------------- ------------------
- 7 32767.9844
- --5.extents最大可占用6M的空间
- SQL> select sum(bytes/1024/1024) from dba_extents where segment_name ='T';
- SUM(BYTES/1024/1024)
- --------------------
- 6
- SQL> select sum(bytes/1024/1024) from dba_segments where segment_name ='T';
- SUM(BYTES/1024/1024)
- --------------------
- 6
- --6.增大 lv空间后,才能使用到8M的空间。
- [root@master ~]# lvextend -l +1 /dev/VolOracle/test
- Extending logical volume test to 12.00 MB
- Logical volume test successfully resized
结论:使用raw设备时,文件可用空间要稍微小于raw设备的大小。