Oracle SQL:将表从一个用户传输到另一个用户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16127938/
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:36:03  来源:igfitidea点击:

Oracle SQL: Transferring tables from one user to another

oraclesqlplususer-profilecopying

提问by Anonymous Person

I created a new user called temp, with a password temp. I have another user called Scottthat is identified by tiger. There are three tables in that profile that I'd like to copy onto temp. So i logged on to tempand punched in this (for the first table called iowe)

我创建了一个名为 temp 的新用户,密码为temp。我有另一个名为Scott 的用户,由Tiger标识。我想将该配置文件中的三个表复制到temp 上。所以我登录到temp并输入了这个(对于第一个名为iowe 的表)

copy from  iowe@scott - create iowe - using select * from iowe; 

Right after this when I hit Enter, it asked me the FROM password. I input tiger, and it threw an error. This is how it looks like:

在此之后,当我点击Enter 时,它询问我 FROM 密码。我输入Tiger,它抛出了一个错误。这是它的样子:

enter image description here

在此处输入图片说明

So please tell me if there is a way to copy tables from one user to the other (I am sure there is)

所以请告诉我是否有办法将表从一个用户复制到另一个用户(我确定有)

Your help is greatly appreciated.

非常感谢您的帮助。

回答by Lokesh

Use this syntax:

使用以下语法:

CREATE TABLE temp.iowe
  AS (SELECT * FROM scott.iowe);

Check this link : http://www.techonthenet.com/sql/tables/create_table2.php

检查此链接:http: //www.techonthenet.com/sql/tables/create_table2.php

Also note that temp user should have permission to access data in Scott schema.

另请注意,临时用户应有权访问 Scott 模式中的数据。

EDIT:

编辑:

Command to grant access to another user: Login as Scott and run below command:

授予其他用户访问权限的命令:以 Scott 身份登录并运行以下命令:

grant select, insert, update, delete on iowe to temp;

Check this link for details : http://www.techonthenet.com/oracle/grant_revoke.php

查看此链接了解详细信息:http: //www.techonthenet.com/oracle/grant_revoke.php

回答by Naresh

copy from system/manager@localhost to scott/tiger@localhost create family using select * from family;