星空网 > 软件开发 > 数据库

数据库迁移记录(数据泵方式)

1.平台:windows迁移至linux(需要停止业务)

2.源库:
 导出用户下的对象(源库有两个业务schema)

expdp system/xxxx@sid schemas=xxxx dumpfile=xxxx_pic.dmp content=metadata_only logfile=exp.log (此模式仅导出空表和其他对象,因为表过大且表不是很重要,所以采用后续同步的方式)。expdp system/xxxx@sid schemas=xxxx dumpfile=xxxx_tb.dmp logfile=exp.log

3.新库:
   新建表空间:

CREATE TABLESPACE xxxx DATAFILE '/u01/app/oracle/oradata/xxx/datafile/xxx01.DBF' SIZE 20480M,'/u01/app/oracle/oradata/xxx/datafile/xxx02.DBF' SIZE 20480M,'/u01/app/oracle/oradata/xxx/datafile/xxx03.DBF' SIZE 20480MAUTOEXTEND ON NEXT 200M MAXSIZE UNLIMITED ;

4.新建用户并赋予权限(user1:xxx,user2:xxx_PIC)

-- Create the user create user xxx_PIC identified by xxxx default tablespace TSP_WEBAGENTtemporary tablespace TEMP  profile DEFAULT;  -- Grant/Revoke role privileges grant connect to xxx_PIC;  grant resource to Wxxx_PIC;grant create synonym to xxx_PIC;grant create view to xxx_PIC;grant unlimited tablespace to xxx_PIC;

5.导入数据库

impdp system/xxx@sid dumpfile=xxx_tb.DMP logfile=imp.log
impdp system/xxx@sid dumpfile=xxx_pic.DMP logfile=imp_pic.log

6.验证对象数量

SELECT owner, object_type, COUNT(*) count# FROM all_objects where owner='XXX'GROUP BY owner, object_type, statusorder by 2;

SELECT owner, object_type, COUNT(*) count# FROM all_objects where owner='XXX_OIC'GROUP BY owner, object_type, statusorder by 2;

5.验证表的行数(使用业务账户登录)

select 'analyze table '|| table_name||' compute statistics;' from user_tables;(执行结果语句)select table_name,num_rows from dba_tables where owner='XXX' order by 1;(XXX是业务账户)

6.更新那张特殊表(通过与源库建立DBLINK)(按照时间[月份]分批同步)

   a.先查看行数

select count(*) from XXX_check@piclink where statedate < to_date('2015-12-09 00:00:00','yyyy-MM-dd HH24:mi:ss')and statedate >= to_date('2015-11-01 00:00:00','yyyy-MM-dd HH24:mi:ss');

  b.输入数据

insert into shop_check 
select * from XXX_check@piclink

where statedate < to_date('2015-12-09 00:00:00','yyyy-MM-dd HH24:mi:ss')
and statedate >= to_date('2015-11-01 00:00:00','yyyy-MM-dd HH24:mi:ss');

 c.如果步骤a和步骤b提示的行数一致,则说明没有问题

commit;

   d.重复以上步骤,知道所有数据同步

 




原标题:数据库迁移记录(数据泵方式)

关键词:数据库

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

shopline海外仓代发知识分享之:shopline建站方案有什么:https://www.goluckyvip.com/news/8723.html
TikTok Shop英国站宠物类产品将推出 :https://www.goluckyvip.com/news/8724.html
欧洲专线助力卖家旺季高效发货,快至5-7天妥投:https://www.goluckyvip.com/news/8725.html
盲盒出口增速超400% ,在TikTok上卖能行吗?:https://www.goluckyvip.com/news/8726.html
敦煌网力邀网红助阵,推出世界杯物流专线带中国商家玩转世界杯:https://www.goluckyvip.com/news/8727.html
Lazada跟shopee本土店铺的运营思路 :https://www.goluckyvip.com/news/8728.html
instagram竞品“TikTok Notes”在加拿大和澳大利亚上线:https://www.kjdsnews.com/a/1842224.html
instagram竞品“TikTok Notes”在加拿大和澳大利亚上线:https://www.goluckyvip.com/news/220211.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流