User Guide > User Guide > A. Command Reference > clonedb Command--Clone a Database
Was this helpful?
clonedb Command--Clone a Database
The clonedb utility clones a database between two servers. It can be used to move a database from one machine or cluster to another. It can be used, for example, to clone a production database for testing purposes.
For VectorH, the two servers can be on the same or different Hadoop cluster.
The two instances must be at the same product version, including the same service pack level. You cannot clone a database from one instance to another instance on the same machine.
Source and target II_SYSTEMs can differ.
Clonedb copies all of the schema in a database to the target; no partial database cloning is possible. The schema the database contains need not have active users in the target installation.
Cloning means making identical copies, so a database cannot be cloned between operating systems or product variants, such as Vector and VectorH.
Notes:
You cannot clone a database from one instance to another on the same machine.
The alterdb -readonly command is run on the source database as part of the clonedb command so no changes are made to the source database during the clonedb operation. If the source database has open sessions, the alterdb within clonedb will stall until sessions are ended.
We recommend taking a checkpoint of the cloned database after cloning is complete.
This command has the following format:
clonedb -source_dbname source_dbname -source source_machine ‑source_ii_system source_II_SYSTEM ‑target_dbname target_dbname -target target_machine ‑target_ii_system target_II_SYSTEM [-key keyfile] [-trial] [‑source_user source_user] [-target user target_user]
 
-source_dbname source_dbname
Specifies the name of the database to be copied.
-source source_machine
Specifies the name of the source machine.
-source_ii_system source_II_SYSTEM
Specifies the II_SYSTEM path on the source machine.
-target_dbname target_dbname
Specifies the name of the target database.
-target target_machine
Specifies the name of the target machine.
-target_ii_system target_II_SYSTEM
Specifies the II_SYSTEM path on the target machine.
-key keyfile
Specifies the fully-qualified RSA key file for SSH authentication (for example: /.ssh/id_rsa). Specifying an authentication key is recommended; otherwise password authentication will be required multiple times instead of once. An authentication key can be generated by using the Linux utility ssh-keygen.
-trial
Performs a trial copy (no files copied). The target installation is started, a database created.
‑source_user source_user
Specifies the name of the database user (installation owner) on the source system. Use this option to override the current user.
-target_user username
Specifies the name of the database user (installation owner) on the target system. Use this option to override the current user.
‑v
Runs clonedb in verbose mode, which displays messages as the operation proceeds.
clonedb Example
Copy database mydb from the server vector-cluster5 in the II_SYSTEM location /opt/Actian/VectorV3 into the target database mydb2 on the server vector-cluster6 in the II_SYSTEM location /opt/Actian/VectorG8, as the actian user on target server, using SSH authentication key.
clonedb -source_dbname mydb -source vector-cluster5 ‑source_ii_system /opt/Actian/VectorV3 -target vector-cluster6 -target_ii_system /opt/Actian/VectorG8 -target_dbname mydb2 -target_user actian -key ~/.ssh/id_rsa
Last modified date: 01/26/2023