作者:手机用户2502901265_642 | 来源:互联网 | 2014-07-08 01:11
将DMP导入到不同的表空间中1,用imp导出数据cmd进入orcle安装目录bin下,输入以下命令:www.2cto.comexpusername/password@ORACLEEPPfilec:\hysjb.dmpownermagazine_hyrowsy2,用imp产生...
将DMP导入到不同的表空间中
1,用imp导出数据 cmd进入orcle安装目录bin下,输入以下命令:
www.2cto.com
exp username/password@ORACLEEPP file=c:\hysjb.dmp owner=magazine_hy rows=y
2, 用imp产生index.sql文件
imp
/@XE file= indexfile=index.sql full=y
3,修改index.sql文件
FIND: 'REM' REPLACE:
FIND: '""' REPLACE: '"USERS"'
FIND: '...' REPLACE: 'REM ...'
FIND: 'CONNECT' REPLACE: 'REM CONNECT'
ps:查看表空间的语句:
select
df.tablespace_name "TABLESPACE_NAME",totalspace "TOTALSPACE/M",freespace "FREESPACE/M",round((1-freespace/totalspace)*100,2) "USED%"
from
(select tablespace_name,round(sum(bytes)/1024/1024) totalspace from dba_data_files group by tablespace_name) df,
(select tablespace_name,round(sum(bytes)/1024/1024) freespace from dba_free_space group by tablespace_name) fs
where df.tablespace_name=fs.tablespace_name;
4,使用sqlplus进入执行此sql生成表结构
select 'ALTER TABLE '||table_name|| ' disable constraint '||constraint_name|| '; ' from user_constraints
where constraint_type = 'R';
导出csv文件为imp.sql,删除"号,执行。
6,导入数据,cmd下执行:
imp
/@XE file= fromuser= touser= ignore=y
7,将imp.sql中的disable替换成enable执行。enable依赖