[英]Copying data between Oracle schemas using SQL
I'm trying to copy data from one Oracle schema ( CORE_DATA
) into another ( MY_DATA
) using an INSERT INTO (...)
SQL statement. 我正在尝试使用
INSERT INTO (...)
SQL语句将数据从一个Oracle模式( CORE_DATA
)复制到另一个( MY_DATA
)。
What would the SQL statement look like? SQL语句会是什么样的?
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. 假设这些表在两个模式中的定义相同,上面会将CORE_DATA中名为table_name的表中的所有记录复制到MY_DATA中名为table_name的表中。
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;
您的架构必须具有grant为此创建任何表特权
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.