Copying data between Oracle schemas using SQL

依然范特西╮ 提交于 2019-12-03 12:22:21

Prefix your table names with the schema names when logged in as a user with access to both:

insert into MY_DATA.table_name select * from CORE_DATA.table_name;

Assuming that the tables are defined identically in both schemas, the above will copy all records from the table named table_name in CORE_DATA to the table named table_name in MY_DATA.

funny_irony
usage: COPY FROM [db] TO [db] [opt] [table] { ([cols]) } USING [sel]

  [db]   : database schema string, e.g., grprass/grprass@grprass, pplan/pplan@prassm1
  [opt]  : ONE of the keywords: APPEND, CREATE, INSERT or REPLACE
  [table]: name of the destination table
  [cols] : a comma-separated list of destination column aliases ( optional )
  [sel]  : any valid SQL SELECT statement

SQL> COPY FROM scott/tiger@schema1 TO scott/tiger@schema2 insert mytable using select * from mytable;

your schema must have grant create any table privilege for this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!