数据泵导出远程服务器数据库到本地

 

--oracle创建本地用户 whnurse 密码 1
-- Create the user
create user whnurse
  identified by "1"
  default tablespace USERS
  temporary tablespace TEMP
  profile DEFAULT;
-- Grant/Revoke role privileges
grant connect to whnurse;
grant dba to whnurse;
grant resource to whnurse;
-- Grant/Revoke system privileges
grant create procedure to whnurse with admin option;
grant create table to whnurse with admin option;
grant create tablespace to whnurse with admin option;
grant create user to whnurse;
grant create view to whnurse with admin option;
grant debug connect session to whnurse with admin option;
grant unlimited tablespace to whnurse with admin option;

 赋予用户权限

grant connect,resource to whnurse;
grant create table,create database link to whnurse;
--dump_dir为oracle识别名字(名字指向路径),'E:\emp'需要自己在本地创建
--也就是oracle通过dump_dir这个名字来识别 'E:\emp'这个路径
create or replace directory dump_dir as 'E:\emp';
select * from dba_directories;
--给用户授予目录读写权限,dump_dir为刚才的虚拟路径名字
grant read,write on directory dump_dir to whnurse;

以whnurse用户登陆  whnurse/1

--创建网络数据库链接,whnurseLink为link名字,随意起,whnurse为远程数据库名字,"1"为远程数据库密码,
--'10.0.0.7:1521/ORCL';为远程端口号
create public database link whnurseLink connect to whnurse identified by "1" using '10.0.0.7:1521/ORCL';

--查询创建的网络链接
select * from global_name@whnurseLink;
--显示结果为GLOBAL_NAME

cmd下导出

--whnurse/1 远程数据库账号密码
--dump_dir 文件导出的虚拟路径 导出后存放在 E:\emp中
--whnurse.dmp 导出文件名称
--whnurseLink 远程连接
expdp whnurse/1@orcl directory=dump_dir dumpfile=whnurse.dmp logfile=whnurse.log network_link=whnurseLink


 

你可能感兴趣的:(oracle)