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 dataguard maintenance considerations

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Check whether the primary and standby node archive logs arrive as soon as possible

(1). Archive log of primary node

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / u01/oradata/tong/archive

Oldest online log sequence 111

Next log sequence to archive 113

Current log sequence 113-the number of primary and standby nodes will be fine.

SQL >

(2). Archive log of standby node

SQL > archive log list

Database log mode Archive Mode

Automatic archival Enabled

Archive destination / u01/oradata/tong/archive

Oldest online log sequence 112

Next log sequence to archive 0

Current log sequence 113

SQL >

two。 Check whether the primary and stendby nodes are archived and flashback is enabled

SQL > select log_mode, force_logging,flashback_on from v$database

LOG_MODE FOR FLASHBACK_ON

-

ARCHIVELOG YES NO

SQL >

3. Check whether primary and stendby node snooping is enabled or normal

[oracle@dg1 ~] $lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0-Production on 11-NOV-2016 14:39:14

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=192.168.3.55) (PORT=1521)

STATUS of the LISTENER

-

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.1.0-Production

Start Date 11-NOV-2016 14:39:04

Uptime 0 days 0 hr. 0 min. 10 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File / u01/product/11.2.0.1/db_1/network/admin/listener.ora

Listener Log File / u01/diag/tnslsnr/dg1/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=192.168.3.55) (PORT=1521))

Services Summary...

Service "tong" has 1 instance (s).

Instance "tong", status UNKNOWN, has 1 handler (s) for this service...

The command completed successfully

[oracle@dg1 ~] $

4. Check whether the primary and stendby node archive directories are one to (log_archive_dest_1)

SQL > show parameter log_archive_dest_1

NAME TYPE VALUE

-

Log_archive_dest_1 string LOCATION=/u01/oradata/tong/archive valid_for (all_logfiles,all_roles)

Db_unique_name=tong

Log_archive_dest_10 string

Log_archive_dest_11 string

5. Check disk usage (sometimes the flashback recovery area cannot write to a file because there is not enough disk space)

[oracle@dg1 ~] $df-TH

Filesystem Type Size Used Avail Use% Mounted on

/ dev/sda3 ext3 17G 11G 4.4G 72% /

/ dev/sda1 ext3 510M 28M 456m 6% / boot

Tmpfs tmpfs 1.1G 520m 523m 50% / dev/shm

[oracle@dg1 ~] $

6. Open the dataguard database correctly (start the primary node database first, and then turn on log shipping mode on the standby node)

(1)。 Open the database in the primary node

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > startup mount

ORACLE instance started.

Total System Global Area 830930944 bytes

Fixed Size 2217912 bytes

Variable Size 532678728 bytes

Database Buffers 293601280 bytes

Redo Buffers 2433024 bytes

Database mounted.

SQL > alter database archivelog

Database altered.

SQL > alter database open

Database altered.

SQL > select * from dual

D

-

X

SQL >

(2)。 At the standby node

SQL > startup nomount

ORACLE instance started.

Total System Global Area 830930944 bytes

Fixed Size 2217912 bytes

Variable Size 490735688 bytes

Database Buffers 335544320 bytes

Redo Buffers 2433024 bytes

SQL > alter database mount standby database

Database altered.

SQL > alter database recover managed standby database disconnect from session

Database altered.

SQL >

7. Shut down the database correctly (first disconnect replication in syandby, then shut down database in primary)

(1) .standby node

SQL > alter database recover managed standby database cancel

Database altered.

SQL > shutdown immediate

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

SQL >

(2). Primary node

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL >

8. Modify the database to read only mode on the syandby node

(1). The database of the primary node is open state

(2). The database of the standby node is log shipping state

SQL > recover managed standby database cancel;-- end log delivery status

Media recovery complete.

SQL > alter database open read only;-- change the state of the database to read only

Database altered.

SQL > select * from t

A

-

one

two

three

four

six

seven

eight

7 rows selected.

SQL >

9. Modify the database of standby node from read only to log shipping state

SQL > select status from v$instance

STATUS

-

OPEN

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL > startup mount

ORACLE instance started.

Total System Global Area 830930944 bytes

Fixed Size 2217912 bytes

Variable Size 490735688 bytes

Database Buffers 335544320 bytes

Redo Buffers 2433024 bytes

Database mounted.

SQL > alter database recover managed standby database disconnect from session

Database altered.

SQL > select status from v$instance

STATUS

-

MOUNTED

SQL >

10. View the information of log delivery

(1). Current log information of primary node

SQL > select sequence#,status from v$log

SEQUENCE# STATUS

--

127 ACTIVE

128 CURRENT

126 ACTIVE

SQL >

(2). Log information being transmitted by the standby node

SQL > SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY

PROCESS STATUS THREAD# SEQUENCE# BLOCK# BLOCKS

--

ARCH CLOSING 1 127 1 6

ARCH CLOSING 1 125 1 271

ARCH CONNECTED 0 0 0

ARCH CLOSING 1 126 1 43

RFS IDLE 0 0 0

RFS IDLE 0 0 0

RFS IDLE 1 128 182 1

RFS IDLE 0 0 0

MRP0 WAIT_FOR_LOG 1 128 0 0

9 rows selected.

SQL >

11. Check whether the standby database of the standby node is synchronized with the main database

(1). Primary node to view archived logs

SQL > SELECT ARCHIVED_THREAD#, ARCHIVED_SEQ#, APPLIED_THREAD#, APPLIED_SEQ# FROM V$ARCHIVE_DEST_STATUS

ARCHIVED_THREAD# ARCHIVED_SEQ# APPLIED_THREAD# APPLIED_SEQ#

--

1 127 0 0

1 127 1 124

1 127 0 0

1 127 0 0

1 127 0 0

1 127 0 0

1 127 0 0

1 127 0 0

1 127 0 0

1 127 0 0

1 12700-indicates that all logs before 127 are archived

11 rows selected.

SQL >

(2). Archive log information of standby node

SQL > SELECT ARCHIVED_THREAD#, ARCHIVED_SEQ#, APPLIED_THREAD#, APPLIED_SEQ# FROM V$ARCHIVE_DEST_STATUS

ARCHIVED_THREAD# ARCHIVED_SEQ# APPLIED_THREAD# APPLIED_SEQ#

--

1 127 0 0

0 0 0

0 0 0

0 0 0

0 0 0

0 0 0

0 0 0

0 0 0

0 0 0

0 0 0

1 127 1 127

11 rows selected.

SQL >

twelve。 Check the status of dataguard on the standby node

SQL > select message from v$dataguard_status

13.primary and standby switch status normally

(1)。 Check the primary node to see if it can be switched.

SQL > select switchover_status from v$database

SWITCHOVER_STATUS

-

TO STANDBY

SWITCHOVER_STATUS:TO STANDBY indicates that it can be switched normally. If the value of SWITCHOVER_STATUS is SESSIONS ACTIVE, there is currently a session in the ACTIVE state

If the value of SWITCHOVER_STATUS is TO STANDBY:

SQL > alter database commit to switchover to physical standby

If the value of SWITCHOVER_STATUS is SESSIONS ACTIVE:

SQL > alter database commit to switchover to physical standby with session shutdown

After successfully running this command, the main library is modified to be a standby library

SQL > alter database commit to switchover to physical standby

Database altered.

SQL > shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

SQL > startup mount

ORACLE instance started.

Total System Global Area 830930944 bytes

Fixed Size 2217912 bytes

Variable Size 532678728 bytes

Database Buffers 293601280 bytes

Redo Buffers 2433024 bytes

Database mounted.

SQL > select switchover_status from v$database

SWITCHOVER_STATUS

-

TO PRIMARY

SQL >

(2). Standby node

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: 0

*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