在系统上线升级中,经过会有生产环境与测试环境的数据迁移操作;通过oracle自动的命令迁移效率会比较高;
ORACLE导出导入工具:
exp----逻辑导出工具
imp----逻辑导入工具
实际上线时间操作案例:
准备导数据
【注意】防止空表无法导出:---缺少此步骤可能会出现部分原库的空表在迁移过程中确实;
先执行,然后对查询结果进行执行
select 'alter table '||table_name||' allocate extent(size 64K);' from tabs t where not exists
(select segment_name from user_segments s where s.segment_name= t.table_name);
--select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows = 0;
--select * from user_tables where num_rows = 0 or num_rows is null;
4.1.2. 系统导出旧库数据
exp smartyd/*****@orcl file=smartyd.dmp owner=smartyd
[注:***** 为隐藏了密码]
命令解析 file指定数据备份文件的保存文件名。
tables指定要备份的表结构,可以导出多个表,通过(table1,table2...,tablen)进行选择。
owner 指定要导出的用户的用户名,但是前提条件是登录的用户得具有访问其它用户对象的权限。一般是使用DBA用户进行登录。可以支持多用户导出,使用逗号“,”进行隔开。
4.1.3. 系统导入新库数据
imp znck/******@orcl file=smartyd.dmp fromuser=smartyd touser=znck
[注:***** 为隐藏了密码]
命令解析 file指定数据导入文件的来源文件名。
FROMUSER 所有人用户名列表
TOUSER 用户名列表
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
其他常用参数供参考学习:
end.