公司erp系统,经过Oracle Dataguard实现主从同步,已经运行一年多,近期巡检发现主从数据库的数据不一致了,从库没法启动,报ORA-10458 ORA-01196 ORA-01110sql
处理思路:查看状态发现数据库在mount状态,尝试启库数据库
SQL> select status from v$instance; STATUS ------------ MOUNTED SQL> alter database open; alter database open * ERROR at line 1: ORA-10458: standby database requires recovery ORA-01196: file 1 is inconsistent due to a failed media recovery session ORA-01110: data file 1: '/u01/app/oracle/oradata/ncdb/system01.dbf'
检查数据库发现从库监听未启动,启动从库监听session
[oracle@ncdb_standby ~]$ lsnrctl start LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-JUN-2018 10:11:10 Copyright (c) 1991, 2013, Oracle. All rights reserved. Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.4.0 - Production System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora Log messages written to /u01/app/oracle/diag/tnslsnr/ncdb_standby/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.xx.xx)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.xx.xx)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date 15-JUN-2018 10:11:10 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora Listener Log File /u01/app/oracle/diag/tnslsnr/ncdb_standby/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.xx.xx)(PORT=1521))) Services Summary... Service "standby" has 1 instance(s). Instance "NCDB", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully
再次开库成功,而后开启实时应用oracle
[oracle@ncdb_standby ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 15 10:11:27 2018 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> alter database open; Database altered. SQL> recover managed standby database using current logfile disconnect; Media recovery complete. SQL> select open_mode,database_role from v$database; OPEN_MODE DATABASE_ROLE -------------------- ---------------- READ ONLY WITH APPLY PHYSICAL STANDBY
检查日志是否正常引用app
SQL> select max(sequence#) from v$archived_log where applied='YES'; MAX(SEQUENCE#) -------------- 37594 SQL> / MAX(SEQUENCE#) -------------- 37595 SQL> / MAX(SEQUENCE#) -------------- 37595 SQL> / MAX(SEQUENCE#) -------------- 37595 SQL> / MAX(SEQUENCE#) -------------- 37596
总结:当遇到的故障不影响业务运行时,切记不要盲目操做修改数据库,首先应该查看数据库、操做系统以及存储等基础环境健康状态,而后查看数据库自身问题!!!tcp