Previous Next JavaScript must be enabled to correctly display this content

## Migrate from Oracle NoSQL Database On-Premise to Oracle NoSQL Database Cloud Service

This example shows how to use the Oracle NoSQL Database Migrator to copy data and the schema definition of a NoSQL table from Oracle NoSQL Database to Oracle NoSQL Database Cloud Service (NDCS).

Use Case

As a developer, you are exploring options to avoid the overhead of managing the resources, clusters, and garbage collection for your existing NoSQL Database KVStore workloads. As a solution, you decide to migrate your existing on-premise KVStore workloads to Oracle NoSQL Database Cloud Service because NDCS manages them automatically.

Example

For the demonstration, let us look at how to migrate the data and schema definition of a NoSQL table called `myTable` from the NoSQL Database KVStore to NDCS. We will also use this use case to show how to run the `runMigrator` utility by passing a precreated configuration file.
Prerequisites

- Identify the source and sink for the migration.
  - Source: Oracle NoSQL Database
  - Sink: Oracle NoSQL Database Cloud Service
- Identify your OCI cloud credentials and capture them in the OCI config file. Save the config file in `/home/.oci/config`. See Acquiring Credentials in Using Oracle NoSQL Database Cloud Service.

      [DEFAULT]
      tenancy=ocid1.tenancy.oc1....
      user=ocid1.user.oc1....
      fingerprint= 43:d1:....
      key_file=</fully/qualified/path/to/the/private/key/>
      pass_phrase=<passphrase>

- Identify the region endpoint and compartment name for your Oracle NoSQL Database Cloud Service.
  - endpoint: `us-phoenix-1`
  - compartment: `developers`
- Identify the following details for the on-premise KVStore:
  - storeName: `kvstore`
  - helperHosts: `<hostname>:5000`
  - table: `myTable`

Procedure
To migrate the data and schema definition of `myTable` from NoSQL Database KVStore to NDCS:

1. Prepare the configuration file (in JSON format) with the identified Source and Sink details. See Source Configuration Templates and Sink Configuration Templates.

       {
         "source" : {
           "type" : "nosqldb",
           "storeName" : "kvstore",
           "helperHosts" : ["<hostname>:5000"],
           "table" : "myTable",
           "requestTimeoutMs" : 5000
         },
         "sink" : {
           "type" : "nosqldb_cloud",
           "endpoint" : "us-phoenix-1",
           "table" : "myTable",
           "compartment" : "developers",
           "schemaInfo" : {
             "schemaPath" : "<complete/path/to/the/JSON/file/with/DDL/commands/for/the/schema/definition>",
             "readUnits" : 100,
             "writeUnits" : 100,
             "storageSize" : 1
           },
           "credentials" : "<complete/path/to/oci/config/file>",
           "credentialsProfile" : "DEFAULT",
           "writeUnitsPercent" : 90,
           "requestTimeoutMs" : 5000
         },
         "abortOnError" : true,
         "migratorVersion" : "1.7.0"
       }

2. Open the command prompt and navigate to the directory where you extracted the NoSQL Database Migrator utility.
3. Run the `runMigrator` command by passing the configuration file using the `--config` or `-c` option.

       [~/nosqlMigrator/nosql-migrator-1.7.0]$./runMigrator --config <complete/path/to/the/JSON/config/file>

4. The utility proceeds with the data migration, as shown below.

       Records provided by source=10, Records written to sink=10, Records failed=0.
       Elapsed time: 0min 10sec 426ms
       Migration completed.

Validation

To validate the migration, you can login to your NDCS console and verify that `myTable` is created with the source data.