Table of Contents
This chapter covers the database administration commands used for:
creating and deleting databases
getting information on databases
moving, copying, renaming databases
importing and exporting databases
All these operations are performed using the eyedbadmin command and its database topic.
Creating a database is done using the eyedbadmin command:
eyedbadmin
database create
[options...] database
Options are:
--dbfile=file
specifies the database file (a file, usually with .dbs
extension, that stores the database structure.
--filedir=directory
specifies the directory that will contains the database data files
--max-object-count=count
specifies the maximum number of objects that can be store in the database
Example 3.1, “eyedbadmin database create” shows several examples of database creation.
Example 3.1. eyedbadmin database create
# create database 'test1'eyedbadmin database create test1
# create database 'test2' giving the database fileeyedbadmin database create --dbfile=/var/tmp/test2.dbs test2
ls -l /var/tmp/test2.dbs
-rw------- 1 francois francois 250696 2009-03-13 11:55 /var/tmp/test2.dbs # create database 'test3' giving the database files directorymkdir /var/tmp/test3
eyedbadmin database create --filedir=/var/tmp/test3 test3
ls -l /var/tmp/test3
total 1504 -rw------- 1 francois francois 8471424 2009-03-13 11:57 test3.dat -rw------- 1 francois francois 250696 2009-03-13 11:57 test3.dbs -rw------- 1 francois francois 70000 2009-03-13 11:57 test3.dmp -rw------- 1 francois francois 0 2009-03-13 11:57 test3.lck -rw------- 1 francois francois 61440 2009-03-13 11:57 test3.omp -rw------- 1 francois francois 67108864 2009-03-13 11:57 test3.shm
Deleting a database is done using the eyedbadmin command:
eyedbadmin
database delete database
...
This command has no options (except the eyedbadmin command standard options).
Obtaining a list of existing databases or obtaining information on a specific database is done using the eyedbadmin command:
eyedbadmin
database list
[options...] [~]database
...
Options are:
--dbname
lists database names
--dbid
lists database identifier
--dbfile
lists database file
--max-object-count
lists database max object count
--datafiles
lists database datafiles
--defaccess
lists database default access
--useraccess
lists user database accesses
--stats
lists database statistics
--all
lists all database info
Command arguments are:
[~]database
...
database(s) to list (~ means regular expression)
Example 3.3, “eyedbadmin database list” shows several examples of database listing.
Example 3.3. eyedbadmin database list
# list all databaseseyedbadmin database list
Database Name test Database Identifier 2 Database File /home/francois/projects/eyedb/install/var/lib/eyedb/db/test.dbs Max Object Count 10000000 Datafiles Datafile #0 Name DEFAULT Dataspace #0 File test.dat Maxsize ~2048Mb Slotsize 16b Server Access read/write Default Access NO_DBACCESS_MODE Database Access User Name francois Access Mode ADMIN_DBACCESS_MODE Database Name EYEDBDBM .... ### output truncated for readability # list only database nameseyedbadmin database list --dbname
test EYEDBDBM test3 test2 # list non existing databaseeyedbadmin database list --dbname foo
Database 'foo' not found # list statistics for a given databaseeyedbadmin database list --stats test
Statistics Maximum Object Number 10000000 Object Number 2574 Maximum Slot Count 134217728 Busy Slot Count 532202 Maximum Size 2147483648b, ~2097152Kb, ~2048Mb, ~2Gb Busy Slot Size 8515232b, ~8315Kb, ~8Mb Disk Size Used 76007288b, ~74225Kb, ~72Mb Disk Block Size Used 10452992b, ~10208Kb, ~10Mb Used 0.40% # list database default access righteyedbadmin database list --defaccess test
NO_DBACCESS_MODE # list with regular expression (note shell quoting)eyedbadmin database list --dbname '~test*'
test test3 test2 # list with another regular expression (note shell quoting)eyedbadmin database list --dbname --dbfile '~test[0-9]'
test3 /var/tmp/test3/test3.dbs test2 /var/tmp/test2.dbs
Database access rights are defined at two levels:
default database access, applying for all EyeDB users
per user database access, applying only for specified user
Setting default access right is done use the eyedbadmin command:
eyedbadmin
database defaccess database
mode
Allowed values for mode
are:
r: read-only
rw: read/write
rx: read/execute
rwx: read/write/execute
admin: administrate
no: access forbiden
Example 3.4. eyedbadmin database defaccess
# list database default access righteyedbadmin database list --defaccess test
NO_DBACCESS_MODE # set default access right to read-onlyeyedbadmin database defaccess test r
# list database default access righteyedbadmin database list --defaccess test
READ_DBACCESS_MODE # set default access right to read/writeeyedbadmin database defaccess test rw
# list database default access righteyedbadmin database list --defaccess test
READ_WRITE_DBACCESS_MODE
Only an EyeDB user that has the admin database access for a given database can set a default database access for this database. The user that has created the database has automatically the admin database access.