Oracle完整数据库实例迁移


需求分析:
将源库所有表结构、表数据及表间约束关系整体迁移到目标实例;
删除目标数据库的所有表和用户,重建目标数据库的用户:
drop user user_name cascade;
create user user_name identified by password default tablespace tablespace_name;
grant  connect,dba to user_name;
 
源库操作:
源库指定用户下导出所有表:
Exp username/pwd@link_name file=dmpfilename owner=user_name rows=y log=fullpath_logfilename
 
目标库操作:
导入数据不要约束和索引:
imp username/pwd@link_name file=dmpfilename rows=y ignore=y feedback=10000 constraints=n indexes=n log=fullpath_logfile.log full=y
导入约束和索引不导数据
imp username/pwd@link_name file=dmpfilename rows=n ignore=y constraints=y indexes=y log=fullpath_logfile.log full=y
 
验证迁移结果
在源、目标库分别运行下面脚本
Select count(*) from user_tables;

相关内容