标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-00742 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (103)
- 数据库 (1,706)
- DB2 (22)
- MySQL (74)
- Oracle (1,567)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (68)
- Oracle Bug (8)
- Oracle RAC (53)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (571)
- Oracle安装升级 (94)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (81)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- _gc_undo_affinity=FALSE触发ORA-01558
- public授权语句
- 中文环境显示AR8MSWIN1256(阿拉伯语字符集)
- 处理 Oracle 块损坏
- Oracle各种类型坏块说明和处理
- fio测试io,导致磁盘文件系统损坏故障恢复
- ORA-742 写丢失常见bug记录
- Oracle 19c 202501补丁(RUs+OJVM)-19.26
- 避免 19c 数据库性能问题需要考虑的事项 (Doc ID 3050476.1)
- Bug 21915719 Database hang or may fail to OPEN in 12c IBM AIX or HPUX Itanium – ORA-742, DEADLOCK or ORA-600 [kcrfrgv_nextlwn_scn] ORA-600 [krr_process_read_error_2]
- ORA-600 ktuPopDictI_1恢复
- impdp导入数据丢失sys授权问题分析
- impdp 创建index提示ORA-00942: table or view does not exist
- 数据泵导出 (expdp) 和导入 (impdp)工具性能降低分析参考
- 19c非归档数据库断电导致ORA-00742故障恢复
- Oracle 19c – 手动升级到 Non-CDB Oracle Database 19c 的完整核对清单
- sqlite数据库简单操作
- Oracle 暂定和恢复功能
- .pzpq扩展名勒索恢复
- Oracle read only用户—23ai新特性:只读用户
分类目录归档:Data Guard
使用rman from service 搭建dataguard
从oracle 12c开始提供了rman通过from service方式搭建dg,使用12c长期支持版19c(并打上最新的patch)
配置dataguard相关参数(主备库有稍微不同)
alter system set db_unique_name='XIFENFEI' scope=spfile; alter system set service_names='XIFENFEI'; alter system set log_archive_config='dg_config=(XIFENFEI,XIFENFEIDG)'; alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=XIFENFEI'; alter system set log_archive_dest_2='service=XIFENFEIDG lgwr async valid_for=(online_logfiles,primary_role) db_unique_name=XIFENFEIDG'; alter system set standby_file_management=auto; alter system set db_file_name_convert='/u01/app/oracle/oradata/XIFENFEI/', '/u01/app/oracle/oradata/XIFENFEI/' scope=spfile; alter system set log_file_name_convert='/u01/app/oracle/oradata/XIFENFEI/', '/u01/app/oracle/oradata/XIFENFEI/' scope=spfile; alter system set fal_server=XIFENFEIDG;
配置tnsnames.ora
XIFENFEI = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.238)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = XIFENFEI) ) ) XIFENFEIDG = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.124)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = XIFENFEI) ) )
拷贝主库密码文件到备库
[oracle@primary ~]$ scp $ORACLE_HOME/dbs/orapwXIFENFEI 192.168.0.124:$ORACLE_HOME/dbs/ The authenticity of host '192.168.0.124 (192.168.0.124)' can't be established. ECDSA key fingerprint is SHA256:NI2952z4Bqc3M/B+AK7EJRiJNauROIyluvu1l4NSTX0. ECDSA key fingerprint is MD5:1d:64:dd:ef:1c:ad:ed:cf:70:22:2d:4d:7c:90:5e:5e. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.124' (ECDSA) to the list of known hosts. oracle@192.168.0.124's password: orapwXIFENFEI 100% 2048 6.6MB/s 00:00 [oracle@primary ~]$
备库启动到nomount状态
[oracle@standby ~]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 13 20:32:34 2021 Version 19.10.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. Connected to an idle instance. SQL> create spfile from pfile='/tmp/pfile'; File created. SQL> startup nomount pfile='/tmp/pfile' ORACLE instance started. Total System Global Area 4294963264 bytes Fixed Size 8904768 bytes Variable Size 805306368 bytes Database Buffers 3472883712 bytes Redo Buffers 7868416 bytes SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.10.0.0.0
rman from service方式创建standby ctl和还原数据文件
[oracle@standby ~]$ rman target / Recovery Manager: Release 19.0.0.0.0 - Production on Sat Mar 13 20:34:37 2021 Version 19.10.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. connected to target database: XIFENFEI (not mounted) RMAN> restore standby controlfile from service XIFENFEI; Starting restore at 13-MAR-21 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=9 device type=DISK channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service XIFENFEI channel ORA_DISK_1: restoring control file channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 output file name=/u01/app/oracle/oradata/XIFENFEI/control01.ctl output file name=/u01/app/oracle/fast_recovery_area/XIFENFEI/control02.ctl Finished restore at 13-MAR-21 RMAN> alter database mount; released channel: ORA_DISK_1 Statement processed RMAN> restore database from service XIFENFEI; Starting restore at 13-MAR-21 Starting implicit crosscheck backup at 13-MAR-21 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=12 device type=DISK Finished implicit crosscheck backup at 13-MAR-21 Starting implicit crosscheck copy at 13-MAR-21 using channel ORA_DISK_1 Finished implicit crosscheck copy at 13-MAR-21 searching for all files in the recovery area cataloging files... no files cataloged using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service XIFENFEI channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/XIFENFEI/system01.dbf channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service XIFENFEI channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/XIFENFEI/sysaux01.dbf channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service XIFENFEI channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/XIFENFEI/undotbs01.dbf channel ORA_DISK_1: restore complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting datafile backup set restore channel ORA_DISK_1: using network backup set from service XIFENFEI channel ORA_DISK_1: specifying datafile(s) to restore from backup set channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/XIFENFEI/users01.dbf channel ORA_DISK_1: restore complete, elapsed time: 00:00:01 Finished restore at 13-MAR-21
备库启动mrp进程
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; Database altered.
2021-03-13T20:54:08.075418+08:00 Attempt to start background Managed Standby Recovery process (XIFENFEI) Starting background process MRP0 2021-03-13T20:54:08.086269+08:00 MRP0 started with pid=56, OS id=8182 2021-03-13T20:54:08.087276+08:00 Background Managed Standby Recovery process started (XIFENFEI) 2021-03-13T20:54:13.104757+08:00 Started logmerger process 2021-03-13T20:54:13.112058+08:00 IM on ADG: Start of Empty Journal IM on ADG: End of Empty Journal PR00 (PID:8188): Managed Standby Recovery starting Real Time Apply 2021-03-13T20:54:13.205668+08:00 Parallel Media Recovery started with 4 slaves 2021-03-13T20:54:13.216576+08:00 Stopping change tracking PR00 (PID:8188): Media Recovery Waiting for T-1.S-25 (in transit) 2021-03-13T20:54:13.269138+08:00 Recovery of Online Redo Log: Thread 1 Group 12 Seq 25 Reading mem 0 Mem# 0: /u01/app/oracle/oradata/XIFENFEI/s_redo12.log
至此dataguard基本上搭建完成
ORA-04020导致adg异常
今日早上有客户反馈adg停止同步了,通过检查alert日志发现
Tue Dec 24 18:17:41 2019 Media Recovery Waiting for thread 1 sequence 56655 (in transit) Recovery of Online Redo Log: Thread 1 Group 11 Seq 56655 Reading mem 0 Mem# 0: Y:\ORACLE\ORADATA\ORACLE11\STD_REDO11.LOG Archived Log entry 56248 added for thread 1 sequence 56654 ID 0x5b6bcf9b dest 1: Tue Dec 24 18:18:11 2019 Errors in file C:\APP\ADMINISTRATOR\diag\rdbms\oracle11dg\oracle11\trace\oracle11_lgwr_3252.trc: ORA-04020: deadlock detected while trying to lock object SYS.orcl LGWR (ospid: 3252): terminating the instance due to error 4020 Tue Dec 24 18:18:11 2019 System state dump requested by (instance=1, osid=3252 (LGWR)), summary=[abnormal instance termination]. System State dumped to trace file C:\APP\ADMINISTRATOR\diag\rdbms\oracle11dg\trace\oracle11_diag_3236_20191224181811.trc Dumping diagnostic data in directory=[cdmp_20191224181811], requested by (instance=1, osid=3252 (LGWR)), summary=[abnormal instance termination]. Instance terminated by LGWR, pid = 3252
由于lgwr进程遭遇ORA-04020,从而使得lgwr进程异常,进而整个数据库crash.
分析trace文件
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Windows NT Version V6.1 Service Pack 1 CPU : 8 - type 8664, 8 Physical Cores Process Affinity : 0x0x0000000000000000 Memory (Avail/Total): Ph:8395M/32733M, Ph+PgF:41002M/65464M Instance name: oracle11 Redo thread mounted by this instance: 1 Oracle process number: 10 Windows thread id: 3252, image: ORACLE.EXE (LGWR) *** 2019-12-24 18:18:11.072 *** SESSION ID:(384.1) 2019-12-24 18:18:11.072 *** CLIENT ID:() 2019-12-24 18:18:11.072 *** SERVICE NAME:(SYS$BACKGROUND) 2019-12-24 18:18:11.072 *** MODULE NAME:() 2019-12-24 18:18:11.072 *** ACTION NAME:() 2019-12-24 18:18:11.072 A deadlock among DDL and parse locks is detected. This deadlock is usually due to user errors in the design of an application or from issuing a set of concurrent statements which can cause a deadlock. This should not be reported to Oracle Support. The following information may aid in finding the errors which cause the deadlock: ORA-04020: deadlock detected while trying to lock object SYS.orcl -------------------------------------------------------- object waiting waiting blocking blocking handle session lock mode session lock mode -------- -------- -------- ---- -------- -------- ---- 0000000676C20F08 000000066D22BE10 00000006738AB970 X 000000066D22BE10 00000006738A04B0 S 0000000677DF2E80 00000006792E2880 0000000673B13AE8 X 000000066D22BE10 00000006738A19B8 S -------------------------------------------------------- ---------- DUMP OF WAITING AND BLOCKING LOCKS ---------- -------------------------------------------------------- ------------- WAITING LOCK ------------- ---------------------------------------- SO: 0x00000006738AB970, type: 78, owner: 0x000000065D440498, flag: INIT/-/-/0x00 if: 0x3 c: 0x3 proc=0x000000066CDE7AD0, name=LIBRARY OBJECT LOCK, file=kgl.h LINE:8751, pg=0 LibraryObjectLock:Address=00000006738AB970 Handle=0000000676C20F08 RequestMode=X CanBeBrokenCount=2 Incarnation=3 ExecutionCount=0 ……………… SO: 0x00000006738A19B8, type: 78, owner: 0x000000065A38D6C0, flag: INIT/-/-/0x00 if: 0x3 c: 0x3 proc=0x000000066CDE7AD0, name=LIBRARY OBJECT LOCK, file=kgl.h LINE:8751, pg=0 LibraryObjectLock:Address=00000006738A19B8 Handle=0000000677DF2E80 Mode=S CanBeBrokenCount=1 Incarnation=1 ExecutionCount=0 User=000000066D22BE10 Session=000000066D22BE10 ReferenceCount=1 Flags=CNB/[0001] SavepointNum=1b749 LibraryHandle: Address=0000000677DF2E80 Hash=675351da LockMode=S PinMode=0 LoadLockMode=0 Status=0 ObjectName: Name=SYS.orcl FullHashValue=285b654fe3f440652c403c98675351da Namespace=DBINSTANCE(74) Type=CURSOR(00) Identifier=1 OwnerIdn=0 Statistics: InvalidationCount=0 ExecutionCount=0 LoadCount=0 ActiveLocks=1 TotalLockCount=74719 TotalPinCount=0 Counters: BrokenCount=1 RevocablePointer=1 KeepDependency=0 Version=0 BucketInUse=2 HandleInUse=2 HandleReferenceCount=0 Concurrency: DependencyMutex=0000000677DF2F30(0, 0, 0, 0) Mutex=0000000677DF2FC0(0, 149471, 1, 0) Flags=RON/PIN/KEP/BSO/[00810003] WaitersLists: Lock=0000000677DF2F10[0000000673B13B58,000000067382E2F0] Pin=0000000677DF2EF0[0000000677DF2EF0,0000000677DF2EF0] LoadLock=0000000677DF2F68[0000000677DF2F68,0000000677DF2F68] Timestamp: HandleReference: Address=0000000677DF3030 Handle=0000000000000000 Flags=[00] --------------------------------- This lock request was aborted. error 4020 detected in background process ORA-04020: deadlock detected while trying to lock object SYS.orcl kjzduptcctx: Notifying DIAG for crash event ----- Abridged Call Stack Trace ----- ksedsts()+585<-kjzdssdmp()+329<-kjzduptcctx()+288<-kjzdicrshnfy()+99<-ksuitm()+1525<-ksbrdp()+4578<-opirip() +853<-opidrv()+906<-sou2o()+98<-opimai_real()+280<-opimai()+191 <-BackgroundThreadStart()+646<-0000000076CF59CD<-0000000076E2A561 ----- End of Abridged Call Stack Trace ----- *** 2019-12-24 18:18:11.165 LGWR (ospid: 3252): terminating the instance due to error 4020 *** 2019-12-24 18:18:17.483 ksuitm: waiting up to [5] seconds before killing DIAG(3236)
日志显示由于lgwr进程等待LIBRARY OBJECT LOCK超时,从而引起异常,根据经验此类问题一般是由于bug导致,查询mos发现匹配bug信息Bug 18515268 ORA-4020 in ADG Standby Database causing instance crash by LGWR
可以根据需要打上相关Patch 18515268: ACTIVE DATAGUARD STANDBY CRASHES DUE TO AN ORA-4020 ENCOUNTERED BY LGWR
oracle active dataguard修改密码备库延迟生效
在oracle dataguard环境中,当主库修改密码之后,备库不会立即生效,需要flush shared pool之后才会生效
主库创建用户并尝试登录
[oracle@primary ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 3 17:24:12 2019 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, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> select open_mode,database_role from v$database; OPEN_MODE DATABASE_ROLE -------------------- ---------------- READ WRITE PRIMARY SQL> create user xff identified by oracle; User created. SQL> grant dba to xff; Grant succeeded. SQL> conn xff/oracle Connected.
备库登录信息
[oracle@standby ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 3 17:17:47 2019 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,open_mode from v$database; DATABASE_ROLE OPEN_MODE ---------------- -------------------- PHYSICAL STANDBY READ ONLY WITH APPLY [oracle@standby ~]$ ss SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 3 17:25:58 2019 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> conn xff/oracle Connected.
主库修改密码
[oracle@primary ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 3 17:17:47 2019 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 user xff identified by xff; User altered. SQL> conn xff/xff Connected.
备库尝试登录
SQL> conn xff/xff; ERROR: ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE. SQL> conn xff/oracle Connected.
备库原密码可以登录修改之后的密码无法登录
备库刷新shared pool,新密码登录成功
SQL> conn / as sysdba Connected. SQL> alter system flush shared_pool; System altered. SQL> conn xff/oracle ERROR: ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE. SQL> conn xff/xff Connected.
发表在 Data Guard
评论关闭