时间:2021-07-01 10:21:17 帮助过:24人阅读
REMAP_SCHEMA 将一个方案中的对象加载到另一个方案。
REMAP_TABLE 表名重新映射到另一个表,例如 REMAP_TABLE=EMP.EMPNO:REMAPPKG.EMPNO。
REMAP_TABLESPACE 将表空间对象重新映射到另一个表空间。
REUSE_DATAFILES 如果表空间已存在, 则将其初始化 (N)。
REMAP_SCHEMA参数
众所周知:IMP工具的FROMUSER和TOUSER参数可以实现将一个用户的的数据迁移到另外一个用户。
impdp数据泵使用REMAP_SCHEMA参数来实现不同用户之间的数据迁移;
语法:
REMAP_SCHEMA=source_schema:target_schema
impdp orcldev/oracle DIRECTORY=backup_path DUMPFILE=oracldev.dmp REMAP_SCHEMA=orcldev:orcltwo
与REMAP_SCHEMA类似的参数选项,如REMAP_TABLESPACE将源表空间的所有对象导入目标表空间。
REMAP_TABLE参数
将源表数据映射到不同的目标表中
impdp orcldev/oracle DIRECTORY=backup_path dumpfile=oracldev.dmp remap_table=TAB_TEST:TEST_TB
数据导入到TEST_TB表中,但是该表的索引等信息并没有相应的创建,需要手工初始化。
REMAP_DATAFILE参数
语法:REMAP_DATAFILE=source_datafile:target_datafile
Oracle_Online:
Remapping datafiles is useful when you move databases between platforms that have different file naming conventions. The source_datafile and target_datafile names should be exactly as you want them to appear in the SQL statements where they are referenced. Oracle recommends that you enclose datafile names in quotation marks to eliminate ambiguity on platforms for which a colon is a valid file specification character.
4. 查找丢失数据,导入正式库表T_GL_BALANCE中
SQL> alter table tmp_t_gl_balance_inibak drop column FYEARPERIOD; --删除自动生成的唯一字段
SQL> insert into t_gl_balance select * from tmp_t_gl_balance_inibak where faccountbookid=151508; --插入查询结果时少字段
SQL> alter table tmp_t_gl_balance_inibak add FYEARPERIOD NUMBER; --将删除字段加回来
SQL> insert into t_gl_balance select * from tmp_t_gl_balance_inibak where faccountbookid=151508; --插入查询结果时报错
ORA-11523: Message 11523 not found; product=RDBMS; facility=ORA google没有找到对应报错
直接在数据库服务器上操作:
sqlplus user/passwd@scan-ip/实例名
SQL> insert into t_gl_balance select * from tmp_t_gl_balance_inibak where faccountbookid=151508;
ORA-54013: INSERT operation disallowed on virtual columns 报错已经很明显了,通过指定列名来进行插入
SQL> insert into t_gl_balance(FACCOUNTBOOKID,FYEAR,FPERIOD,FACCOUNTID,FDETAILID,FCURRENCYID,FBEGINBALANCEFOR,FBEGINBALANCE,FDEBITFOR,FDEBIT,FCREDITFOR,FCREDIT,FYTDDEBITFOR,FYTDDEBIT,FYTDCREDITFOR,FYTDCREDIT,FENDBALANCEFOR,FENDBALANCE,FADJUSTPERIOD) select FACCOUNTBOOKID,FYEAR,FPERIOD,FACCOUNTID,FDETAILID,FCURRENCYID,FBEGINBALANCEFOR,FBEGINBALANCE,FDEBITFOR,FDEBIT,FCREDITFOR,FCREDIT,FYTDDEBITFOR,FYTDDEBIT,FYTDCREDITFOR,FYTDCREDIT,FENDBALANCEFOR,FENDBALANCE,FADJUSTPERIOD from tmp_t_gl_balance_inibak where faccountbookid=151508;
插入成功,将其他丢失数据批量恢复
5. 问题原因及问题出现的操作和时间节点
原因:业务系统BUG,反过账操作会将前一期数据清除
SQL>select to_char(FDATETIME,‘YYYY-MM-DD HH24:mi:ss‘),FDESCRIPTION,FCLIENTIP from t_bas_operatelog where fdescription like ‘%过账%‘ and to_char(FDATETIME,‘YYYY-MM-DD‘) in (‘2019-10-25‘,‘2019-10-26‘);
SQL>select to_char(FDATETIME,‘YYYY-MM-DD HH24:mi:ss‘),FDESCRIPTION,FCLIENTIP from t_bas_operatelogbk where fdescription like ‘%过账%‘ and to_char(FDATETIME,‘YYYY-MM-DD‘) in (‘2019-10-25‘,‘2019-10-26‘);
通过日志追溯到了时间及具体操作等,接下来就是让业务系统厂家打补丁了。
Oracle RAC业务bug导致部分数据丢失处理
标签:sch 通过 定义数据 taf 成功 mic close 加载 path