问题

dg搭建后开库报错

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-10458: standby database requires recovery

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01110: data file 1: '/u01/app/oracle/oradata/standby/system.258.1170868637'

处理办法

1.主库检查通道状态,同步相关参数等

##主库

[oracle@racstd1 backup]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu Jun 13 16:03:25 2024

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Advanced Analytics and Real Application Testing options

SQL> alter system archive log current;

System altered.

SQL> alter system set log_archive_dest_state_2=enable;

System altered.

SQL> show parameter fal

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

fal_client                           string      standby

fal_server                           string      stdb

SQL> alter system set fal_client='stdb';

System altered.

SQL> alter system set fal_server='standby';

System altered.

SQL>

如果第一次搭建dg数据量少的情况下,

2.建议对主库重新做备份

3.备库清理之前备份文件

[oracle@upg19dg onlinelog]$ cd /backup/

[oracle@upg19dg backup]$ ls

arch_STANDBY_20240613_13_1  arch_STANDBY_20240613_19_1  ctl_STANDBY_20240613_16_1   data_STANDBY_20240613_11_1  data_STANDBY_20240613_18_1

arch_STANDBY_20240613_14_1  arch_STANDBY_20240613_20_1  ctl_STANDBY_20240613_22_1   data_STANDBY_20240613_12_1  data_STANDBY_20240613_9_1

arch_STANDBY_20240613_15_1  arch_STANDBY_20240613_21_1  data_STANDBY_20240613_10_1  data_STANDBY_20240613_17_1

[oracle@upg19dg backup]$ rm -f *

4.主库重新向备库传备份

scp * oracle@192.168.213.116:/backup/

5.备库清理数据文件

[oracle@upg19dg oradata]$ cd standby/

[oracle@upg19dg standby]$ ls

current.261.1170868729  sysaux.257.1170868601  system.258.1170868637  undotbs1.260.1170868683  undotbs2.265.1170868927  users.259.1170868681

[oracle@upg19dg standby]$ rm -f *

[oracle@upg19dg standby]$

[oracle@upg19dg STDB]$ cd onlinelog/

[oracle@upg19dg onlinelog]$ ls

o1_mf_2_m6o4jftc_.log  o1_mf_3_m6o4k05k_.log  stdb05.log  stdb06.log  stdb07.log  stdb08.log  stdb09.log  stdb10.log

[oracle@upg19dg onlinelog]$ rm -f o1_mf_2_m6o4jftc_.log

[oracle@upg19dg onlinelog]$ rm -f o1_mf_3_m6o4k05k_.log

[oracle@upg19dg onlinelog]$

[oracle@upg19dg onlinelog]$ cd ..

[oracle@upg19dg STDB]$ cd ..

[oracle@upg19dg oradata]$ cd ..

[oracle@upg19dg oracle]$ ls

admin  arch  checkpoints  diag  oradata  product

[oracle@upg19dg oracle]$ cd arch/

[oracle@upg19dg arch]$ ls

standby

[oracle@upg19dg arch]$ cd standby/

[oracle@upg19dg standby]$ ls

redo01.log  STDB

[oracle@upg19dg standby]$ rm -f redo01.log

[oracle@upg19dg standby]$ cd ..S

-bash: cd: ..S: No such file or directory

[oracle@upg19dg standby]$ cd STDB/

[oracle@upg19dg STDB]$ ls

onlinelog

[oracle@upg19dg STDB]$ cd onlinelog/

[oracle@upg19dg onlinelog]$ ls

o1_mf_2_m6o4jfwg_.log  o1_mf_3_m6o4k07k_.log

[oracle@upg19dg onlinelog]$ rm -f *

5.备库手动重新恢复

[oracle@upg19dg onlinelog]$  rman target /

Recovery Manager: Release 12.1.0.2.0 - Production on Thu Jun 13 15:24:14 2024

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total System Global Area    7532969984 bytes

Fixed Size                     2941920 bytes

Variable Size               1358957600 bytes

Database Buffers            6157238272 bytes

Redo Buffers                  13832192 bytes

RMAN>  restore standby controlfile from '/backup/ctl_STANDBY_20240613_48_1';

Starting restore at 13-JUN-24

using channel ORA_DISK_1

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/standby/current.261.1170868729

output file name=/u01/app/oracle/product/12.1.0/dbhome_1/dbs/current.256.1170868729

Finished restore at 13-JUN-24

RMAN>

RMAN> alter database mount;

Statement processed

released channel: ORA_DISK_1

RMAN> catalog start with'/backup';

Starting implicit crosscheck backup at 13-JUN-24

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=17 device type=DISK

Crosschecked 43 objects

Finished implicit crosscheck backup at 13-JUN-24

Starting implicit crosscheck copy at 13-JUN-24

using channel ORA_DISK_1

Finished implicit crosscheck copy at 13-JUN-24

searching for all files in the recovery area

cataloging files...

no files cataloged

searching for all files that match the pattern /backup

List of Files Unknown to the Database

=====================================

File Name: /backup/ctl_STANDBY_20240613_48_1

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /backup/ctl_STANDBY_20240613_48_1

Run{

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

allocate channel c4 type disk;

restore database;

switch datafile all;

switch tempfile all;

recover database;

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}

6.然后正常开库即可

alter database open;

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐