Oracle+Ogg归档丢失重新导数据建立ogg同步步骤
1031 ogg 恢复操作
1、在目标端停掉复制进程,删除目标端OGG的复制进程
ggsci> dblogin userid ggtarget,password ggtarget
ggsci> stop repesse
ggsci> delete replicat repesse
2、在源端停掉传输和抽取进程,删除源端OGG的传输进程,抽取进程
ggsci> dblogin userid ggsrc, password ggsrc
ggsci> stop dpesse
ggsci> stop extesse
ggsci> DELETE EXTTRAIL /home/ogg/dirdat/es
ggsci> DELETE rmttrail /home/ogg/dirdat/es
ggsci> delete EXTRACT extesse
ggsci> delete EXTRACT dpesse
3、清除源端和目标端的TRAILS 文件
登陆源端服务器:
cd /home/ogg/dirdat/
rm -rf *
登陆目标服务器:
cd /home/ogg/dirdat/
rm -rf *
4、备份参数文件
登陆源端服务器:
cd /ogg/dirprm
mv extesse.prm extesse.prm.old
mv dpesse.prm dpesse.prm.old
登陆目标服务器:
cd /ogg/dirprm
mv repesse.prm repesse.prm.old
5、源端配置extract进程
ggsci> add extract extesse, tranlog, begin now, threads 2
ggsci> edit params extesse
extract extesse
setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
USERID ggsrc, PASSWORD ggsrc
reportcount every 120 minutes, rate
report at 01:00
reportrollover at 01:15
EXTTRAIL /home/ogg/dirdat/es
TRANLOGOPTIONS ALTARCHIVELOGDEST PRIMARY INSTANCE essedb2 /home/arch3, ALTARCHIVELOGDEST INSTANCE essedb1 /home/arch2
TRANLOGOPTIONS ASMUSER SYS@ESSEDBASM,ASMPASSWORD ORACLE
threadoptions maxcommitpropagationdelay 30000
discardfile ./dirrpt/extesse01.dsc, append megabytes 100
discardrollover at 01:15
warnlongtrans 4h, checkinterval 5m
dynamicresolution
table shema.tablename;
------------------------------------------------------
ggsci> add exttrail /home/ogg/dirdat/es, extract extesse, megabytes 50
ggsci> start extesse
6、源端配置datapump进程
ggsci> add extract dpesse, exttrailsource /home/ogg/dirdat/es
ggsci> edit params dpesse
extract dpesse
setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
USERID ggsrc, PASSWORD ggsrc
rmthost 10.154.2.80, mgrport 7809
rmttrail /home/ogg/dirdat/es
passthru
discardfile ./dirout/dpesse01.dsc, append megabytes 100
discardrollover at 00:00 on sunday
reportcount every 30 minutes, rate
report at 01:00
reportrollover at 01:15
Dynamicresolution
table shema.tablename;
ggsci> add rmttrail /home/ogg/dirdat/es, extract dpesse, megabytes 50
ggsci> start dpesse
7、目标端配置replicat进程,但不启动
ggsci> add replicat repesse exttrail /home/ogg/dirdat/es
ggsci> edit params repesse
replicat repesse
SETENV (NLS_LANG ="AMERICAN_AMERICA.ZHS16GBK")
userid ggtarget, password ggtarget
assumetargetdefs
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
reperror default, abend
discardfile ./dirout/repesse01.dsc, append, megabytes 100
DiscardRollover at 02:00 ON SUNDAY
dynamicresolution
MAP shema.tablename ,target shema.tablename;
8、初始化数据
SQL> select dbms_flashback.get_system_change_number from dual;
16423942351
cd /home/backup/expdpdir
export NLS_LANG=american_america.ZHS16GBK
使用expdp 导出
创建 dumpfile
create directory expdpdir as '/home/backup/expdpdir/';
在94上 新建目录 /home/backup/expdpdir/
创建导出文件 expdp1031.par:
DIRECTORY=expdpdir
DUMPFILE=esse1031_%U.dmp
LOGFILE=esse1031.log
tables=tablenames...
ACCESS_METHOD=DIRECT_PATH
filesize=10000M
parallel=4
flashback_scn=16423942351
nohup /usr/bin/time -p expdp dbuser/dbuserpasswd@orcl parfile=expdp1031.par >/home/backup/expdpdir/expdp1031.log &
10、 备库导入
创建 dumpfile
create directory expdpdir as '/home/backup/expdpdir/';
在94上 新建目录 /home/backup/expdpdir/
创建导出文件 impdp1031.par:
DIRECTORY=expdpdir
DUMPFILE=esse1031.dmp
LOGFILE=esse1031.log
remap_tablespace=TS_KCS_FLOW:EAPP_DATA1,IDX_KCS_FLOW:EAPP_IDX1
TABLE_EXISTS_ACTION=SKIP
parallel=10
nohup /usr/bin/time -p impdp dbuser/dbuserpasswd@bkorcl parfile=impdp1031.par >/home/backup/expdpdir/imp0801.log &
当出现 ORA-01659: unable to allocate MINEXTENTS beyond 4 in tablespace
重新resize数据文件的大小即可 大小不用改变
alter database datafile '/home/oracle/oradata/bmzbbdb/EAPP_IDX1.dbf' resize 20480m;
11、启动复制进程
start repesse, aftercsn 16423942351
本文名称:Oracle+Ogg归档丢失重新导数据建立ogg同步步骤
分享地址:http://pwwzsj.com/article/pohohh.html
1、在目标端停掉复制进程,删除目标端OGG的复制进程
ggsci> dblogin userid ggtarget,password ggtarget
ggsci> stop repesse
ggsci> delete replicat repesse
2、在源端停掉传输和抽取进程,删除源端OGG的传输进程,抽取进程
ggsci> dblogin userid ggsrc, password ggsrc
ggsci> stop dpesse
ggsci> stop extesse
ggsci> DELETE EXTTRAIL /home/ogg/dirdat/es
ggsci> DELETE rmttrail /home/ogg/dirdat/es
ggsci> delete EXTRACT extesse
ggsci> delete EXTRACT dpesse
3、清除源端和目标端的TRAILS 文件
登陆源端服务器:
cd /home/ogg/dirdat/
rm -rf *
登陆目标服务器:
cd /home/ogg/dirdat/
rm -rf *
4、备份参数文件
登陆源端服务器:
cd /ogg/dirprm
mv extesse.prm extesse.prm.old
mv dpesse.prm dpesse.prm.old
登陆目标服务器:
cd /ogg/dirprm
mv repesse.prm repesse.prm.old
5、源端配置extract进程
ggsci> add extract extesse, tranlog, begin now, threads 2
ggsci> edit params extesse
extract extesse
setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
USERID ggsrc, PASSWORD ggsrc
reportcount every 120 minutes, rate
report at 01:00
reportrollover at 01:15
EXTTRAIL /home/ogg/dirdat/es
TRANLOGOPTIONS ALTARCHIVELOGDEST PRIMARY INSTANCE essedb2 /home/arch3, ALTARCHIVELOGDEST INSTANCE essedb1 /home/arch2
TRANLOGOPTIONS ASMUSER SYS@ESSEDBASM,ASMPASSWORD ORACLE
threadoptions maxcommitpropagationdelay 30000
discardfile ./dirrpt/extesse01.dsc, append megabytes 100
discardrollover at 01:15
warnlongtrans 4h, checkinterval 5m
dynamicresolution
table shema.tablename;
------------------------------------------------------
ggsci> add exttrail /home/ogg/dirdat/es, extract extesse, megabytes 50
ggsci> start extesse
6、源端配置datapump进程
ggsci> add extract dpesse, exttrailsource /home/ogg/dirdat/es
ggsci> edit params dpesse
extract dpesse
setenv ( NLS_LANG = AMERICAN_AMERICA.ZHS16GBK )
USERID ggsrc, PASSWORD ggsrc
rmthost 10.154.2.80, mgrport 7809
rmttrail /home/ogg/dirdat/es
passthru
discardfile ./dirout/dpesse01.dsc, append megabytes 100
discardrollover at 00:00 on sunday
reportcount every 30 minutes, rate
report at 01:00
reportrollover at 01:15
Dynamicresolution
table shema.tablename;
ggsci> add rmttrail /home/ogg/dirdat/es, extract dpesse, megabytes 50
ggsci> start dpesse
7、目标端配置replicat进程,但不启动
ggsci> add replicat repesse exttrail /home/ogg/dirdat/es
ggsci> edit params repesse
replicat repesse
SETENV (NLS_LANG ="AMERICAN_AMERICA.ZHS16GBK")
userid ggtarget, password ggtarget
assumetargetdefs
ReportCount Every 30 Minutes, Rate
Report at 01:00
ReportRollover at 01:15
reperror default, abend
discardfile ./dirout/repesse01.dsc, append, megabytes 100
DiscardRollover at 02:00 ON SUNDAY
dynamicresolution
MAP shema.tablename ,target shema.tablename;
8、初始化数据
SQL> select dbms_flashback.get_system_change_number from dual;
16423942351
cd /home/backup/expdpdir
export NLS_LANG=american_america.ZHS16GBK
使用expdp 导出
创建 dumpfile
create directory expdpdir as '/home/backup/expdpdir/';
在94上 新建目录 /home/backup/expdpdir/
创建导出文件 expdp1031.par:
DIRECTORY=expdpdir
DUMPFILE=esse1031_%U.dmp
LOGFILE=esse1031.log
tables=tablenames...
ACCESS_METHOD=DIRECT_PATH
filesize=10000M
parallel=4
flashback_scn=16423942351
nohup /usr/bin/time -p expdp dbuser/dbuserpasswd@orcl parfile=expdp1031.par >/home/backup/expdpdir/expdp1031.log &
10、 备库导入
创建 dumpfile
create directory expdpdir as '/home/backup/expdpdir/';
在94上 新建目录 /home/backup/expdpdir/
创建导出文件 impdp1031.par:
DIRECTORY=expdpdir
DUMPFILE=esse1031.dmp
LOGFILE=esse1031.log
remap_tablespace=TS_KCS_FLOW:EAPP_DATA1,IDX_KCS_FLOW:EAPP_IDX1
TABLE_EXISTS_ACTION=SKIP
parallel=10
nohup /usr/bin/time -p impdp dbuser/dbuserpasswd@bkorcl parfile=impdp1031.par >/home/backup/expdpdir/imp0801.log &
当出现 ORA-01659: unable to allocate MINEXTENTS beyond 4 in tablespace
重新resize数据文件的大小即可 大小不用改变
alter database datafile '/home/oracle/oradata/bmzbbdb/EAPP_IDX1.dbf' resize 20480m;
11、启动复制进程
start repesse, aftercsn 16423942351
本文名称:Oracle+Ogg归档丢失重新导数据建立ogg同步步骤
分享地址:http://pwwzsj.com/article/pohohh.html