You are on page 1of 8

Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

Copyright (c) 2018, Oracle. All rights reserved. Oracle Confidential.

10g: BIGFILE Type Tablespaces Versus SMALLFILE Type (Doc ID 262472.1)

***Checked for relevance on 12-Jun-2012***


*** Checked for relevance on 05-Apr-2016 ***

PURPOSE
-------

This document explains why a new type of tablespaces in a 10g version database
and the precautions to be taken when using BIGFILE type tablespaces.

SCOPE & APPLICATION


-------------------

The document is intended for

--> Database administrators to know about the new type of BIGFILE tablespaces,
how to use this new type
--> Developers to be aware of incorrect results they can retrieve when using
inappropriately the new type of tablespace for objects stored in different
types of tablespaces

Concept and Usage of BFTs - BigFile Tablespace -


------------------------------------------------

A. A Bigfile Tablespace is a tablespace containing a single very large data file

SQL> ALTER TABLESPACE test_big


ADD DATAFILE '/ORACLE10/ORCL/testbig2.dbf' size 500G;

ALTER TABLESPACE test_big


*
ERROR at line 1:
ORA-32771: cannot add file to bigfile tablespace

whose size can be larger that an ordinary file associated to a SMALLFILE


tablespace thanks to the new addressing scheme :

a rowid addressing an object stored in a traditional SMALLFILE tablespace


uses amongst the 12 bytes

. 3 bytes for the Relative File# and


. 6 other bytes for the Block#

The same rowid addressing an object stored in a new BIGFILE tablespace uses
the . 9 bytes to store the Block# within the unique file:

there is no purpose to use the 3 bytes for the Relative File# since
there is only one file in that tablespace.

1 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

This new addressing scheme

. permits up to 4 Gblocks in a single data file and


. the maximum file size can reach
8 TB for a blocksize of 2K
128 TB for a blocksize of 32K

Using BIGFILE tablespaces on platforms that do not support large file sizes
is not recommended : it limits tablespace capacity.

B. Both types of BIGFILE and SMALLFILE tablespaces can coexist within a database.

SQL> CREATE BIGFILE TABLESPACE test_big


DATAFILE '/ORACLE10/ORCL/testbig1.dbf' size 1M;

Tablespace created.

SQL> select TABLESPACE_NAME, BIGFILE from DBA_TABLESPACES;

TABLESPACE_NAME BIG
------------------------------ ---
SYSTEM NO
UNDOTBS1 NO
SYSAUX NO
TEMP NO
USERS NO
TEST_BIG YES

C. The fact that only one data file is attached to a tablespace makes it easier
to manage: the tablespace becomes the unit of administration.
The following commands are to be used on data files with SMALLFILE
tablespaces, whereas they can be used at tablespace level with a BIGFILE
tablespace :

SQL> ALTER TABLESPACE test_big AUTOEXTEND OFF;


Tablespace altered.

SQL> ALTER TABLESPACE test_big AUTOEXTEND ON;


Tablespace altered.

SQL> ALTER TABLESPACE test_big RESIZE 2M;


Tablespace altered.

D. BFTs can be used with

--> ASM (Automatic Storage Management)


--> a logical volume manager supporting striping/RAID
--> dynamically extensible logical volumes
--> Oracle Managed Files (OMF)

E. You can change the TYPE of tablespace used when creating new tablespaces :

2 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

SQL> select * from database_properties


where property_name='DEFAULT_TBS_TYPE';

PROPERTY_NAME PROPERTY_VALUE DESCRIPTION


-------------------- --------------- ------------------------
DEFAULT_TBS_TYPE SMALLFILE Default tablespace type

SQL> ALTER DATABASE SET DEFAULT bigfile TABLESPACE;


Database altered.

SQL> CREATE TABLESPACE big_test2


DATAFILE '/ORACLE10/ORCL/testbig2.dbf' size 1M;

Tablespace created.

SQL> select TABLESPACE_NAME, BIGFILE from DBA_TABLESPACES;

TABLESPACE_NAME BIG
------------------------------ ---------
...
USERS NO
TEST_BIG YES
TEST_BIG2 YES

F. There is a performance benefit on startup, checkpointing and DBWR operations in bigfile tablespaces over traditional (smallfile) tablespaces.

How to Interpret Information from ROWID : DBMS_ROWID package


-------------------------------------------------------------

DBMS_ROWID package is the only supported package to retrieve ROWID components.


(DBMS_UTILITY.DATA_BLOCK_ADDRESS_FILE and DATA_BLOCK_ADDRESS_BLOCK are not
supposed to be used for BIGFILE tablespaces.)

Some functions/procedures of this package have a new input parameter TS_TYPE_IN


to specify a tablespace type: allowed values are BIGFILE and SMALLFILE.

A bigfile tablespace has only one data file whose relative file number is 1024 :

SQL> select file_name, file_id, relative_fno from dba_data_files;

FILE_NAME FILE_ID RELATIVE_FNO


--------------------------------- ---------- ------------
...
/ORACLE10/ORCL/TEST01.DBF 7 7
/ORACLE10/ORCL/testbig1.dbf 8 1024
/ORACLE10/ORCL/testbig2.dbf 9 1024

1- Interpret relative file number from a rowid of a table in a SMALLFILE tablespace:

SQL> create table test_small (c number) tablespace TEST;


Table created.

SQL> insert into test_small values (1);


1 row created.

3 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

SQL> select dbms_rowid.rowid_relative_fno(rowid) from test_small;

DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
------------------------------------
7

--> Correct interpretation : type of the tablespace is SMALLFILE.

But, the example below shows that the interpretation can be incorrect if
you give an incorrect type for the tablespace the segment is stored in :

SQL> select dbms_rowid.rowid_relative_fno(rowid,'BIGFILE') from test_small;

DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID,'BIGFILE')
----------------------------------------------
1024

2- Interpret relative file number from a rowid of a table in a BIGFILE tablespace :

SQL> create table test_big (c number) tablespace test_big;


Table created.

SQL> insert into test_big values (1);


1 row created.

SQL> select dbms_rowid.rowid_relative_fno(rowid) from test_big;

DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
------------------------------------
0

--> Incorrect interpretation : the type of the tablespace is BIGFILE

But, the example below shows that the interpretation is correct if you
give the correct type for the tablespace the segment is stored in :

SQL> select dbms_rowid.rowid_relative_fno(rowid,'BIGFILE') from test_big;

DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID,'BIGFILE')
----------------------------------------------
1024

3- Interpret block number from a rowid of a table in a SMALLFILE tablespace :

SQL> select dbms_rowid.rowid_block_number(rowid) from test_small;

DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------
15

--> Correct interpretation : tablespace is of SMALLFILE type.

4 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

SQL> select dbms_rowid.rowid_block_number(rowid,'BIGFILE') from test_small;

DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID,'BIGFILE')
----------------------------------------------
29360143

--> Incorrect interpretation : tablespace is of SMALLFILE type.

4- Interpret block number from a rowid of a table in a BIGFILE tablespace :

SQL> select dbms_rowid.rowid_block_number(rowid) from test_big;

DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)
------------------------------------
31

SQL> select dbms_rowid.rowid_block_number(rowid, 'BIGFILE') from test_big;

DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID,'BIGFILE')
----------------------------------------------
31

--> Both results are identical, but you should rely only on the second one
where the TS_TYPE_IN is set ot the right value.

5- Interpret row number from a rowid of tables in SMALLFILE/BIGFILE tablespaces:

The TS_TYPE_IN does not need to be declared, since the row number is always
relative to the block it is in:

SQL> select dbms_rowid.rowid_row_number(rowid) from test_big;

DBMS_ROWID.ROWID_ROW_NUMBER(ROWID)
----------------------------------
0
1

SQL> select dbms_rowid.rowid_row_number(rowid) from test_small;

DBMS_ROWID.ROWID_ROW_NUMBER(ROWID)
----------------------------------
0
1

SQL> select dbms_rowid.rowid_row_number(rowid, 'BIGFILE') from test_big;


select dbms_rowid.rowid_row_number(rowid, 'BIGFILE') from test_big
*
ERROR at line 1:
ORA-06553: PLS-306: wrong number or types of arguments in call to
'ROWID_ROW_NUMBER'

How to Transfer Segments from/to Smallfile to/from Bigfile Tablespaces


----------------------------------------------------------------------

5 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

A. ALTER TABLE ... MOVE TABLESPACE :

SQL> select name, bigfile, table_name from dba_tables t, v$tablespace v


where table_name='EMP' and v.name=t.tablespace_name;

NAME BIG TABLE_NAME


------------------------------ --- ------------------------------
USERS NO EMP

SQL> ALTER TABLE scott.emp MOVE TABLESPACE test_big;


Table altered.

SQL> select name, bigfile, table_name from dba_tables t, v$tablespace v


where table_name='EMP' and v.name=t.tablespace_name;

NAME BIG TABLE_NAME


------------------------------ --- ------------------------------
TEST_BIG YES EMP

B. CREATE TABLE ... AS SELECT

C. Data Pump export and import :

1. Export the table :

SQL> select name, bigfile, table_name from dba_tables t, v$tablespace v


where table_name='EMP' and v.name=t.tablespace_name;

NAME BIG TABLE_NAME


------------------------------ --- ------------------------------
TEST_BIG YES EMP

$ expdp system/manager tables=SCOTT.EMP directory=D

Export: Release 10.1.0.1.0 - Beta on Monday, 02 February, 2004 17:27

Copyright (c) 2003, Oracle. All rights reserved.

Connected to: Oracle10i Enterprise Edition Release 10.1.0.1.0 - Beta


With the Partitioning, OLAP and Data Mining options
Starting "SYSTEM"."SYS_EXPORT_TABLE_02": system/********
tables=SCOTT.EMP directory=D
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TBL_TABLE_DATA/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE
Processing object type TABLE_EXPORT/INDEX/INDEX
Processing object type TABLE_EXPORT/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
. . exported "SCOTT"."EMP" 5.812 KB 14 rows
Master table "SYSTEM"."SYS_EXPORT_TABLE_02" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_02 is: /dp/EXPDAT.DMP

6 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

Job "SYSTEM"."SYS_EXPORT_TABLE_02" successfully completed at 17:28

2. Drop the table :

SQL> drop table scott.emp;


Table dropped.

3. Import the table using the REMAP_TABLESPACE parameter of the Datapump


Import:

$impdp scott/tiger REMAP_TABLESPACE=TEST_BIG:REPOSIT DIRECTORY=D

Import: Release 10.1.0.1.0 - Beta on Monday, 02 February, 2004 17:33

Copyright (c) 2003, Oracle. All rights reserved.

Connected to: Oracle10i Enterprise Edition Release 10.1.0.1.0 - Beta


With the Partitioning, OLAP and Data Mining options
Master table "SCOTT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SCOTT"."SYS_IMPORT_FULL_01": scott/********
REMAP_TABLESPACE=TEST_BIG:REPOSIT DIRECTORY=D
Processing object type TABLE_EXPORT/TABLE
Processing object type TABLE_EXPORT/TBL_TABLE_DATA/TABLE/TABLE_DATA
. . imported "SCOTT"."EMP" 5.812 KB 14 rows
Processing object type TABLE_EXPORT/INDEX/INDEX
Processing object type TABLE_EXPORT/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/CONSTRAINT/REF_CONSTRAINT
Job "SCOTT"."SYS_IMPORT_FULL_01" successfully completed at 17:33

SQL> select name, bigfile, table_name from dba_tables t, v$tablespace v


where table_name='EMP' and v.name=t.tablespace_name;

NAME BIG TABLE_NAME


------------------------------ --- ------------------------------
REPOSIT NO EMP

Restrictions
------------
This new type is only supported for

--> locally managed tablespaces


--> with ASSM (automatic segment space management)

UNDO, TEMPORARY and SYSTEM tablespaces need only to be locally managed.

RELATED DOCUMENTS
-----------------
Note:243245.1 10G New Storage Features and Enhancements
Note:1057891.6 HOW TO USE DBMS_ROWID PROCEDURE AND FUNCTIONS

7 of 8 2018-09-04, 10:27
Document 262472.1 https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=4re575r7s_82&id=26...

Didn't find what you are looking for?

8 of 8 2018-09-04, 10:27

You might also like