Heim  >  Artikel  >  Datenbank  >  如何重建Oracle DataGuard

如何重建Oracle DataGuard

WBOY
WBOYOriginal
2016-06-07 17:33:54868Durchsuche

无暇每日检查Oracle数据库的同布情况,后来才发现主库压根没有同步归档日志到备库,因为备库断电后一直没有开,但问题是主库在10

无暇每日检查Oracle数据库的同布情况,后来才发现主库压根没有同步归档日志到备库,因为备库断电后一直没有开,但问题是主库在10几天前删除过归档日志,惨!为了想节省时间,想去备份捞捞看,结果是备份也没有需要的归档日志。无耐,只好重建。

1、登录主库备份控制文件到数据文件所在的目录。
1.1先查询数据文件所在的目录:select name from v$datafile
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/ora/oracle/oradata/tsing/system01.dbf
/ora/oracle/oradata/tsing/undotbs01.dbf
/ora/oracle/oradata/tsing/sysaux01.dbf
/ora/oracle/oradata/tsing/users01.dbf
/ora/oracle/oradata/tsing/mast.dbf
/ora/oracle/oradata/tsing/mas.dbf
6 rows selected.

1.2 备份控制文件到数据文件所在的目录
SQL> alter database create standby controlfile as '/ora/oracle/oradata/tsing/node1.ctl';
Database altered.


2、登录备库删除数据文件
2.1关闭备库实例
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

2.2进入数据文件所在的目录,然后删除
cd /ora/oracle/oradata/tsing/
[oracle@TAIXIN-HR1 tsing]$ ls
control01.ctl  mast.dbf    redo03.log    stdREDO04.LOG  undotbs01.dbf
control02.ctl  orapwtsing  stdREDO01.LOG  sysaux01.dbf  users01.dbf
control03.ctl  redo01.log  stdREDO02.LOG  system01.dbf
mas.dbf        redo02.log  stdREDO03.LOG  temp01.dbf
[oracle@TAIXIN-HR1 tsing]$ rm -f *

3、从主库用SCP命令将数据文件及控制文件传到备库
scp -r /ora/oracle/oradata/tsing/* oracle@TAIXIN-HR1:/ora/oracle/oradata/tsing/
oracle@taixin-hr1's password:
control01.ctl                                100% 7088KB  6.9MB/s  00:00
control02.ctl                                100% 7088KB  6.9MB/s  00:00
control03.ctl                                100% 7088KB  6.9MB/s  00:01
inittsing.ora                                100% 1407    1.4KB/s  00:00
mas.dbf                                      100%  16GB  25.5MB/s  10:30
mast.dbf                                      100%  136MB  22.7MB/s  00:06
node1.ctl                                    100% 7088KB  6.9MB/s  00:00
orapwtsing                                    100% 1536    1.5KB/s  00:00
redo01.log                                    100%  50MB  25.0MB/s  00:02
redo02.log                                    100%  50MB  25.0MB/s  00:02
redo03.log                                    100%  50MB  25.0MB/s  00:02
sqlnet.log                                    100%  668    0.7KB/s  00:00
stdREDO01.LOG                                100%  50MB  16.7MB/s  00:03
stdREDO02.LOG                                100%  50MB  50.0MB/s  00:01
stdREDO03.LOG                                100%  50MB  50.0MB/s  00:01
stdREDO04.LOG                                100%  50MB  25.0MB/s  00:02
sysaux01.dbf                                  100%  490MB  18.9MB/s  00:26
system01.dbf                                  100%  520MB  21.7MB/s  00:24
temp01.dbf                                    100%  20MB  20.0MB/s  00:01
tsing1.ctl                                    100% 6928KB  6.8MB/s  00:01
undotbs01.dbf                                100%  115MB  23.0MB/s  00:05
users01.dbf                                  100% 5128KB  5.0MB/s  00:00
[oracle@TAIXIN-HR tsing]$

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn