【问题标题】:Copy data from one database to another using SQLPLUS/shell使用 SQLPLUS/shell 将数据从一个数据库复制到另一个数据库
【发布时间】:2021-08-08 17:13:44
【问题描述】:

我需要将数据从远程数据库之一复制到我的服务器中的数据库。但我在下面变得更糟了。

insert into table_here@oprdb select * from view_on_remote@AISPRD where rownum<10;

                                      *
ERROR at line 1:
ORA-02019: connection description for remote database not found

我也尝试在查询之前连接到两者:

conn schema/password@host:port/srvc_name;
conn schema/password@host:port/srvc_name1;

尝试 COPY 命令也失败了:

Array fetch/bind size is 15. (arraysize is 15)
Will commit when done. (copycommit is 0)
Maximum long size is 80. (long is 80)

CPY-0012: Datatype cannot be copied

但它仍然显示未找到连接描述。

谁能帮我解决我的问题。

【问题讨论】:

    标签: sql database oracle etl


    【解决方案1】:

    使用COPY 命令

    --connect to target db    
    sqlplus schema/password@host:port/oprdb
    sqlplus>copy from schema/password@host:port/AISPRD insert table_here using -
    select * from view_on_remote where rownum<10;
    

    【讨论】:

    • 我也尝试过 COPY,但我也有 datetime 列,所以它失败了。
    • “所以它失败”根本没有帮助。请发布相关详细信息和错误消息。目标和源都应该具有相同的表结构或复制到临时表并插入目标。没有日期时间数据输入 Oracle。你是在 Oracle 和 Oracle 之间复制吗?
    • 它说“不支持数据类型”我将复制错误并将确切的错误代码发送给您
    • 另外,我打错了,我在源数据中有时间戳列。
    • 复制命令不支持时间戳。 datatype.convert to_char 到 staging 表并插入到目标表中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-01
    相关资源
    最近更新 更多