Oracle使用问题/技巧记录

Oracle使用问题/技巧记录

【1】在导数据的过程中,通常会出现某个大表中的几行数据出现问题不能继续导下去,此时可以做如下的工作:

1、从源数据库导出该表的tmp表(自己建一张)

exp ias_OWNER/iasownerpswd file=D:\test.dmp tables=tmp_IAS_REPORT_CONFIG
注:

数据导出:
1 将数据库TEST完全导出,用户名system 密码manager 导出到D:\daochu.dmp中
   exp system/manager@TEST file=d:\daochu.dmp full=y
2 将数据库中system用户与sys用户的表导出
   exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)
3 将数据库中的表table1 、table2导出
   exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2) 
4 将数据库中的表table1中的字段filed1以"00"打头的数据导出
   exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"
  
     上面是常用的导出,对于压缩我不太在意,用winzip把dmp文件可以很好的压缩。
                     不过在上面命令后面 加上 compress=y  就可以了
数据的导入
1 将D:\daochu.dmp 中的数据导入 TEST数据库中。
   imp system/manager@TEST  file=d:\daochu.dmp
   上面可能有点问题,因为有的表已经存在,然后它就报错,对该表就不进行导入。
   在后面加上 ignore=y 就可以了。
2 将d:\daochu.dmp中的表table1 导入
imp system/manager@TEST  file=d:\daochu.dmp  tables=(table1) 
(

imp dbuser2/oracle file=user.dmp log=user.log tables=table1,table2 fromuser=dbuser touser=dbuser2 buffer=2048000 commit=y ignore=y feedback=10000 )


 

2、在目标数据库中建一张该表的tmp表(同样表结构),将导出的数据导入到tmp表中

imp ias_OWNER/iasownerpswd@241 file=D:\test.dmp log=D:\iaslog.log buffer=54000 full=y ignore=y commit=y feedback=23

从tmp表中导数据到目标服务器的同名表中

insert into ias_report_config select * from tmp_ias_report_config a;

 

4、删除tmp表中数据

delete from tmp_ias_report_config a; 

5、删除源服务器中该表的tmp中已经导入到目标服务器表中的数据

delete from tmp_ias_report_config a
 where exists (select 1
          from ias_report_config@to_241 b
         where a.reportid = b.reportid)

 

如此几次操作即可完整导入一张大表

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值