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

How to realize Log recovery function in oracle

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

Share

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

Today, I will talk to you about how to achieve log recovery in oracle. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

1. Create a user

SQL > create tablespace lits datafile'e:\ dbf\ li01.dbf' size 50m

Tablespace created.

SQL > create user li identified by li default tablespace lits

User created.

SQL > grant connect to li

Grant succeeded.

-- allow user li to use lits tablespaces at will

SQL > alter user li quota unlimited on lits

User altered.

SQL >

two。 Close the library, delete dbf files, simulation data files are missing or corrupted

SQL > shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

-- Delete li01.dbf

3. Restart

SQL > startup

ORACLE instance started.

Total System Global Area 171966464 bytes

Fixed Size 787988 bytes

Variable Size 145488364 bytes

Database Buffers 25165824 bytes

Redo Buffers 524288 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 11-see DBWR trace file

ORA-01110: data file 11:'e:\ DBF\ LI01.DBF'

-- data file loss can only be started in mount mode. If you want the system to start normally, you can first offline the missing files, and other normal data files can start the database normally.

SQL > select file#,ts#,name from v$datafile

FILE# TS# NAME

-

10 E:\ ORACLE\ PRODUCT\ 10.1.0\ ORADATA\ ORCL\ SYSTEM01.DBF

2 1 E:\ ORACLE\ PRODUCT\ 10.1.0\ ORADATA\ ORCL\ UNDOTBS01.DBF

3 2 E:\ ORACLE\ PRODUCT\ 10.1.0\ ORADATA\ ORCL\ SYSAUX01.DBF

4 4 E:\ ORACLE\ PRODUCT\ 10.1.0\ ORADATA\ ORCL\ USERS01.DBF

5 6 E:\ ORACLE\ PRODUCT\ 10.1.0\ ORADATA\ ORCL\ EXAMPLE01.DBF

6 7 E:\ DBF\ MYTABLESPACE.DBF

7 7 E:\ DBF\ MYTABLESPACE01.DBF

8 7 E:\ DBF\ MY02

9 8 E:\ DBF\ MYTS03

10 9 E:\ ORACLE\ RMAN\ RMANTS01.DBF

11 10 E:\ DBF\ LI01.DBF

11 rows selected.

4.datafile offline boot system

SQL > alter database datafile 11 offline

Database altered.

SQL > alter database open

Database altered.

SQL >

SQL >

5. Delete the original corrupted new dbf,li01.dbf must be the original same name

-- there is another way to restore. Under the premise of backup, copy the backup to a data file with the same name of datafile for recovery.

SQL > alter database create datafile'e:\ dbf\ li01.dbf'

Database altered.

6. Synchronize logs to the new dbf

SQL > recover datafile'e:\ dbf\ li01.dbf'

Media recovery complete.

No table found

SQL > select * from li.li01

Select * from li.li01

*

ERROR at line 1:

ORA-00376: file 11 cannot be read at this time

ORA-01110: data file 11:'e:\ DBF\ LI01.DBF'

SQL >

7.datafile online

SQL > alter database datafile 11 online

Database altered.

SQL > select * from li.li01

LID

-

one

two

three

SQL >

-- the query result is the result before commit.

SQL >

After reading the above, do you have any further understanding of how to implement log recovery in oracle? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

*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