Oracle Dataguard - Configuring Logical StandbyA logical standby is a type of standby database in Oracle Data Guard that stays in read/write mode, allowing it to be open for reporting and read operations while receiving real-time data synchronization from the primary database. It operates by converting the data received from the primary database into SQL statements, which are then executed on the logical standby, making it ideal for data consolidation, testing, and reporting purposes.
We will be converting an existing Physical standby into a logical standby. We assume that you already have a physical standby configured and data guard broker is enabled. Once you convert to Logical Standby, you cannot convert it back to Physical Standby. Primary Database Changes :Below is the current configuration setup :DGMGRL> show configuration Configuration - prim1 Protection Mode: MaxPerformance Members: tesstand - Primary database tesprim1 - Physical standby database Warning: ORA-16809: multiple warnings detected for the member Fast-Start Failover: DISABLEDConfiguration Status : WARNING (status updated 37 seconds ago)In the primary database, retrieve the list of objects that are not supported : SQL> select distinct owner, table_name from dba_logstdby_unsupported order by owner,table_name; no rows selectedCheck the reason behind those unsupported objects : SQL> select column_name,data_type from dba_logstdby_unsupported; no rows selectedIdentify the unsupported schemas on primary : SQL> select owner from dba_logstdby_skip where statement_opt = 'INTERNAL SCHEMA'; OWNER ----------------------- SYS SYSTEM XS$NULL OJVMSYS LBACSYS OUTLN SYS$UMF APPQOSSYS DBSNMP DBSFWUSER ANONYMOUS OWNER ------------------------ GGSYS CTXSYS DVF DVSYS SI_INFORMTN_SCHEMA GSMADMIN_INTERNAL ORDPLUGINS MDSYS OLAPSYS ORDDATA XDB OWNER ----------------------- ORDSYS WMSYS GSMCATUSER REMOTE_SCHEDULER_AGENT SYSBACKUP GSMUSER SYSRAC AUDSYS DIP SYSKM ORACLE_OCM OWNER -------------------------- SPATIAL_CSW_ADMIN_USR SYSDG 35 rows selected.Make sure each table row in primary database can be uniquely identified. To fix the table, make sure you add a primary key : SQL> SELECT OWNER, TABLE_NAME,BAD_COLUMN FROM DBA_LOGSTDBY_NOT_UNIQUE 2 ; OWNER TABLE_NAME BAD_COLUMN ------ ----------- ---------- U1 T1 N U1 T2 NRedo Apply needs to be stopped on the Physical Standby now : DGMGRL> edit database tesprim1 set state = apply-off; Succeeded. Build Log Miner directory on primary SQL> exec dbms_logstdby.build; PL/SQL procedure successfully completed. Open Physical Standby :Open the physical standby databaseOn Standby Server : SQL> alter database recover to logical standby stand; Database altered. SQL> shut immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup mount ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance ORACLE instance started. Total System Global Area 532676608 bytes Fixed Size 8622720 bytes Variable Size 297799040 bytes Database Buffers 218103808 bytes Redo Buffers 8151040 bytes Database mounted. SQL> alter database open resetlogs; Database altered. SQL> select name, open_mode, db_unique_name, database_role, guard_status from v$database;
Data Guard Broker Changes :Now we need to remove existing physical standby database from the configuration and add the new logical standby databaseDGMGRL> remove database tesprim1 Removed database "tesprim1" from the configurationStart Logical Apply Service on standby server On Standby SQL> alter database start logical standby apply immediate; Database altered.Now add the new logical standby to the broker configuration DGMGRL> add database tesprim1 as connect identifier is tesprim1; Database "tesprim1" added DGMGRL> enable database tesprim1; Enabled.Let us check the configuration once again DGMGRL> show configuration; Configuration - prim1 Protection Mode: MaxPerformance Members: tesstand - Primary database tesprim1 - Logical standby database Warning: ORA-16854: apply lag could not be determined Fast-Start Failover: DISABLED Configuration Status: WARNING (status updated 30 seconds ago) Verify logical standby :You cannot see the LSP process under v$managed_standby view but you can check the process at OS level On standby :[oracle@tesdb ~]$ ps -ef|grep lsp oracle 6795 1 4 17:19 ? 00:00:05 ora_lsp0_tesprim1 oracle 7092 6941 0 17:21 pts/6 00:00:00 grep --color=auto lspQuery to check if logical standby is applying the transactions SQL> SELECT name, value FROM v$logstdby_stats;
Two simple ways to check logical standby is working fine
Shutting Down Logical Standby « Previous Next Topic » (Oracle Dataguard - Configuring Snapshot Standby) |