Oracle SQL: Transferring tables from one user to another

Anonymous Person picture Anonymous Person · Apr 21, 2013 · Viewed 17.7k times · Source

I created a new user called temp, with a password temp. I have another user called Scott that is identified by tiger. There are three tables in that profile that I'd like to copy onto temp. So i logged on to temp and punched in this (for the first table called 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 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.

Answer

Lokesh picture Lokesh · Apr 21, 2013

Use this syntax:

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

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

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

EDIT:

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

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

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