Skip to content
lvca edited this page Dec 10, 2012 · 23 revisions

Console command list

Introduction

<wiki:toc max_depth="4" />

The OrientDB Console is a Java Application made to work against OrientDB databases and Server instances.

Interactive mode

This is the default mode. Just launch the console by executing the script bin/console.sh (or bin/console.bat in MS Windows systems). Assure to have execution permission on it.

Once started the console is ready to accepts commands. OrientDB console v.1.1.0 (build 11200) www.orientechnologies.com Type 'help' to display all the commands supported.

orientdb>

To know all the supported commands look to commands.

Batch mode

To execute commands in batch mode run the bin/console.sh (or bin/console.bat in MS Windows systems) script passing all the commands separated with semicolon ";". Example:

> console.bat "connect remote:localhost/demo;select * from profile"

Or call the console script passing the name of the file in text format containing the list of commands to execute. Commands must be separated with semicolon ";". Example:

> console.bat commands.txt

Console commands

To know all the commands supported by the Orient console open it and type help or ?.

**Command** **Description**
Console Command Alter Class Changes the class schema
Console Command Alter Class Changes the cluster attributes
Console Command Alter Class Changes the database attributes
Console Command Alter Property Changes the class's property schema
Console Command Begin Begins a new transaction
Console Command Browse Class Browses all the records of a class
Console Command Browse Cluster Browses all the records of a cluster
Console Command Check Database Checks the database integrity
Console Command Classes Displays all the configured classes
Console Command Cluster Status Displays the status of distributed cluster of servers
Console Command Clusters Displays all the configured clusters
Console Command Commit Commits an active transaction
Console Command Compare Databases Compare 2 databases
[compact database](SQLCompactDatabase) Compacts the database reducing the free holes
Console Command Config Displays the configuration where the opened database is located (local or remote)
Console Command Config Get Returns a configuration value
Console Command Config Set Set a configuration value
Console Command Connect Connects to a database
Console Command Copy Database Copies a database to a remote server
Console Command Create Cluster Creates a new cluster inside a database
Console Command Create Db Creates a new class
Console Command Create Cluster Creates a new record cluster
Console Command Create Db Creates a new database
Console Command Create Data Segment Creates a new data-segment
[create edge](SQLCreateEdge) Create a new edge connecting two vertices
[create index](SQLCreateIndex) Create a new index
[create link](SQLCreateLink) Create a link reading a RDBMS JOIN
[create vertex](SQLCreateVertex) Create a new vertex
Console Command Declare Intent Declares an intent
Console Command Delete Deletes a record from the database using the SQL syntax. To know more about the [SQL syntax go here](SQLQuery)
Console Command Dictionary Keys Displays all the keys in the database dictionary
Console Command Dictionary Get Loookups for a record using the dictionary. If found set it as the current record
Console Command Dictionary Put Inserts or modify an entry in the database dictionary. The entry is composed by key=String, value=record-id
Console Command Dictionary Remove Removes the association in the dictionary
Console Command Disconnect Disconnects from the current database
Console Command Display Record Displays current record's attributes
Console Command Display Raw Record Displays current record's raw format
[drop class](SQLDropClass) Drop a class
[drop cluster](SQLDropCluster) Drop a cluster
Console Command Drop Db Drop a database
[drop index](SQLDropIndex) Drop an index
[drop property](SQLDropProperty) Drop a property from a schema class
[explain](SQLExplain) Explain a command by displaying the profiling values while executing it
Console Command Export Exports a database
Console Command Export Record Exports a record in any of the supported format (i.e. json)
[find references](SQLFindReferences) Find the references to a record
Console Freeze Database Freezes the database locking all the changes. Use this to raw backup. Once frozen it use the Console Release Database to release it
Console Command Get Returns the value of a property
[grant](SQLGrant) Grants a permission to a user
Console Command Import Imports a database previously exported
Console Command Indexes Displays information about indexes
Console Command Info Displays information about current status
Console Command Info Class Displays information about a class
Console Command Insert Inserts a new record in the current database using the SQL syntax. To know more about the [SQL syntax go here](SQLQuery)
[js](JavascriptCommand#Via_console) Executes a Javascript in the console
[jss](JavascriptCommand#Via_console) Executes a Javascript in the server
Console Command List Databases List the available databases
Console Command Load Record Loads a record in memory and set it as the current one
Console Command Profiler Controls the Profiler
Console Command Properties Returns all the configured properties
pwd Display current path
[rebuild index](SQLRebuildIndex) Rebuild an index
Console Release Database Releases a Console Freeze Database database
Console Command Reload Record Reloads a record in memory and set it as the current one
Console Command Reload Schema Reloads the schema
Console Command Rollback Rollbacks the active transaction started with Console Command Begin
Console Command Select Executes a SQL query against the database and display the results. To know more about the [SQL syntax go here](SQLQuery)
[revoke](SQLRevoke) Revokes a permission to a user
Console Command Set Changes the value of a property
Console Command Sleep Sleep for the time specified. Useful on scripts
Console Command Show Holes Displays the database's holes
[traverse](SQLTraverse) Traverse a graph of records
Console Command Truncate Class Remove all the records of a class (by truncating all the underlying configured clusters)
Console Command Truncate Cluster Remove all the records of a cluster
Console Command Truncate Record Truncate a record you can't delete because it's corrupted
Console Command Update Updates a record in the current database using the SQL syntax. To know more about the [SQL syntax go here](SQLQuery)
help Prints this help
exit Closes the console

Extend the console with custom command

Edit the OConsoleDatabaseApp class and add a new method. There's an auto discovering system that put the new method between the available commands. To provide a description of the command use the annotations (look below). The command name must follow the Java code convention where to separate works just use the Camel-case.

So, for example, if you want to create the brand new "move cluster" command: @ConsoleCommand(description = "Move the physical location of cluster files") public void moveCluster( @ConsoleParameter(name = "cluster-name", description = "The name or the id of the cluster to remove") String iClusterName, @ConsoleParameter(name = "target-path", description = "path of the new position where to move the cluster files") String iNewPath ) {

  checkCurrentDatabase(); // THE DB MUST BE OPENED

  System.out.println("Moving cluster '" + iClusterName + "' to path " + iNewPath + "...");
}

If you type: > console > help Your new command will appear. And now try: > move cluster foo /temp

Moving cluster 'foo' to path /temp...

Don't miss to contribute your command to the OrientDB community! ;-)

Clone this wiki locally