Renaming, copying and moving a database cannot be simply done by renaming the files that are associated with the database, because EyeDB maintains databases informations in a database itself. Specific commands are therefore required to rename, copy and move a database.
Renaming a database is done using the eyedbadmin command:
eyedbadmin
database rename database
new_database
Command arguments are:
database
name of database to rename
new_database
new database name
Example 3.5. eyedbadmin database rename
eyedbadmin database list test
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 READ_WRITE_DBACCESS_MODE Database Access User Name francois Access Mode ADMIN_DBACCESS_MODEeyedbadmin database rename test newtest
eyedbadmin database list newtest
Database Name newtest 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 READ_WRITE_DBACCESS_MODE Database Access User Name francois Access Mode ADMIN_DBACCESS_MODE
Example 3.5, “eyedbadmin database rename” shows that renaming a database does not rename the database files. Rename the database data files is done using the eyedbadmin datafile rename command described in Example 5.4, “eyedbadmin datafile rename”.
Copying a database is done using the eyedbadmin command:
eyedbadmin
database copy
[options...] database
new_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
Command arguments are:
database
name of database to copy
new_database
new database name
Example 3.6. eyedbadmin database copy
eyedbadmin database list test3
Database Name test3 Database Identifier 4 Database File /var/tmp/test3/test3.dbs Max Object Count 10000000 Datafiles Datafile #0 Name DEFAULT Dataspace #0 File test3.dat Maxsize ~2048Mb Slotsize 16b Server Access read/write Default Access NO_DBACCESS_MODE Database Access User Name francois Access Mode ADMIN_DBACCESS_MODEmkdir /var/tmp/test3copy
eyedbadmin database copy --filedir=/var/tmp/test3copy test3 test3copy
eyedbadmin database list test3copy
Database Name test3copy Database Identifier 4 Database File /var/tmp/test3copy/test3copy.dbs Max Object Count 10000000 Datafiles Datafile #0 Name DEFAULT Dataspace #0 File /var/tmp/test3copy/test3copy.dat Maxsize ~2048Mb Slotsize 16b Server Access read/write Default Access NO_DBACCESS_MODE
Moving a database is a different operation than renaming a database: moving a database means moving the database files to a new directory, without changing the database name.
Moving a database is done using the eyedbadmin command:
eyedbadmin
database move
[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. This option is mandatory.
Command arguments are:
database
name of database to move
Example 3.7. eyedbadmin database move
eyedbadmin database list test2
Database Name test2 Database Identifier 3 Database File /var/tmp/test2.dbs Max Object Count 10000000 Datafiles Datafile #0 Name DEFAULT Dataspace #0 File test2.dat Maxsize ~2048Mb Slotsize 16b Server Access read/write Default Access NO_DBACCESS_MODE Database Access User Name francois Access Mode ADMIN_DBACCESS_MODEmkdir /var/tmp/test2
eyedbadmin database move --filedir=/var/tmp/test2 test2
eyedbadmin database list test2
Database Name test2 Database Identifier 3 Database File /var/tmp/test2/test2.dbs Max Object Count 10000000 Datafiles Datafile #0 Name DEFAULT Dataspace #0 File test2.dat Maxsize ~2048Mb Slotsize 16b Server Access read/write Default Access NO_DBACCESS_MODE