資料泵匯出遠端伺服器資料庫到本地詳解
阿新 • • 發佈:2018-11-29
一、資料庫在伺服器,在本地操作,匯出資料庫到本地
1、cmd下登入資料庫,建立本地使用者
sqlplus sys/1 as sysdba;
//oracle建立使用者,只需把所有的dzlnurse改成你要建的使用者名稱字 create user dzlnurse //下面的1是要建立資料庫的密碼 identified by "1" default tablespace USERS temporary tablespace TEMP profile DEFAULT; grant connect to dzlnurse; grant dba to dzlnurse; grant resource to dzlnurse; grant create procedure to dzlnurse with admin option; grant create table to dzlnurse with admin option; grant create tablespace to dzlnurse with admin option; grant create user to dzlnurse; grant create view to dzlnurse with admin option; grant debug connect session to dzlnurse with admin option; grant unlimited tablespace to dzlnurse with admin option;
2、授予連線角色,資源角色給使用者
grant connect,resource to dzlnurse;
3、授權建立資料鏈接
grant create table,create database link to dzlnurse;
4、建立目錄
//第一個jackson為oracle識別名字(名字指向路徑),第二個為路徑,需要自己在本地建立
//也就是oracle通過jackson這個名字來識別 'F:\jackson'這個路徑
create or replace directory jackson as 'F:\jackson';
5、建立上面的路徑資料夾
6、
//給使用者授予目錄讀寫許可權,jackson為剛才的虛擬路徑名字
grant read,write on directory jackson to dzlnurse;
7、
//以dzlnurse使用者登陸
SQL> conn dzlnurse/1
8、
//建立網路資料庫連結,dzlLink為link名字,隨意起,dzlnurse為遠端資料庫名字,"1"為遠端資料庫密碼, //'10.0.0.7:1521/ORCL';為遠端埠號 create public database link locallink connect to dzlnurse identified by "1" using '10.0.0.7:1521/ORCL';
9、
//查詢建立的網路連結
select * from [email protected];
//顯示結果為GLOBAL_NAME
10、exit;退出資料庫到cmd下
11、
//dzlnurse/1為本地資料庫名和密碼
//directory=jackson為建立的虛擬路徑的名字(oracle不會自己建立,需要自己在本地建立這個目錄)
//dumpfile=dzlnurse.dmp 為匯出資料庫檔名字
//logfile=dzlnurse.log為匯出資料庫日誌名字
//network_link=locallink 為建立的網路連線名字
C:\Users\Administrator>expdp dzlnurse/1 directory=jackson dumpfile=dzlnurse.dmp logfile=dzlnurse.log network_link=locallink