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

What is the concept and usage of resetlogs in Oracle 12c backup and recovery

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the concept and usage of resetlogs in Oracle 12c backup and recovery. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Backup and recovery is an important subject, and some basic knowledge and usage will be understood more and more deeply with the increase of the number of actual combat. Today, take a look at resetlogs with the simplest example.

Resetlogs: resets online redolog. Redolog is required when the database instance is started, and if the file is not available or no longer exists, you can use resetlogs to open the database. During the opening process, oracle creates a new redolog based on the redo path in the control file. Resetlogs is often used to open the database in the case of incomplete recovery or OGG deployment. The reason is that the current redo is not available or cannot be used.

The experimental steps are as follows:

1. Consistent shutdown

2. Delete redolog manually

3. Start the database to mount status

4. Open the database in resetlogs mode

1. Consistent shutdown

[oracle@snow ~] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sat May 2 04:29:37 2015

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

Connected to:

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

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Confirm the physical location of data files, log couplets, control files, and temporary files

SYS@cdb > select name from v$datafile

2 union select name from v$controlfile

3 union select member from v$logfile

4 union select name from v$tempfile

NAME

/ home/oracle/dbfile/cdb/control01.ctl

/ home/oracle/dbfile/cdb/control02.ctl

/ home/oracle/dbfile/cdb/pdb1/SAMPLE_SCHEMA_users01.dbf

/ home/oracle/dbfile/cdb/pdb1/example01.dbf

/ home/oracle/dbfile/cdb/pdb1/pdb1_temp01.dbf

/ home/oracle/dbfile/cdb/pdb1/sysaux01.dbf

/ home/oracle/dbfile/cdb/pdb1/system01.dbf

/ home/oracle/dbfile/cdb/pdbseed/pdbseed_temp01.dbf

/ home/oracle/dbfile/cdb/pdbseed/sysaux01.dbf

/ home/oracle/dbfile/cdb/pdbseed/system01.dbf

/ home/oracle/dbfile/cdb/redo01.log

NAME

/ home/oracle/dbfile/cdb/redo02.log

/ home/oracle/dbfile/cdb/redo03.log

/ home/oracle/dbfile/cdb/sysaux01.dbf

/ home/oracle/dbfile/cdb/system01.dbf

/ home/oracle/dbfile/cdb/temp01.dbf

/ home/oracle/dbfile/cdb/undotbs01.dbf

/ home/oracle/dbfile/cdb/users01.dbf

18 rows selected.

Consistency stops the database to ensure that transactions in redolog have been written to disk

SYS@cdb > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@cdb >

two。 Delete redolog manually

[oracle@snow ~] $cd dbfile/cdb/

[oracle@snow cdb] $ll

Total 2135948

-rw-r- 1 oracle oinstall 17973248 May 2 04:30 control01.ctl

-rw-r- 1 oracle oinstall 17973248 May 2 04:30 control02.ctl

Drwxr-x--- 2 oracle oinstall 4096 May 2 03:07 pdb1

Drwxr-x--- 2 oracle oinstall 4096 May 2 03:01 pdbseed

-rw-r- 1 oracle oinstall 52429312 May 2 04:30 redo01.log

-rw-r- 1 oracle oinstall 52429312 May 2 04:29 redo02.log

-rw-r- 1 oracle oinstall 52429312 May 2 04:29 redo03.log

-rw-r- 1 oracle oinstall 796925952 May 2 04:30 sysaux01.dbf

-rw-r- 1 oracle oinstall 817897472 May 2 04:30 system01.dbf

-rw-r- 1 oracle oinstall 92282880 May 2 04:29 temp01.dbf

-rw-r- 1 oracle oinstall 372252672 May 2 04:30 undotbs01.dbf

-rw-r- 1 oracle oinstall 5251072 May 2 04:30 users01.dbf

[oracle@snow cdb] $rm-rf redo*.log

[oracle@snow cdb] $ll

Total 1982336

-rw-r- 1 oracle oinstall 17973248 May 2 04:30 control01.ctl

-rw-r- 1 oracle oinstall 17973248 May 2 04:30 control02.ctl

Drwxr-x--- 2 oracle oinstall 4096 May 2 03:07 pdb1

Drwxr-x--- 2 oracle oinstall 4096 May 2 03:01 pdbseed

-rw-r- 1 oracle oinstall 796925952 May 2 04:30 sysaux01.dbf

-rw-r- 1 oracle oinstall 817897472 May 2 04:30 system01.dbf

-rw-r- 1 oracle oinstall 92282880 May 2 04:29 temp01.dbf

-rw-r- 1 oracle oinstall 372252672 May 2 04:30 undotbs01.dbf

-rw-r- 1 oracle oinstall 5251072 May 2 04:30 users01.dbf

3. Start the database to mount state

[oracle@snow cdb] $sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Sat May 2 04:53:23 2015

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

Connected to an idle instance.

SYS@cdb > startup mount

ORACLE instance started.

Total System Global Area 1503199232 bytes

Fixed Size 2288584 bytes

Variable Size 973079608 bytes

Database Buffers 520093696 bytes

Redo Buffers 7737344 bytes

Database mounted.

Open database in 4.restlogs mode

Note: when executing alter database open resetlog, we will be prompted that the "RESETLOGS" option needs to be used after an incomplete recovery. We are required to execute recover database until cancel once and alter database open resetlog again to successfully open the database and recreate the redolog.

If you execute recover first while the database is in the mount state, then resetlogs will not report an error.

SYS@cdb > alter database open resetlogs

Alter database open resetlogs

*

ERROR at line 1:

ORA-01139: RESETLOGS option only valid after an incomplete database recovery

SYS@cdb > recover database until cancel

Media recovery complete.

SYS@cdb > alter database open resetlogs

Database altered.

If you execute recover first while the database is in the mount state, then resetlogs will not report an error.

After the instance is started, you can see that the new redolog is created in the previous location.

SYS@cdb > exit

Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0-64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

[oracle@snow cdb] $ll

Total 2135948

-rw-r- 1 oracle oinstall 17973248 May 2 04:54 control01.ctl

-rw-r- 1 oracle oinstall 17973248 May 2 04:54 control02.ctl

Drwxr-x--- 2 oracle oinstall 4096 May 2 03:07 pdb1

Drwxr-x--- 2 oracle oinstall 4096 May 2 03:01 pdbseed

-rw-r- 1 oracle oinstall 52429312 May 2 04:54 redo01.log

-rw-r- 1 oracle oinstall 52429312 May 2 04:54 redo02.log

-rw-r- 1 oracle oinstall 52429312 May 2 04:54 redo03.log

-rw-r- 1 oracle oinstall 796925952 May 2 04:54 sysaux01.dbf

-rw-r- 1 oracle oinstall 817897472 May 2 04:54 system01.dbf

-rw-r- 1 oracle oinstall 92282880 May 2 04:54 temp01.dbf

-rw-r- 1 oracle oinstall 372252672 May 2 04:54 undotbs01.dbf

-rw-r- 1 oracle oinstall 5251072 May 2 04:54 users01.dbf

Many beginners encounter the resetlogs option for the first time in some of the more complex recovery scenarios. I hope this junior experiment can help you understand resetlogs.

So much for sharing the concept and usage of resetlogs in Oracle 12c backup and recovery. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

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