点睛图 > 文档 > OSYNC入门指南

OSYNC命令行使用

OSYNC是基于Oracle直接路径接口的数据库全表导出、导入工具,采用多线程方式同时复制多张表,具有极高的性能,速度和expdp/impdp相当。可用于逻辑复制软件数据初始化同步、测试环境数据导入、Oracle跨平台、版本数据迁移等。

以下示例把ANDY用户下的表t_big_table从Linux ORACLE 10g导出,然后导入到Windows ORACLE 12c:

1. osync.ini文件中配置连接字符串


#source connect str>
source=andy/andy@192.168.1.100:1521/db10205

#target connect str>
target=andy/andy@192.168.1.200:1521/db11203

2. table.list文件中配置要导出、导入的表


# < owner.table > <owner.table >
andy.t_big_table andy.t_big_table

3. 从Linux ORACLE 10g导入到Windows ORACLE 12c


OSYNC> init sync 验证导出表、并置初始复制状态为未复制。
OSYNC> start sync
DB information:
  --------------------------------------------------------------------------------------------------
  |             |Machine             |DB                  |Instance            |Version             |
  --------------------------------------------------------------------------------------------------
  |From(Source) |shareplex           |DB10205             |db10205             |10.2.0.5.0          |
  --------------------------------------------------------------------------------------------------
  |  To(Target) |ANDY-PC             |TEST121             |test121             |12.1.0.1.0          |
  ------------------- ------------------------------------------------------------------------------
Are you sure to start sync? (N) y
Starting sync...

4. 导入完成


可以看到,800万行,700MB(纯数据)的表,通过百兆网络带宽传输,在2分钟之内便完成导出、导入。
OSYNC> status
Sync Table Statistics (Total: 1, Init: 0, Exported: 0, Imported: 1, Error: 0)
Sync Threads (Table synced 1, syncing 0, error 0, remain 0)
Thread# 0: (Table synced 0, error 0, elapsed 0.00 secs, db read/db write: 0.00/0.00 secs)
Current Table:[ ], status:[Unknown] (synced: 0.00 MB 0 rows 0.00 secs)
Thread# 1: (Table synced 0, error 0, elapsed 0.00 secs, db read/db write: 0.00/0.00 secs)
Current Table:[ ], status:[Unknown] (synced: 0.00 MB 0 rows 0.00 secs)
Thread# 2: (Table synced 1, error 0, elapsed 114.55 secs, db read/db write: 10.23/104.32 secs)
Current Table:[ANDY.T_BIG_TABLE], status:[Finish] (synced: 714.49 MB 8099838 rows 114.55 secs)
Thread# 3: (Table synced 0, error 0, elapsed 0.00 secs, db read/db write: 0.00/0.00 secs)
Current Table:[ ], status:[Unknown] (synced: 0.00 MB 0 rows 0.00 secs)
Thread# 4: (Table synced 0, error 0, elapsed 0.00 secs, db read/db write: 0.00/0.00 secs)
Current Table:[ ], status:[Unknown] (synced: 0.00 MB 0 rows 0.00 secs)