backupDB
Syntax
backupDB(backupDir, dbPath, [keyPath])
Details
Back up the specific database to the specified directory.
The function is equivalent to backup(backupDir, dbPath, force=false,
sparallel=true, snapshot=true).
Arguments
backupDir is a string indicating the directory to save the backup.
dbPath is a string indicating the database path.
keyPath (optional, Linux only) is a STRING scalar that specifies the path to the TDE key file used for backup encryption. If left empty, no encryption will be applied.
Return
An INT scalar, indicating the number of databases that were backed up.
Examples
dbName = "dfs://compoDB2"
n=1000
ID=rand("a"+string(1..10), n)
dates=2017.08.07..2017.08.11
date=rand(dates, n)
x=rand(10, n)
t=table(ID, date, x)
db1 = database(, VALUE, 2017.08.07..2017.08.11)
db2 = database(, HASH,[INT, 20])
if(existsDatabase(dbName)){
dropDatabase(dbName)
}
db = database(dbName, COMPO,[ db1,db2])
//create 2 tables
pt1 = db.createPartitionedTable(t, `pt1, `date`x).append!(t)
pt2 = db.createPartitionedTable(t, `pt2, `date`x).append!(t)
// Specify the directory to store the backup data.
// The following is an example; please modify the path as needed.
backupDir = "/home/test/dolphindb/server/backup/"
backupDB(backupDir, dbName)
Related functions: backup, backupTable, restore, restoreDB, restoreTable, migrate
