如何使用 oracle 将表和数据从一个数据库复制到另一个数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12855541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 01:10:36  来源:igfitidea点击:

how can i copy table and data from one database to another using oracle

sqldatabaseoraclecopyexport

提问by jampez77

I'm using Oracle PL/SQL developer. I have two databases live and dummy.

我正在使用 Oracle PL/SQL 开发人员。我有两个实时数据库和虚拟数据库。

I have been using the dummy database for development and now i need to add all the new tables and data into the live database without effecting the data currently stored in it.

我一直在使用虚拟数据库进行开发,现在我需要将所有新表和数据添加到实时数据库中,而不影响当前存储在其中的数据。

I also need to copy over all the new sequences and triggers.

我还需要复制所有新序列和触发器。

I've tried exporting a table but had no luck and using the SQL view i only get the SQL for the creation of the data and not the data it contains.

我试过导出一个表,但没有运气,使用 SQL 视图我只能获取用于创建数据的 SQL,而不是它包含的数据。

I also found this SQL code

我还发现了这个 SQL 代码

COPY FROM test@DUMMY - CREATE test -USING SELECT * FROM test;

But it asks me for a name and password of which I dont know and then fails after 3 attempts. It then goes on to say there is a syntax error as well.

但它要求我输入一个我不知道的名称和密码,然后在 3 次尝试后失败。然后它继续说也有语法错误。

I'm still fairly new to using Oracle and any help would be appreciated.

我对使用 Oracle 还是很陌生,任何帮助将不胜感激。

采纳答案by Robert

You can do that using datapump.

您可以使用datapump来做到这一点。

or if you want to copy from schema to schema

或者如果你想从模式复制到模式

create table shecma2.old_table 
as 
select * from schema1.old_table

or using oracle sql developer - hereis link.

或使用 oracle sql developer -是链接。

回答by TechDo

Try:

尝试:

CREATE TABLE NEWTABLE AS SELECT * FROM OLDTABLE;