1. 程式人生 > >將oracle遠端資料庫匯出匯入到本地

將oracle遠端資料庫匯出匯入到本地

1.  匯出遠端oracle資料庫(ip為192.168.1.186,埠號為1521,sid為orcl)中,使用者tom(密碼為tom)的資料,

並將資料存至d:/daochu.dmp中(tom為dba角色,後面本地使用者也要賦予相應的角色)

exp tom/[email protected]:1521/orcl file=d:/daochu.dmp

2.使用pl/sql在本地oracle資料庫建立相應的使用者,並授予許可權,賦予角色

plsql建立表空間:


--建立使用者
create user tom
identified by tom
account unlock;

--授予許可權
grant create session to tom;
grant create table to tom;

--賦予角色
grant dba to tom;

3.將匯出的檔案匯入本地oracle資料庫(ip為本機localhost,埠號為1521,sid為mydb),

需要匯入的檔案為d:/daochu.dmp


imp tom/[email protected]:1521/mydb file=d:/daochu.dmp fromuser=tom touser=tom

4.如果需要刪除當前已匯入資料的使用者tom下的資料,可以如下操作:

(1)級聯刪除使用者tom

drop user tom cascade;

(2)重新建立使用者tom,並授予許可權和角色

create user tom

identified by tom

account unlock;

grant dba to tom;