1.停掉主从相应进程
主:
GGSCI (host01) 14> stop extract EORA_1
GGSCI (host01) 15> stop extract PORA_1
从:
GGSCI (host02) 11> stop replicat rora_1
3.删除从库库的表数据
Delete From BONUS t;
Delete From emp;
Delete From salgrade;
Delete From dept;
2.主库创建expdmp导出目录
create directory backdir as '/u01/app/backup'; ##/u01/app/backup必须提前创建好
grant read,write on directory backdir to system; 必须要sys账号才能赋予权限
4.查看主库的scn
select dbms_flashback.get_system_change_number from dual;
----
1209181
5.导出,指定scn
这里的logfile不能采用全路径
expdp system/oracle directory=backdir dumpfile=scottdp.dmp logfile=scottdp.log tables=scott.DEPT,scott.EMP,scott.BONUS,scott.SALGRADE flashback_scn=1209181
6.在从库也创建相应的目录
[oracle@host02 app]$ mkdir -p /u01/app/backup
数据库也要创建目录并赋予权限
create directory backdir as '/u01/app/backup';
grant read,write on directory backdir to system;
7.将主库导出的文件scp到从库
[oracle@host01 backup]$ scp scottdp.dmp oracle@192.168.56.102:/u01/app/backup/
8.导入数据(对象存在直接跳过)
impdp system/oracle directory=backdir dumpfile=scottdp.dmp logfile=scottdp.log tables=scott.DEPT,scott.EMP,scott.BONUS,scott.SALGRADE table_exists_action=REPLACE
9.启动主从相关进程
主:
GGSCI (host01) 17> start extract EORA_1
GGSCI (host01) 18> start extract PORA_1
从(从备份时刻的scn开始启动):
GGSCI (host02) 15>start replicat RORA_1,aftercsn 1209181
发现报错:
2018-05-11 00:17:36 WARNING OGG-00869 OCI Error ORA-01031: insufficient privileges (status = 1031), SQL .
从库重新授权给到ogg
SQL> grant INSERT, UPDATE, DELETE on scott.BONUS to ogg;
SQL> grant INSERT, UPDATE, DELETE on scott.SALGRADE to ogg;
-- The End --
阅读(3769) | 评论(0) | 转发(0) |