oracle Dataguard备库重建
1、添加oracle目录
mkdir /ora_data_1
mkdir /ora_data_2
mkdir /ora_data_3
2、修改目录权限
chown oracle:dba /ora_data_1
chown oracle:dba /ora_data_2
chown oracle:dba /ora_data_3
3、在创建的目录下添加数据文件
alter tablespace users add datafile '/ora_data_1/users02.dbf' size 1M autoextend off;
alter tablespace test add datafile '/ora_data_2/test02.dbf' size 1M autoextend off;
alter tablespace test add datafile '/ora_data_3/test03.dbf' size 1M autoextend off;
4、主库备份生成备库控制文件
backup current controlfile for standby f
ORMat '/tmp/control.ctl';
5、主库对
数据库进行全备
backup database format '/tmp/full_backup_%T_%t.bak';
6、对备库参数文件进行修改,添加数据文件映射关系
*.db_file_name_convert='/opt/oracle/oradata/orcl','/opt/oracle/oradata/standby','/ora_data_1','/opt/oracle/oradata/standby','/ora_data_2','/opt/oracle/oradata/standby','/ora_data_3','/opt/oracle/oradata/standby'
7、在主库配置NFS,提供给备库恢复使用
vi /etc/exports
/tmp 192.168.56.*(rw)
service nfs restart
8、在备库挂载NFS目录,并查看是否正常挂载
mount -o rw,noac,hard,rsize=32768,wsize=32768,nolock 192.168.56.103:/tmp /dbbak
9、进入RMAN恢复控制文件
rman target /
startup nomount
restore controlfile from '/dbbak/control.ctl;
10、mount
数据库,并注册恢复目录
alter database mount;
catalog start with '/dbbak/full_backup_20170720_949796538.bak'
11、还原数据库
restore database;
12、打开数据库(如果主库之前没有standby logfile,还需要创建standby logfile)
alter database open
13、应用
日志
alter database recover managed standby database using current logfile disconnect;
14、主库建表插入数据,切换日志进行
测试。
0