数据库迁移之impdp_dblink测试, 12c迁移到11gr2

平时都在忙项目,今天周末可以搞下有兴趣的测试( 以免技术回潮偷笑

技术本身不值钱,都得依赖项目,这个哲学多年的争论,进入公司之前,得关注公司文化。

言归正传:

我们平常的迁移都是网络不通的,所以没有办法实施Impdp dblink,都是expdp和impdp配合使用。那么今天对于网络通,但是数据量特别大,快速迁移就要用dblink,少了一个expdp和trans的过程。

来我们直接看环境:

--环境1

[oracle@webOracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on 星期六 7月 9 13:22:29 2016

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


连接到: 
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> 

--环境2

[oracle@SLAVE01 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期六 7月 9 12:53:53 2016

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


连接到: 
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> 


--在11.2.0.3下创建db_link

SQL> 
SQL> create public database link db_from104
  connect to unico*** identified by ***
  using '10.10.10.10:1521/unicom';  2    3  

数据库链接已创建。

SQL> 


--在12c下确定要迁移用户的 默认表空间

SQL> col username format a20
SQL> select USERNAME,DEFAULT_TABLESPACE from dba_users where USERNAME like 'U1%';

USERNAME	     DEFAULT_TABLESPACE
-------------------- ------------------------------
U1	     TBDATA_DEFAULT

SQL> 

--在11g建立与12c一样的表空间,和用户

create user u1 identified by 密码 default tablespace TBDATA_DEFAULT;
grant unlimited tablespace to u1;
grant connect,resource to u1;
grant alter database to u1;
grant CREATE MATERIALIZED VIEW to u1;
grant select on dba_data_files to u1;


GRANT SELECT ON sys.obj$ TO u1;
GRANT SELECT ON sys.tabpartv$ TO u1;
grant all on DBMS_NETWORK_ACL_ADMIN to u1;
grant all on DBA_NETWORK_ACLS to u1;
grant all on DBA_NETWORK_ACL_PRIVILEGES to u1;
GRANT ALL ON v_$asm_diskgroup TO u1;
GRANT ALL ON dba_data_files TO u1;
grant alter system to u1;
grant create view to u1;
grant create materialized view to u1;
grant select on v_$session to u1;
grant create any synonym to u1;


--在11g目标服务器执行导入命令

[oracle@SLAVE01 ~]$ impdp u1/**** network_link=db_from104 schemas=unicomidmp cluster=N PARALLEL=2 
ORA-39002: 操作无效
ORA-39070: 无法打开日志文件。
ORA-39145: 必须指定目录对象参数且不能为空
注意: 这里报错了,必须制定directory参数,因为导入日志得有地方写啊。


看截图:




--默认日志就在目录下 import.log

[root@SLAVE01 dumpfiles]# ls -l
total 2682036
-rwxrwxrwx 1 oracle oinstall         38 Jun 13 10:38 cre_indexes.sql
-rwxrwxrwx 1 oracle oinstall         38 Jun 13 10:38 cre_parttab.sql
-rwxrwxrwx 1 oracle oinstall        356 Jun 13 10:28 cre_priviege.sql
-rwxrwxrwx 1 oracle oinstall        469 Jun 13 10:28 cre_tabspace.sql
-rwxrwxrwx 1 oracle oinstall 2746359808 Jun 13 10:38 expdp_06131028.dmp
-rwxrwxrwx 1 oracle oinstall       5161 Jun 13 10:38 expdp_06131028.log
-rwxrwxrwx 1 oracle oinstall        312 Jun 13 10:28 expdp_profile.par
-rw-r----- 1 oracle oinstall       4596 Jul  7 16:26 impdp_expdp_06131028.log
-rwxrwxrwx 1 oracle oinstall       2702 Jun 13 10:38 import_inner.sh
-rw-r----- 1 oracle oinstall          0 Jul  9 13:48 import.log
[root@SLAVE01 dumpfiles]# more import.log 
;;; 
Import: Release 11.2.0.3.0 - Production on 星期六 7月 9 13:48:55 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
;;; 
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "UNICOMIDMP"."SYS_IMPORT_SCHEMA_01":  unicomidmp/******** network_link=db_from104 schemas=unicomidmp cluster=N PARALLEL=2 directory=ORAUSERDUMP 
正在使用 BLOCKS 方法进行估计...
处理对象类型 SCHEMA_EXPORT/TABLE/TABLE_DATA

--耐心等待结束。


--mengl 2016.7.9 北京


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值