Managing dataspaces

After being created, datafiles must be attached to dataspaces. Before attaching a datafile to a dataspace, the dataspace must have been created if it is not the default dataspace (which is created when creating the database).

Creating, listing, and deleting dataspaces

This section explains how to create, listing and delete dataspaces. When creating or updating a dataspace, the list of datafiles contained in this dataspace must be specified; datafiles must therefore have been created before, refer to the section called “Managing datafiles” for explainations on datafiles management.

Creating a dataspace is done using the eyedbadmin command:

eyedbadmin
dataspace create {database} {dataspace} {[{datafile_id} | {datafile_name}]...}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace to be created

  • {[{datafile_id} | {datafile_name}]...}

    the datafiles to be attached to the dataspace, that can be specified either by its id or by its name

Example 5.8. eyedbadmin dataspace create

	    ## create 2 datafiles
	    eyedbadmin datafile create test4 data1.dat
	    eyedbadmin datafile create test4 data2.dat
	    ## create a dataspace, attaching the 2 datafiles to this dataspace
	    eyedbadmin dataspace create test4 DSP1 1 2
	  

Obtaining the list of dataspaces is done using the eyedbadmin command:

eyedbadmin
dataspace list {database} {dataspace}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace to be listed

Example 5.9. eyedbadmin dataspace list

	    ## List all the dataspaces of database 'test4'
	    eyedbadmin dataspace list test4
	    Dataspace #0
	    Name DEFAULT
	    Datafile #0
	    Name     DEFAULT
	    File     test4.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Dataspace #1
	    Name DSP1
	    Datafile #1
	    File     data1.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Datafile #2
	    File     data2.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	  

Deleting a dataspace is done using the eyedbadmin command:

eyedbadmin
delete {database} {dataspace}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace

Example 5.10. eyedbadmin dataspace delete

	    ## delete dataspace named 'NEWDSP1'
	    eyedbadmin dataspace delete test4 NEWDSP1
	    ## list all dataspaces
	    eyedbadmin dataspace list test4
	    Dataspace #0
	    Name DEFAULT
	    Datafile #0
	    Name     DEFAULT
	    File     test4.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	  

Updating and renaming dataspaces

Updating a dataspace is done using the eyedbadmin command:

eyedbadmin
dataspace update {database} {dataspace} {[{datafile_id} | {datafile_name}]...}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace

  • {[{datafile_id} | {datafile_name}]...}

    the datafiles to be attached to the dataspace, that can be specified either by its id or by its name

Example 5.11. eyedbadmin dataspace update

	    ## create 2 more datafiles
	    eyedbadmin datafile create test4 data3.dat
	    eyedbadmin datafile create test4 data4.dat
	    ## update the dataspace, attaching the 4 datafiles to the dataspace
	    eyedbadmin dataspace update test4 DSP1 1 2 3 4
	    ## list the updated dataspace
	    eyedbadmin dataspace list test4 DSP1
	    Dataspace #1
	    Name DSP1
	    Datafile #1
	    File     data1.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Datafile #2
	    File     data2.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Datafile #3
	    File     data3.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Datafile #4
	    File     data4.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    ## update dataspace, leaving only the last 2 datafiles
	    eyedbadmin dataspace update test4 DSP1 3 4
	    ## list updated dataspace
	    eyedbadmin dataspace list test4 DSP1
	    Dataspace #1
	    Name NEWDSP1
	    Datafile #3
	    File     data3.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Datafile #4
	    File     data4.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	  

Renaming a dataspace is done using the eyedbadmin command:

eyedbadmin
dataspace rename {database} {dataspace} {new_dataspace}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace

  • {new_dataspace}

    the new name of the dataspace

Example 5.12. eyedbadmin dataspace rename

	    ## rename dataspace
	    eyedbadmin dataspace rename test4 DSP1 NEWDSP1
	    ## list renamed dataspace
	    eyedbadmin dataspace list test4 NEWDSP1
	    Dataspace #1
	    Name NEWDSP1
	    Datafile #3
	    File     data3.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	    Datafile #4
	    File     data4.dat
	    Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize 16
	    Oid Type Logical
	  

Getting and setting current datafile

A dataspace maintains an internal pointer to its current datafile, i.e. the datafile in which new data will be stored when creating an object, an index that hits into this dataspace.

When a datafile is full, the pointer to the current datafile is moved to the next datafile in the dataspace that has space left for insertion. If all datafiles in the dataspace are full, then the insertion ends with an error.

Using eyedbadmin, it is possible to examine and set the pointer to the current datafile.

Examining the current datafile is done using the eyedbadmin command:

eyedbadmin
dataspace getcurdat {database} {dataspace}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace

Example 5.13. eyedbadmin dataspace getcurdat

	    eyedbadmin dataspace getcurdat test4 DSP1
	    Datafile #1
	    Name      <unnamed>
	    Dataspace #1 DSP1
	    File      data1.dat
	    Maxsize   2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize  16
	    Oid Type  Logical
	  

Setting the current datafile is done using the eyedbadmin command:

eyedbadmin
dataspace setcurdat {database} {dataspace} {[{datafile_id} | {datafile_name}]...}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace

  • {[{datafile_id} | {datafile_name}]...}

    the datafiles to be attached to the dataspace, that can be specified either by its id or by its name

Example 5.14. eyedbadmin dataspace setcurdat

	    eyedbadmin dataspace setcurdat test4 DSP1 3
	    eyedbadmin dataspace getcurdat test4 DSP1
	    Datafile #3
	    Name      <unnamed>
	    Dataspace #1 DSP1
	    File      data3.dat
	    Maxsize   2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
	    Slotsize  16
	    Oid Type  Logical
	    francois@revard$ 
	  

Getting and setting default dataspace for a database

A database maintains an internal pointer to a default dataspace; this default dataspace will be used when inserting data that do not have an associated dataspace the section called “Managing locations”.

Using eyedbadmin, it is possible to examine and set the pointer to the default dataspace for a database.

Getting and setting default dataspace

Getting and setting default dataspace is done using the database topic of the eyedbadmin command the section called “eyedbadmin command syntax”, because the default dataspace is a property of the database and not of a particular dataspace.

Examining the default dataspace is done using the eyedbadmin command:

eyedbadmin
database getdefdsp {database}

Command arguments are:

  • {database}

    the database

Example 5.15. eyedbadmin database getdefdsp

eyedbadmin database getdefdsp test4
Dataspace #0
Name DEFAULT
   Datafile #0
     Name     DEFAULT
     File     test4.dat
     Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
     Slotsize 16
     Oid Type Logical
	    

Setting the default dataspace is done using the eyedbadmin command:

eyedbadmin
database setdefdsp {database} {dataspace}

Command arguments are:

  • {database}

    the database

  • {dataspace}

    the name of the dataspace that must become the default dataspace

Example 5.16. eyedbadmin database setdefdsp

eyedbadmin database setdefdsp test4 DSP1
eyedbadmin database getdefdsp test4
Dataspace #1
Name DSP1
   Datafile #1
     File     data1.dat
     Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
     Slotsize 16
     Oid Type Logical
   Datafile #2
     File     data2.dat
     Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
     Slotsize 16
     Oid Type Logical
   Datafile #3
     File     data3.dat
     Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
     Slotsize 16
     Oid Type Logical
   Datafile #4
     File     data4.dat
     Maxsize  2147483648b, ~2097152Kb, ~2048Mb, ~2Gb
     Slotsize 16
     Oid Type Logical