暂无图片
数据同步
我来答
分享
暂无图片 匿名用户
数据同步

Oracle19C,PDB库,生产到测试进行数据同步,大家用什么方法呢?我用数据泵各种报错。。。

我来答
添加附件
收藏
分享
问题补充
5条回答
默认
最新
农夫三拳

实时同步的话当然是oracle自家的goldengate最稳,

你用数据泵啥错误

暂无图片 评论
暂无图片 有用 1
渣男壹号

不是实时的,可能很久或者是特定的某些需要测试才会用到,网络这些都不通的。错误可太多了

ORA-31684

ORA-39151

ORA-06502

ORA-06512

ORA-39126

ORA-27477

暂无图片 评论
暂无图片 有用 1
农夫三拳

加个参数解决对象已存在的问题

impdp的table_exists_action参数
table_exists_action选项:{skip 是如果已存在表,则跳过并处理下一个对象;append是为表增加数据;truncate是截断表,然后为其增加新数据;replace是删除已存在表,重新建表并追加数据}

暂无图片 评论
暂无图片 有用 2
愤怒的蜗牛
2022-10-20
李宏达
2022-10-20
JiekeXu
暂无图片

如果要用数据泵的话,数据不大的情况,你的生产环境建议按用户导出,然后再测试库建立对应的表空间,清理测试环境同名用户,再导入数据到对应的用户下,这样也比较简单,不会报错。再简单点就是不管数据完整性和依赖性直接加参数 “table_exists_action”。

39151, 00000, “Table %s exists. All dependent metadata and data will be skipped due to table_exists_action of skip”

如果数据量比较大的话,那就用 TTS 表空间传输;或者就是 rman 备份恢复了。

暂无图片 评论
暂无图片 有用 2
严少安
2022-10-20
👍‍
李宏达
2022-10-20
张sir

各个报错码的意思如下,

[oracle@ops-dev-app ~]$ oerr ora 31684
31684, 00000, "Object type %s already exists"
// *Document: NO


[oracle@ops-dev-app ~]$ oerr ora 39151
39151, 00000, "Table %s exists. All dependent metadata and data will be skipped due to table_exists_action of skip"
// *Document: NO


[oracle@ops-dev-app ~]$ oerr ora 06502
06502, 00000, "PL/SQL: numeric or value error%s"
// *Cause: An arithmetic, numeric, string, conversion, or constraint error
// occurred. For example, this error occurs if an attempt is made to
// assign the value NULL to a variable declared NOT NULL, or if an
// attempt is made to assign an integer larger than 99 to a variable
// declared NUMBER(2).
// *Action: Change the data, how it is manipulated, or how it is declared so
// that values do not violate constraints.


[oracle@ops-dev-app ~]$ oerr ora 06512
06512, 00000, "at %sline %s"
// *Cause: Backtrace message as the stack is unwound by unhandled
// exceptions.
// *Action: Fix the problem causing the exception or write an exception
// handler for this condition. Or you may need to contact your
// application administrator or DBA.


[oracle@ops-dev-app ~]$ oerr ora 39126
39126, 00000, "Worker unexpected fatal error in %s [%s] \n%s"
// *Cause: An unhandled exception was detected internally within the worker
// process for the Data Pump job. This is an internal error.
// Additional information may be supplied.
// *Action: If problem persists, contact Oracle Customer Support.


[oracle@ops-dev-app ~]$ oerr ora 27477
27477, 00000, "\"%s.%s\" already exists"
// *Cause: An attempt was made to create an object with a name that has
// already been used by another object in the same schema.
// *Action: Reissue the command using a different name or schema.


其中ORA31684 ORA39151 ORA27477都显示导入的目标库种已存在相关的对象,可以参考文章的解决方案:

https://blog.csdn.net/u013758456/article/details/104365597

1.导入的数据库中已经有相同的用户名和老旧的表
加上参数 table_exists_action=replace

2.导入用户不一致
加上参数 remap_schame=原用户名abc:新用户名qwe

3.导入表空间不一致
加上参数 remap_tablespace=ZKH:ZKH3

先解决这几个报错,再看其他的报错是否还有。

暂无图片 评论
暂无图片 有用 2
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏