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 if oracle 12c cannot open the whole database due to mistakenly deleting pdb data files?

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

Share

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

This article is about how oracle 12c can't open the entire database due to the erroneous deletion of pdb data files. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The methods are as follows:

1. If you enter the instance with your sys account, you can see that the container database is in mounted status. Of course, all the PDB inserted above are mounted.

Sqlplus sys/pwd@orcl12c as sysdba

2. An attempt was made to open CDB, indicating that a database file failed to load.

An error occurred on line 1 of SQL > alter database open;alter database open*: ORA-01157: unable to identify / lock data file 101-see DBWR trace file ORA-01110: data file 101ORA-01110:\ APP\ ADMINISTRATOR\ ORADATA\ ORCL12C\ PDBDTJK\ NMEMC.DBF'

Shutting down and starting, tossing back and forth, it's all like this:

SQL > shutdown immediate ORA-01109: the database is not open and has been uninstalled. The ORACLE routine has been closed. The SQL > startupORACLE routine has been started. Total System Global Area 2147483648 bytesFixed Size 3834152 bytesVariable Size 671092440 bytesDatabase Buffers 1459617792 bytesRedo Buffers 12939264 bytes database loaded. ORA-01157: unable to identify / lock data file 101Please refer to DBWR trace file ORA-01110: data file 101 APP\ ADMINISTRATOR\ ORADATA\ ORCL12C\ PDBDTJK\ NMEMC.DBF'

3. To consult online materials, the lost document should be marked as offline or deleted. But the prompt could not find the file!

Error on line 1 of SQL > alter database datafile 101offline;alter database datafile 101offline*: ORA-01516: log file, data file, or temporary file "101" that does not exist

This is strange, obviously you prompted the file, and now you say that you do not know the file.

4. It is estimated that the current database is CDB, and this file belongs to PDB, so you should switch to the relevant PDB and then take the file offline.

The SQL > alter session set container=PDBDTJK; session has changed. SQL > show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED- 13 PDBDTJK MOUNTED

5. Offline (offline,drop), success!

SQL > alter database datafile'D:\ APP\ ADMINISTRATOR\ ORADATA\ ORCL12C\ PDBDTJK\ NMEMC.DBF' offline;alter database datafile'D:\ APP\ ADMINISTRATOR\ ORADATA\ ORCL12C\ PDBDTJK\ NMEMC.DBF' offline* error on line 1: ORA-01145: offline SQL > alter database datafile'D:\ APP\ ADMINISTRATOR\ ORADATA\ ORCL12C\ PDBDTJK\ NMEMC.DBF' offline drop; database has been changed unless media recovery is enabled.

6. Switch back to CDB, open it, and succeed!

The SQL > alter session set container=CDB$ROOT; session has changed. The SQL > alter database open; database has changed.

Oh, my God! Ah ~ ~

7. Summary

1) A PDB is damaged, so that the entire CDB and other PDB can not be used, even can not be recovered? No, it's oracle. It can't be so retarded.

It really is. I heard that the oracle 12c R1 version is that when PDB goes down, CDB will go down with it; it will be better when it comes to R2, only PDB.

2) switching from CDB to PDB is the key to this recovery. The answers given on the Internet are 11g or earlier, and an instance corresponds to a database, so there is no concept of database switching.

3) as long as the database instance can be started, regardless of whether CDB is open or not, sys can enter:

Sqlplus sys/pwd@servername as sysdba

But not PDB. Without opening it, you can no longer get in using conn user/pwd@servername, but you can also switch sessions:

The SQL > alter session set container=PDBDTJK; session has changed.

This is a life-saving hair of Sun WuKong.

4) the solution of the above problems now seems to be step by step, clear and clear, but how much suffering and pain have been experienced in the process. The problem that appeared yesterday evening has not been solved by 21:00. Go home and continue to check the information until it is almost 24:00 in the evening. When I woke up at seven in the morning, I checked the session switch. The morning is the most sober time.

I don't even know how this file was deleted. In the case of continued use, deleting the file system will prompt you to be locked. It is estimated that you will stop the database and then delete it. I can't imagine what would happen if the database didn't get up today. Although it is a development database, many projects are in use, each with its own PDB.

Thank you for reading! On "oracle 12c accidentally deleted pdb data files caused by the entire database can not open what to do" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

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