我的目标库为12c,源库是11.2.0.4,需要迁移用户EPTEST下的对象到目标库
--确认schema的大小
--只有默认表空间存储了数据,只需要确认目标库有表空间且空间够用即可
SQL> select TABLESPACE_NAME,sum(bytes/1024/1024/1024) gb from dba_segments where owner='EPTEST' group by TABLESPACE_NAME;
TABLESPACE_NAME GB
------------------------------ ----------
EPMSDEV 14.7992554
--目标库表空间存在,剩余空间大于15g
--查看目标库的directory
col owner for a10
col DIRECTORY_NAME for a30
col DIRECTORY_PATH for a60
select * from dba_directories;
--dir存在且可用
--查看目标库dblink
--创建tns
[oracle@xsdbd31 ~]$ cd $ORACLE_HOME/network/admin
[oracle@xsdbd31 admin]$ vi tnsnames.ora
epms =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 111.111.111.111)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = epms)
)
)
tnsping测试连通性,需要开通1521端口
--创建dblink
SQL> create public database link LK_EPMS connect to system identified by "password" using 'epms';
Database link created.
--查看dblink
col OWNER for a15
col DB_LINK for a20
col username for a12
col host for a50
select* from dba_db_links
--测试dblink可用性
--导入命令
nohup impdp system/password@epmsdp directory=DUMPDIR logfile=IMP_EPTEST_20180503.log network_link='lk_epms' schemas=EPTEST table_exists_action=replace parallel=3 cluster=N &
或者不适用nohup也行
impdp system/password@epmsdp directory=DUMPDIR logfile=IMP_EPTEST_20180503.log network_link='lk_epms' schemas=EPTEST table_exists_action=replace parallel=3 cluster=N
--导入过程和查看导入情况
[oracle@ybnode01 dumpdir]$ nohup impdp system/password@epmsdp directory=DUMPDIR logfile=IMP_EPTEST_20180503.log network_link='lk_epms' schemas=EPTEST table_exists_action=replace parallel=3 cluster=N &
[1] 35393
[oracle@ybnode01 dumpdir]$ nohup: ignoring input and appending output to ‘nohup.out’
[oracle@ybnode01 dumpdir]$ tail -f nohup.out
Import: Release 12.1.0.2.0 - Production on Thu May 3 23:16:17 2018
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_07": system/********@epmsdp directory=DUMPDIR logfile=IMP_EPTEST_20180503.log network_link=lk_epms schemas=EPTEST table_exists_action=replace parallel=3 cluster=N
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 12.84 GB
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"EPTEST" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
ORA-31684: Object type TYPE:"EPTEST"."ZH_CONCAT_IM" already exists
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
ORA-31684: Object type SEQUENCE:"EPTEST"."AUDITCOMMISSION" already exists
。。。
ORA-39082: Object type PROCEDURE:"EPMS_YN2015"."PR_PRO_GENERAL" created with compilation warnings
ORA-39082: Object type VIEW:"EPMS_YN2015"."B_BAO_AUDIT_BASICS_REPORT" created with compilation warnings
Job "SYSTEM"."SYS_IMPORT_SCHEMA_07" completed with 83 error(s) at Fri May 4 00:12:55 2018 elapsed 0 00:56:31