Your cart is currently empty!
Category: orientdb
-
Khóa học miễn phí OrientDB – Backup Database nhận dự án làm có lương
OrientDB – Backup Database
Like RDBMS, OrientDB also supports the backup and restore operations. While executing the backup operation, it will take all files of the current database into a compressed zip format using the ZIP algorithm. This feature (Backup) can be availed automatically by enabling the Automatic-Backup server plugin.
Taking backup of a database or exporting a database is the same, however, based on the procedure we have to know when to use backup and when to use export.
While taking backup, it will create a consistent copy of a database, all further write operations are locked and waiting to finish the backup process. In this operation, it will create a read-only backup file.
If you need the concurrent read and write operation while taking a backup you have to choose exporting a database instead of taking backup of a database. Export doesn’t lock the database and allows concurrent writes during the export process.
The following statement is the basic syntax of database backup.
./backup.sh <dburl> <user> <password> <destination> [<type>]
Following are the details about the options in the above syntax.
<dburl> − The database URL where the database is located either in the local or in the remote location.
<user> − Specifies the username to run the backup.
<password> − Provides the password for the particular user.
<destination> − Destination file location stating where to store the backup zip file.
<type> − Optional backup type. It has either of the two options.
-
Default − locks the database during the backup.
-
LVM − uses LVM copy-on-write snapshot in background.
Example
Take a backup of the database demo which is located in the local file system /opt/orientdb/databases/demo into a file named sample-demo.zip and located into the current directory.
You can use the following command to take a backup of the database demo.
$ backup.sh plocal: opt/orientdb/database/demo admin admin ./backup-demo.zip
Using Console
The same you can do using the OrientDB console. Before taking the backup of a particular database, you have to first connect to the database. You can use the following command to connect to the database named demo.
orientdb> CONNECT PLOCAL:/opt/orientdb/databases/demo admin admin
After connecting you can use the following command to take backup of the database into a file named ‘backup-demo.zip’ in the current directory.
orientdb {db=demo}> BACKUP DATABASE ./backup-demo.zip
If this command is executed successfully, you will get some success notifications along with following message.
Backup executed in 0.30 seconds
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc
-
Khóa học miễn phí OrientDB – Alter Database nhận dự án làm có lương
OrientDB – Alter Database
Database is a one of the important data models with different attributes that you can modify as per your requirements.
The following statement is the basic syntax of the Alter Database command.
ALTER DATABASE <attribute-name> <attribute-value>
Where <attribute-name> defines the attribute that you want to modify and <attribute-value> defines the value you want to set for that attribute.
The following table defines the list of supported attributes for altering a database.
Sr.No. | Attribute Name | Description |
---|---|---|
1 | STATUS | Defines the database’s status between different attributes. |
2 | IMPORTING | Sets the importing status. |
3 | DEFAULTCLUSTERID | Sets the default cluster using ID. By default it is 2. |
4 | DATEFORMAT | Sets the particular date format as default. By default it is “yyyy-MM-dd”. |
5 | DATETIMEFORMAT | Sets the particular date time format as default. By default it is “yyyy-MM-dd HH:mm:ss”. |
6 | TIMEZONE | Sets the particular time zone. By default it is Java Virtual Machine’s (JVM’s) default time zone. |
7 | LOCALECOUNTRY | Sets the default locale country. By default it is JVM’s default locale country. For example: “GB”. |
8 | LOCALELANGUAGE | Sets the default locale language. By default it is JVM’s default locale language. For example: “en”. |
9 | CHARSET | Sets the type of character set. By default it is JVM’s default charset. For example: “utf8”. |
10 | CLUSTERSELECTION | Sets the default strategy used for selecting the cluster. These strategies are created along with the class creation. Supported strategies are default, roundrobin, and balanced. |
11 | MINIMUMCLUSTERS | Sets the minimum number of clusters to create automatically when a new class is created. By default it is 1. |
12 | CUSTOM | Sets the custom property. |
13 | VALIDATION | Disables or enables the validations for entire database. |
Example
From the version of OrientDB-2.2, the new SQL parser is added which will not allow the regular syntax in some cases. Therefore, we have to disable the new SQL parser (StrictSQL) in some cases. You can use the following Alter database command to disable the StrictSQL parser.
orientdb> ALTER DATABASE custom strictSQL = false
If the command is executed successfully, you will get the following output.
Database updated successfully
Khóa học lập trình tại Toidayhoc vừa học vừa làm dự án vừa nhận lương: Khóa học lập trình nhận lương tại trung tâm Toidayhoc