1,修改oracle为最大的保护模式
alter database set standby database to maxsize protection;
alter database open;
查看数据库是那种模式
select protection_mode from v$database;
2,在备机上
recover managed standby database disconnect from session;
3,测试dataguard
在主机上:
alter system switch logfile;
在备机上查看v$standby_log视图
select group#,sequenge#,used,archived,status from v$standby_log;
在MAXIMIZE PROTECTION 和 MAXMIZE AVAILABILITY模式下,备机不能先关机,否则会报错
database busy ,open,close mount and dismount not allowed
正确的关机命令是:
关机:先关主机,后关备机、
开机:先开备机,后关主机
主备库的switchover 的切换
switchover时只能先从primary切到standby,再从standby切换到primary
查看主库是否有standby redo log,
准备原主库和备库的参数文件,最好将两个数据库的参数文件互换,在两台机器上同时保留主备库的文件
cd /oracle/admin/orcl/pfile
rcp host160:/oracle/admin/orcl/pfile/init.ora initprimary.ora
rcp init.ora host160:/oracle/admin/orcl/pfile/initstandby.ora
从primary切换到standby
conn / as sysdba
shutdown immediate
startup mount pfile=/oracle/admin/orc/pfile/initstandby.ora
recover managed standby database disconnect;
启动新备库的listener
lsnrctl stop
lsnrctl start listener1
切换standby到primary
conn / as sysdba
alter database commit to switch to primary
shutdown
startup pfile=/oracle/admin/orcl/pfile/intiprimary.ora
启动新主库的listener
lsnrctl stop
lsnrctl start listener1