Manual Switchover Oracle Standby 11g - Single instance

Muitas empresas atuam em ambientes Standard Edition devido ao alto custo do licenciamento Enterprise Edition, e por isso não podem utilizar das vantagens do Oracle Data Guard para a criação de ambientes Standby, uma vez que o mesmo pode ser utilizado apenas em versões Enterprise Edition. 

Desta forma, é bastante frequente a criação e manutenção de ambientes standby, atualizados através de scripts agendados via cron, etc. Imagine a necessidade de um teste de switchover, onde precisaremos inverter os papeis dos ambientes (produção passa a ser standby e standby passa a ser produção). Em ambientes Data Guard, este processo é extremamente simples e rápido de ser feito e não impacta na necessidade de recriação do ambiente de standby apos o processo.

Agora, como podemos fazer este processo em ambientes standby não data guard e sem a necessidade de recriação de um dos ambientes? 

Abaixo, estarei abordando a execução deste processo. No cenário proposto, temos o ambiente ora11g como primárioe stb11g como standby e precisaremos fazer a inversão dos mesmos, onde o ora11g passará a ser standby e o stb11g primário.

  • Primeiramente estarei criando uma tabela de validação e verificando os destinos de redo e controlfile no ambiente primário (ora11g).
SQL>
SQL> alter session set nls_date_format='DD/MM/YYYY hh24:mi:ss';

Session altered.

SQL> insert into validastandby values (sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from validastandby;

DATA
-------------------
13/07/2016 13:17:40

SQL> set lines 210
SQL> col hot_name for a15
SQL> select INSTANCE_NAME,HOST_NAME,DATABASE_STATUS from v$instance;

INSTANCE_NAME    HOST_NAME            DATABASE_STATUS   
---------------- -------------------- ----------------- 
lamimtst         ora11g               ACTIVE           


SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ WRITE           PRIMARY
SQL> show parameter control_files;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/oradata/lamimtst/control0
                                                 1.ctl, /u01/oradata/lamimtst/c
                                                 ontrol02.ctl

SQL> col member for a60
SQL> select member from v$logfile;

MEMBER
------------------------------------------------------------
/u01/oradata/lamimtst/redo03a.log
/u01/oradata/lamimtst/redo02a.log
/u01/oradata/lamimtst/redo01a.log
Também vou mostrar os status do ambiente de standby antes de iniciar o processo.
SQL> select INSTANCE_NAME,HOST_NAME,DATABASE_STATUS from v$instance;

INSTANCE_NAME    HOST_NAME  DATABASE_STATUS
---------------- ---------- -----------------
lamimtst         stb11g     ACTIVE

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ ONLY            PHYSICAL STANDBY

SQL> 

SQL> show parameter control_files;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/oradata/lamimtst/control0
                                                 1.ctl, /u01/oradata/lamimtst/c
                                                 ontrol02.ctl
SQL> col member for a60
select member from v$logfile;
SQL>
MEMBER
------------------------------------------------------------
/u01/oradata/lamimtst/redo03a.log
/u01/oradata/lamimtst/redo02a.log
/u01/oradata/lamimtst/redo01a.log
Feitas as validações acima, vamos baixar o ambiente primário (ora11g) e copiar os control files e redo logs e os archives para o ambiente standby (stb11g). Neste teste, meus ambientes tem a mesma estrutura de diretórios (conforme pode ser validado acima).
SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ WRITE           PRIMARY

SQL> ! hostname
ora11g

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
Banco=lamimtst-> cd /u01/
app/        discos/     oraarchive/ orabackup/  oradata/
Banco=lamimtst-> cd /u01/oradata/lamimtst/
Banco=lamimtst-> scp /u01/oradata/lamimtst/redo01a.log /u01/oradata/lamimtst/redo02a.log /u01/oradata/lamimtst/redo03a.log @stb11g:/u01/oradata/lamimtst/
redo01a.log                                          100%   50MB  50.0MB/s   00:01
redo02a.log                                          100%   50MB  50.0MB/s   00:01
redo03a.log                                          100%   50MB  25.0MB/s   00:02
Banco=lamimtst-> scp /u01/oradata/lamimtst/control01.ctl /u01/oradata/lamimtst/control02.ctl @stb11g:/u01/oradata/lamimtst/
control01.ctl                                        100% 9808KB   9.6MB/s   00:01
control02.ctl                                        100% 9808KB   9.6MB/s   00:00
Banco=lamimtst->
Banco=lamimtst-> cd /u01/oraarchive/lamimtst
Banco=lamimtst-> scp * stb11g:/u01/oraarchive/lamimtst/
lamimtst1_100_916387968.arc                          100% 1167KB   1.1MB/s   00:00
lamimtst1_101_916387968.arc                          100%  256KB 255.5KB/s   00:00
lamimtst1_102_916387968.arc                          100%   17KB  17.0KB/s   00:00
lamimtst1_103_916387968.arc                          100%   25KB  25.0KB/s   00:01
lamimtst1_104_916387968.arc                          100% 1050KB   1.0MB/s   00:00
lamimtst1_105_916387968.arc                          100%  256KB 256.0KB/s   00:00
lamimtst1_106_916387968.arc                          100%   21KB  20.5KB/s   00:00
lamimtst1_107_916387968.arc                          100%   26KB  25.5KB/s   00:00
lamimtst1_108_916387968.arc                          100% 1120KB   1.1MB/s   00:00
lamimtst1_109_916387968.arc                          100%  255KB 254.5KB/s   00:00
lamimtst1_110_916387968.arc                          100%   20KB  19.5KB/s   00:00
lamimtst1_111_916387968.arc                          100%   22KB  22.0KB/s   00:00
lamimtst1_112_916387968.arc                          100% 1106KB   1.1MB/s   00:00
lamimtst1_113_916387968.arc                          100%  248KB 247.5KB/s   00:00
lamimtst1_114_916387968.arc                          100%   27KB  27.0KB/s   00:00
lamimtst1_115_916387968.arc                          100%   24KB  24.0KB/s   00:00
lamimtst1_116_916387968.arc                          100% 1018KB   1.0MB/s   00:00
lamimtst1_117_916387968.arc                          100%  253KB 252.5KB/s   00:00
lamimtst1_118_916387968.arc                          100%   38KB  37.5KB/s   00:00
lamimtst1_119_916387968.arc                          100%   24KB  23.5KB/s   00:00
lamimtst1_120_916387968.arc                          100% 1120KB   1.1MB/s   00:00
lamimtst1_121_916387968.arc                          100%  241KB 241.0KB/s   00:00
lamimtst1_122_916387968.arc                          100%   39KB  39.0KB/s   00:00
lamimtst1_123_916387968.arc                          100%   25KB  24.5KB/s   00:00
lamimtst1_124_916387968.arc                          100% 1139KB   1.1MB/s   00:00
lamimtst1_125_916387968.arc                          100%  254KB 254.0KB/s   00:00
lamimtst1_126_916387968.arc                          100%   29KB  28.5KB/s   00:00
lamimtst1_127_916387968.arc                          100%   14KB  13.5KB/s   00:00
lamimtst1_128_916387968.arc                          100% 1126KB   1.1MB/s   00:00
lamimtst1_129_916387968.arc                          100%  258KB 258.0KB/s   00:00
lamimtst1_130_916387968.arc                          100%   42KB  41.5KB/s   00:00
lamimtst1_131_916387968.arc                          100%   25KB  25.0KB/s   00:00
lamimtst1_132_916387968.arc                          100% 1079KB   1.1MB/s   00:00
lamimtst1_133_916387968.arc                          100%  233KB 233.0KB/s   00:00
lamimtst1_134_916387968.arc                          100%   15KB  15.0KB/s   00:00
lamimtst1_135_916387968.arc                          100%   26KB  26.0KB/s   00:00
lamimtst1_136_916387968.arc                          100% 1047KB   1.0MB/s   00:00
lamimtst1_137_916387968.arc                          100%  261KB 261.0KB/s   00:00
lamimtst1_138_916387968.arc                          100%   22KB  21.5KB/s   00:00
lamimtst1_139_916387968.arc                          100%   26KB  26.0KB/s   00:00
lamimtst1_140_916387968.arc                          100% 1209KB   1.2MB/s   00:00
lamimtst1_141_916387968.arc                          100%  259KB 259.0KB/s   00:00
lamimtst1_142_916387968.arc                          100%   22KB  22.0KB/s   00:00
lamimtst1_143_916387968.arc                          100%   13KB  13.0KB/s   00:00
lamimtst1_144_916387968.arc                          100% 1102KB   1.1MB/s   00:00
lamimtst1_145_916387968.arc                          100%  253KB 252.5KB/s   00:00
lamimtst1_146_916387968.arc                          100%   60KB  59.5KB/s   00:00
lamimtst1_147_916387968.arc                          100%   26KB  25.5KB/s   00:00
lamimtst1_148_916387968.arc                          100% 1116KB   1.1MB/s   00:00
lamimtst1_149_916387968.arc                          100%  264KB 264.0KB/s   00:00
lamimtst1_150_916387968.arc                          100%   15KB  15.0KB/s   00:00
lamimtst1_151_916387968.arc                          100%   28KB  27.5KB/s   00:00
lamimtst1_152_916387968.arc                          100% 1115KB   1.1MB/s   00:00
lamimtst1_153_916387968.arc                          100%  260KB 259.5KB/s   00:00
lamimtst1_154_916387968.arc                          100%   17KB  16.5KB/s   00:00
lamimtst1_80_916387968.arc                           100%   14KB  13.5KB/s   00:00
lamimtst1_81_916387968.arc                           100%  768KB 767.5KB/s   00:00
lamimtst1_82_916387968.arc                           100%  548KB 547.5KB/s   00:00
lamimtst1_83_916387968.arc                           100%  140KB 140.0KB/s   00:00
lamimtst1_84_916387968.arc                           100% 1280KB   1.3MB/s   00:00
lamimtst1_85_916387968.arc                           100%  303KB 302.5KB/s   00:00
lamimtst1_86_916387968.arc                           100%   53KB  52.5KB/s   00:01
lamimtst1_87_916387968.arc                           100%  250KB 250.0KB/s   00:00
lamimtst1_88_916387968.arc                           100% 1002KB   1.0MB/s   00:00
lamimtst1_89_916387968.arc                           100%  252KB 251.5KB/s   00:00
lamimtst1_90_916387968.arc                           100%   30KB  30.0KB/s   00:00
lamimtst1_91_916387968.arc                           100%   14KB  14.0KB/s   00:00
lamimtst1_92_916387968.arc                           100% 1190KB   1.2MB/s   00:00
lamimtst1_93_916387968.arc                           100%  246KB 246.0KB/s   00:00
lamimtst1_94_916387968.arc                           100%   35KB  35.0KB/s   00:00
lamimtst1_95_916387968.arc                           100%   27KB  27.0KB/s   00:00
lamimtst1_96_916387968.arc                           100% 1002KB   1.0MB/s   00:00
lamimtst1_97_916387968.arc                           100%  249KB 248.5KB/s   00:00
lamimtst1_98_916387968.arc                           100%   38KB  37.5KB/s   00:00
lamimtst1_99_916387968.arc                           100%   28KB  27.5KB/s   00:00
Banco=lamimtst->
Concluído o processo de copia dos redo logs, controlfiles e archives do ambiente primário para o standby, podemos abrir o ambiente de standby, realizar um recover database e o mesmo passará a operar como primário.
Banco=lamimtst-> hostname
stb11g
Banco=lamimtst-> sqlplus

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jul 14 07:52:58 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter user-name: / as sysdba
Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area  371617792 bytes
Fixed Size                  2253384 bytes
Variable Size             171969976 bytes
Database Buffers          192937984 bytes
Redo Buffers                4456448 bytes
Database mounted.
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/oradata/lamimtst/system01.dbf'


SQL> recover database;
ORA-00279: change 1179031 generated at 07/13/2016 13:04:49 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_81_916387968.arc
ORA-00280: change 1179031 for thread 1 is in sequence #81


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
AUTO
ORA-00279: change 1179622 generated at 07/13/2016 13:18:06 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_82_916387968.arc
ORA-00280: change 1179622 for thread 1 is in sequence #82


ORA-00279: change 1180370 generated at 07/13/2016 13:31:49 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_83_916387968.arc
ORA-00280: change 1180370 for thread 1 is in sequence #83


ORA-00279: change 1180827 generated at 07/13/2016 13:46:52 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_84_916387968.arc
ORA-00280: change 1180827 for thread 1 is in sequence #84


ORA-00279: change 1181501 generated at 07/13/2016 14:01:50 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_85_916387968.arc
ORA-00280: change 1181501 for thread 1 is in sequence #85


ORA-00279: change 1182105 generated at 07/13/2016 14:16:51 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_86_916387968.arc
ORA-00280: change 1182105 for thread 1 is in sequence #86


ORA-00279: change 1182673 generated at 07/13/2016 14:31:50 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_87_916387968.arc
ORA-00280: change 1182673 for thread 1 is in sequence #87


ORA-00279: change 1183230 generated at 07/13/2016 14:46:51 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_88_916387968.arc
ORA-00280: change 1183230 for thread 1 is in sequence #88


ORA-00279: change 1183629 generated at 07/13/2016 15:01:50 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_89_916387968.arc
ORA-00280: change 1183629 for thread 1 is in sequence #89


ORA-00279: change 1184202 generated at 07/13/2016 15:16:50 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_90_916387968.arc
ORA-00280: change 1184202 for thread 1 is in sequence #90


ORA-00279: change 1184535 generated at 07/13/2016 15:31:52 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_91_916387968.arc
ORA-00280: change 1184535 for thread 1 is in sequence #91


ORA-00279: change 1184852 generated at 07/13/2016 15:46:57 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_92_916387968.arc
ORA-00280: change 1184852 for thread 1 is in sequence #92


ORA-00279: change 1185269 generated at 07/13/2016 16:01:56 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_93_916387968.arc
ORA-00280: change 1185269 for thread 1 is in sequence #93


ORA-00279: change 1185834 generated at 07/13/2016 16:16:55 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_94_916387968.arc
ORA-00280: change 1185834 for thread 1 is in sequence #94


ORA-00279: change 1186175 generated at 07/13/2016 16:31:56 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_95_916387968.arc
ORA-00280: change 1186175 for thread 1 is in sequence #95


ORA-00279: change 1186507 generated at 07/13/2016 16:46:56 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_96_916387968.arc
ORA-00280: change 1186507 for thread 1 is in sequence #96


ORA-00279: change 1186896 generated at 07/13/2016 17:01:58 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_97_916387968.arc
ORA-00280: change 1186896 for thread 1 is in sequence #97


ORA-00279: change 1187464 generated at 07/13/2016 17:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_98_916387968.arc
ORA-00280: change 1187464 for thread 1 is in sequence #98


ORA-00279: change 1187805 generated at 07/13/2016 17:32:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_99_916387968.arc
ORA-00280: change 1187805 for thread 1 is in sequence #99


ORA-00279: change 1188140 generated at 07/13/2016 17:47:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_100_916387968.arc
ORA-00280: change 1188140 for thread 1 is in sequence #100


ORA-00279: change 1188554 generated at 07/13/2016 18:02:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_101_916387968.arc
ORA-00280: change 1188554 for thread 1 is in sequence #101


ORA-00279: change 1189124 generated at 07/13/2016 18:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_102_916387968.arc
ORA-00280: change 1189124 for thread 1 is in sequence #102


ORA-00279: change 1189440 generated at 07/13/2016 18:32:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_103_916387968.arc
ORA-00280: change 1189440 for thread 1 is in sequence #103


ORA-00279: change 1189767 generated at 07/13/2016 18:47:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_104_916387968.arc
ORA-00280: change 1189767 for thread 1 is in sequence #104


ORA-00279: change 1190162 generated at 07/13/2016 19:02:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_105_916387968.arc
ORA-00280: change 1190162 for thread 1 is in sequence #105


ORA-00279: change 1190739 generated at 07/13/2016 19:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_106_916387968.arc
ORA-00280: change 1190739 for thread 1 is in sequence #106


ORA-00279: change 1191056 generated at 07/13/2016 19:32:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_107_916387968.arc
ORA-00280: change 1191056 for thread 1 is in sequence #107


ORA-00279: change 1191386 generated at 07/13/2016 19:47:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_108_916387968.arc
ORA-00280: change 1191386 for thread 1 is in sequence #108


ORA-00279: change 1191800 generated at 07/13/2016 20:02:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_109_916387968.arc
ORA-00280: change 1191800 for thread 1 is in sequence #109


ORA-00279: change 1192380 generated at 07/13/2016 20:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_110_916387968.arc
ORA-00280: change 1192380 for thread 1 is in sequence #110


ORA-00279: change 1192696 generated at 07/13/2016 20:32:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_111_916387968.arc
ORA-00280: change 1192696 for thread 1 is in sequence #111


ORA-00279: change 1193022 generated at 07/13/2016 20:47:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_112_916387968.arc
ORA-00280: change 1193022 for thread 1 is in sequence #112


ORA-00279: change 1193423 generated at 07/13/2016 21:02:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_113_916387968.arc
ORA-00280: change 1193423 for thread 1 is in sequence #113


ORA-00279: change 1193988 generated at 07/13/2016 21:17:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_114_916387968.arc
ORA-00280: change 1193988 for thread 1 is in sequence #114


ORA-00279: change 1194320 generated at 07/13/2016 21:32:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_115_916387968.arc
ORA-00280: change 1194320 for thread 1 is in sequence #115


ORA-00279: change 1194648 generated at 07/13/2016 21:47:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_116_916387968.arc
ORA-00280: change 1194648 for thread 1 is in sequence #116


ORA-00279: change 1195036 generated at 07/13/2016 22:02:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_117_916387968.arc
ORA-00280: change 1195036 for thread 1 is in sequence #117


ORA-00279: change 1195606 generated at 07/13/2016 22:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_118_916387968.arc
ORA-00280: change 1195606 for thread 1 is in sequence #118


ORA-00279: change 1195950 generated at 07/13/2016 22:32:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_119_916387968.arc
ORA-00280: change 1195950 for thread 1 is in sequence #119


ORA-00279: change 1196278 generated at 07/13/2016 22:47:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_120_916387968.arc
ORA-00280: change 1196278 for thread 1 is in sequence #120


ORA-00279: change 1196668 generated at 07/13/2016 23:02:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_121_916387968.arc
ORA-00280: change 1196668 for thread 1 is in sequence #121


ORA-00279: change 1197230 generated at 07/13/2016 23:17:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_122_916387968.arc
ORA-00280: change 1197230 for thread 1 is in sequence #122


ORA-00279: change 1197572 generated at 07/13/2016 23:32:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_123_916387968.arc
ORA-00280: change 1197572 for thread 1 is in sequence #123


ORA-00279: change 1197902 generated at 07/13/2016 23:47:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_124_916387968.arc
ORA-00280: change 1197902 for thread 1 is in sequence #124


ORA-00279: change 1198318 generated at 07/14/2016 00:02:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_125_916387968.arc
ORA-00280: change 1198318 for thread 1 is in sequence #125


ORA-00279: change 1198892 generated at 07/14/2016 00:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_126_916387968.arc
ORA-00280: change 1198892 for thread 1 is in sequence #126


ORA-00279: change 1199221 generated at 07/14/2016 00:32:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_127_916387968.arc
ORA-00280: change 1199221 for thread 1 is in sequence #127


ORA-00279: change 1199535 generated at 07/14/2016 00:47:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_128_916387968.arc
ORA-00280: change 1199535 for thread 1 is in sequence #128


ORA-00279: change 1199932 generated at 07/14/2016 01:02:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_129_916387968.arc
ORA-00280: change 1199932 for thread 1 is in sequence #129


ORA-00279: change 1200504 generated at 07/14/2016 01:17:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_130_916387968.arc
ORA-00280: change 1200504 for thread 1 is in sequence #130


ORA-00279: change 1200853 generated at 07/14/2016 01:32:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_131_916387968.arc
ORA-00280: change 1200853 for thread 1 is in sequence #131


ORA-00279: change 1201179 generated at 07/14/2016 01:47:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_132_916387968.arc
ORA-00280: change 1201179 for thread 1 is in sequence #132


ORA-00279: change 1201606 generated at 07/14/2016 02:02:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_133_916387968.arc
ORA-00280: change 1201606 for thread 1 is in sequence #133


ORA-00279: change 1202159 generated at 07/14/2016 02:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_134_916387968.arc
ORA-00280: change 1202159 for thread 1 is in sequence #134


ORA-00279: change 1202473 generated at 07/14/2016 02:32:01 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_135_916387968.arc
ORA-00280: change 1202473 for thread 1 is in sequence #135


ORA-00279: change 1202799 generated at 07/14/2016 02:47:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_136_916387968.arc
ORA-00280: change 1202799 for thread 1 is in sequence #136


ORA-00279: change 1203190 generated at 07/14/2016 03:02:03 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_137_916387968.arc
ORA-00280: change 1203190 for thread 1 is in sequence #137


ORA-00279: change 1203777 generated at 07/14/2016 03:17:02 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_138_916387968.arc
ORA-00280: change 1203777 for thread 1 is in sequence #138


ORA-00279: change 1204095 generated at 07/14/2016 03:32:04 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_139_916387968.arc
ORA-00280: change 1204095 for thread 1 is in sequence #139


ORA-00279: change 1204424 generated at 07/14/2016 03:47:07 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_140_916387968.arc
ORA-00280: change 1204424 for thread 1 is in sequence #140


ORA-00279: change 1204826 generated at 07/14/2016 04:02:08 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_141_916387968.arc
ORA-00280: change 1204826 for thread 1 is in sequence #141


ORA-00279: change 1205400 generated at 07/14/2016 04:17:08 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_142_916387968.arc
ORA-00280: change 1205400 for thread 1 is in sequence #142


ORA-00279: change 1205724 generated at 07/14/2016 04:32:07 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_143_916387968.arc
ORA-00280: change 1205724 for thread 1 is in sequence #143


ORA-00279: change 1206038 generated at 07/14/2016 04:47:09 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_144_916387968.arc
ORA-00280: change 1206038 for thread 1 is in sequence #144


ORA-00279: change 1206439 generated at 07/14/2016 05:02:09 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_145_916387968.arc
ORA-00280: change 1206439 for thread 1 is in sequence #145


ORA-00279: change 1207010 generated at 07/14/2016 05:17:09 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_146_916387968.arc
ORA-00280: change 1207010 for thread 1 is in sequence #146


ORA-00279: change 1207357 generated at 07/14/2016 05:32:07 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_147_916387968.arc
ORA-00280: change 1207357 for thread 1 is in sequence #147


ORA-00279: change 1207686 generated at 07/14/2016 05:47:09 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_148_916387968.arc
ORA-00280: change 1207686 for thread 1 is in sequence #148


ORA-00279: change 1208085 generated at 07/14/2016 06:02:07 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_149_916387968.arc
ORA-00280: change 1208085 for thread 1 is in sequence #149


ORA-00279: change 1208668 generated at 07/14/2016 06:17:08 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_150_916387968.arc
ORA-00280: change 1208668 for thread 1 is in sequence #150


ORA-00279: change 1208982 generated at 07/14/2016 06:32:08 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_151_916387968.arc
ORA-00280: change 1208982 for thread 1 is in sequence #151


ORA-00279: change 1209312 generated at 07/14/2016 06:47:10 needed for thread 1
ORA-00289: suggestion : /u01/oraarchive/lamimtst/lamimtst1_152_916387968.arc
ORA-00280: change 1209312 for thread 1 is in sequence #152


Log applied.
Media recovery complete.
SQL>
SQL> select host_name from v$instance;

HOST_NAME
----------------------------------------------------------------
stb11g

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
MOUNTED              PRIMARY

SQL> alter database open;

Database altered.

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ WRITE           PRIMARY

SQL>
SQL> SQL> alter session set nls_date_format='DD/MM/YYYY hh24:mi:ss';

Session altered.

SQL> select * from validastandby;

DATA
-------------------
13/07/2016 13:17:40
Concluída esta etapa, nosso antigo standby (stb11g) já está operando como primário. Realizei uma consulta na tabela validastandby para confirmar que os dados estavam atualziados.
Afim de completar o processo de switchover, precisamos que nosso antigo ambiente primário (ora11g) seja convertido no novo standby.
Para isso, vamos gerar um controlfile de standby no novo ambiente primário (stb11g), enviar ao antigo primário (ora11g), substituindo os controlfiles existentes.
SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
READ WRITE           PRIMARY

SQL> alter database create standby controlfile as '/u01/orabackup/standby_control';

Database altered.

SQL> !
Banco=lamimtst-> scp /u01/orabackup/standby_control @ora11g:/u01/oradata/lamimtst/control01.ctl
standby_control                                 100% 9808KB   9.6MB/s   00:00
Banco=lamimtst-> scp /u01/orabackup/standby_control @ora11g:/u01/oradata/lamimtst/control02.ctl
standby_control                                 100% 9808KB   9.6MB/s   00:00
Banco=lamimtst->
Concluída a etapa acima, podemos montar nosso novo standby (ora11g) e aplicar os archives vindos do novo primario (stb11g).
Banco=lamimtst-> hostname
ora11g
Banco=lamimtst-> sqlplus

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jul 14 08:13:53 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Enter user-name: / as sysdba
Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  371617792 bytes
Fixed Size                  2253384 bytes
Variable Size             171969976 bytes
Database Buffers          192937984 bytes
Redo Buffers                4456448 bytes
SQL> alter database mount standby database;

Database altered.

SQL> select open_mode, database_role from v$database;

OPEN_MODE            DATABASE_ROLE
-------------------- ----------------
MOUNTED              PHYSICAL STANDBY

SQL>
Agora nosso processo de switchover foi concluído, o ambiente stb11g passou de standby para primário e o ora11g, passou de primário para standby.

SHARE

Jhonata Lamim

  • Image
  • Image
  • Image
  • Image
  • Image