Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 11g R2 ADG operation and maintenance

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

-= Oracle ADG operation and maintenance =

-- = Test log transfer =

1. On primary, view the last archived log and force the log switch

ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS'

SELECT sequence#, first_time, next_time

FROM v$archived_log

ORDER BY sequence#

ALTER SYSTEM SWITCH LOGFILE

two。 On standby, view that the newly archived log has reached standby and apply.

ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS'

SELECT sequence#, first_time, next_time, applied

FROM v$archived_log

ORDER BY sequence#

-- = Protection Mode =

There are three protection modes for primary database:

[Maximum availability]

Transactions on the primary do not commit until redo information has been written to the online redo log and the standby redo logs of at least one standby location. If no standby location is available, it acts in the same manner as maximum performance mode until a standby becomes available again.

[Maximum Performance]

Transactions on the primary commit as soon as redo information has been written to the online redo log. Transfer of redo information to the standby server is asynchronous, so it does not impact on performance of the primary.

[Maximum Protection]

Transactions on the primary do not commit until redo information has been written to the online redo log and the standby redo logs of at least one standby location. If not suitable standby location is available, the primary database shuts down.

By default, it is maximum performance mode for a newly created standby database,primary database.

Select protection_mode from v$database

You can switch using the following command.

-- Maximum Availability.

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=sicilybak AFFIRM SYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak'

ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE AVAILABILITY

-- Maximum Performance.

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=sicilybak NOAFFIRM ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak'

ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

-- Maximum Protection.

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=sicilybak AFFIRM SYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sicilybak'

SHUTDOWN IMMEDIATE

STARTUP MOUNT

ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PROTECTION

ALTER DATABASE OPEN

-- = Switchover=

Primary and standby switch roles without losing data or reset of redo logs.

-- execute the following command on primary

-- Convert primary database to standby

CONNECT / AS SYSDBA

ALTER DATABASE COMMIT TO SWITCHOVER TO STANDBY

-- Shutdown primary database

SHUTDOWN IMMEDIATE

-- Mount old primary database as standby database

STARTUP NOMOUNT

ALTER DATABASE MOUNT STANDBY DATABASE

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION

-- execute the following command on standby

-- Convert standby database to primary

CONNECT / AS SYSDBA

ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY

-- Shutdown standby database

SHUTDOWN IMMEDIATE

-- Open old standby database as primary

STARTUP

When finished, test the log transfer as before. If everything works fine, you can implement another switchover, also called switchback, to switch the primary database back to the original server.

-- = Failover=

If primary database is not available, standby database can be activated as primary using the following statement.

# # alter database recover managed standby database finish force

# # alter database commit to switchover to primary

# # alter database open

-- Note:Oracle Corporation recommends that you perform a failover operation

-- using the ALTER DATABASE RECOVER MANAGED STANDBY DATABASE statement

-- with the FINISH or FINISH SKIP keywords rather than a forced failover operation whenever possible.

-- A forced failover operation renders other standby databases that

-- are not participating in the failover operation

-- unusable as standby databases to the newly activated primary database.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH

-- This statement performs a forced failover operation

-- in which the primary database is removed from the Data Guard environment and

-- a standby database assumes the primary database role.

-- The standby database must be mounted before it can be activated with this statement.

ALTER DATABASE ACTIVATE STANDBY DATABASE

Because standby database is now a primary database, it should be backed up immediately.

After the original primary database and other failures are restored, it can be configured as standby.

-- = DG Gap manual synchronization =

Select process,sequence#,status from v$managed_standby

Select * from v$archive_gap

Select sequence#,applied from v$archived_log order by sequence#

Select name from v$archived_log where thread#=1 and dest_id=1 and sequence# between 7 and 10

Scp * 4 * oracle@dgtest:/data/ora11g/archivelog

-- single file registration

Alter database register logfile'/ data/ora11g/archivelog/arch_1_41_830282966.log'

Select max (sequence#) from v$archived_log

-multiple file registrations

Scp gap* oracle@dgtest:/data/ora11g/archivelog/

Rman target /

Catalog start with'/ data/ora11g/archivelog/'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 285

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report