This topic describes how to migrate data across DataWorks workspaces in the same region.
Prerequisites
All the steps in the tutorial Build an online operation analysis platform are completed. For more information, see Business scenarios and development process.Background information
This topic uses the bigdata_DOC workspace created in the tutorial Build an online operation analysis platform as the source workspace. You need to create a destination workspace to store the tables, resources, configurations, and data synchronized from the source workspace.Procedure
- Create a destination workspace.
- Clone node configurations and resources across workspaces.You can use the cross-workspace cloning feature of DataWorks to clone the node configurations and resources from the bigdata_DOC workspace to the clone_test_doc workspace. For more information, see Clone nodes across workspaces.Note
- The cross-workspace cloning feature cannot clone table schemas or data.
- The cross-workspace cloning feature cannot clone combined nodes. If the destination workspace needs to use the combined nodes that exist in the source workspace, you need to manually create the combined nodes in the destination workspace.
- Go to the bigdata_DOC workspace and click Cross-project cloning in the upper-right corner. The Create Clone Task page appears.
- Set Target Workspace to clone_test_doc and Workflow to Workshop that needs to be cloned. Select all the nodes in the workflow and click Add to List. Click To-Be-Cloned Node List in the upper-right corner.
- In the Nodes to Clone pane that appears, click Clone All. The selected nodes are cloned to the clone_test_doc workspace.
- Go to the destination workspace and check whether the nodes are cloned.
- Create tables.The cross-workspace cloning feature cannot clone table schemas. Therefore, you need to manually create required tables in the destination workspace.
- For non-partitioned tables, we recommend that you use the following SQL statement to synchronize the table schema from the source workspace:
create table table_name as select * from Source workspace. Table name;
- For partitioned tables, we recommend that you use the following SQL statement to synchronize the table schema from the source workspace:
create table table_name partitioned by (Partition key column string);
Commit the tables to the production environment. For more information, see Create tables.
- For non-partitioned tables, we recommend that you use the following SQL statement to synchronize the table schema from the source workspace:
- Synchronize data.The cross-workspace cloning feature cannot clone data from the source workspace to the destination workspace. You need to manually synchronize required data to the destination workspace. To synchronize the data of the rpt_user_trace_log table from the source workspace to the destination workspace, follow these steps: