Convertir una instancia de Oracle primaria a standby

Categorías:

Para convertir una instancia de oracle primaria a standby usamos los siguientes comandos…

Verificamos el estado de la instancia

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[oracle@correo: glpi2 [~] 14:21:11 $ sq
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 8 14:23:05 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> SELECT database_role FROM v$database;
DATABASE_ROLE
----------------
PRIMARY
SQL>
[oracle@correo: glpi2 [~] 14:21:11 $ sq SQL*Plus: Release 11.2.0.4.0 Production on Sat May 8 14:23:05 2021 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> SELECT database_role FROM v$database; DATABASE_ROLE ---------------- PRIMARY SQL>
[oracle@correo: glpi2 [~]  14:21:11 $ sq

SQL*Plus: Release 11.2.0.4.0 Production on Sat May 8 14:23:05 2021

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SELECT database_role FROM v$database;

DATABASE_ROLE
----------------
PRIMARY

SQL>

Procedemos a bajar la instancia

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL>
SQL> shutdown immediate; 
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

Arrancamos la instancia de la siguiente manera

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SQL> STARTUP MOUNT
ORACLE instance started.
Total System Global Area 1870647296 bytes
Fixed Size 2254304 bytes
Variable Size 503319072 bytes
Database Buffers 1358954496 bytes
Redo Buffers 6119424 bytes
Database mounted.
SQL>
SQL> STARTUP MOUNT ORACLE instance started. Total System Global Area 1870647296 bytes Fixed Size 2254304 bytes Variable Size 503319072 bytes Database Buffers 1358954496 bytes Redo Buffers 6119424 bytes Database mounted. SQL>
SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area 1870647296 bytes
Fixed Size		    2254304 bytes
Variable Size		  503319072 bytes
Database Buffers	 1358954496 bytes
Redo Buffers		    6119424 bytes
Database mounted.
SQL>

La siguiente sentencia le indica a oracle que cambie el rol de la instancia

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
Database altered.
SQL>
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY; Database altered. SQL>
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;

Database altered.

SQL>

Bajamos la instancia

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL>
SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL>
SQL> shutdown immediate; 
ORA-01507: database not mounted


ORACLE instance shut down.
SQL>

De nuevo , iniciamos la instancia

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SQL> startup
ORACLE instance started.
Total System Global Area 1870647296 bytes
Fixed Size 2254304 bytes
Variable Size 503319072 bytes
Database Buffers 1358954496 bytes
Redo Buffers 6119424 bytes
Database mounted.
Database opened.
SQL>
SQL> startup ORACLE instance started. Total System Global Area 1870647296 bytes Fixed Size 2254304 bytes Variable Size 503319072 bytes Database Buffers 1358954496 bytes Redo Buffers 6119424 bytes Database mounted. Database opened. SQL>
SQL> startup 
ORACLE instance started.

Total System Global Area 1870647296 bytes
Fixed Size		    2254304 bytes
Variable Size		  503319072 bytes
Database Buffers	 1358954496 bytes
Redo Buffers		    6119424 bytes
Database mounted.
Database opened.
SQL>

Y verificamos que el rol se haya cambiado…

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
SQL> SELECT database_role FROM v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
SQL>
SQL> SELECT database_role FROM v$database; DATABASE_ROLE ---------------- PHYSICAL STANDBY SQL>
SQL> SELECT database_role FROM v$database;

DATABASE_ROLE
----------------
PHYSICAL STANDBY

SQL>

Esto es todo…..