Home » SQL & PL/SQL » SQL & PL/SQL » How to simulate crash database? (Oracle 12c Release 2)
icon5.gif  How to simulate crash database? [message #674322] Mon, 21 January 2019 08:31 Go to next message
petar97
Messages: 90
Registered: October 2018
Member
I want to do simulation crash of database and try to restore and recover.
I could not find anything about this subject.
Re: How to simulate crash database? [message #674323 is a reply to message #674322] Mon, 21 January 2019 08:44 Go to previous messageGo to next message
BlackSwan
Messages: 26448
Registered: January 2009
Location: SoCal
Senior Member
The last time I saw an Oracle crash dump was V7.3.4 over 20 years ago.
Oracle is so stable now that you can turn off power to the system & Oracle will cleanly restart after OS reboot.
You are trying to solve a problem that no longer exists.
Re: How to simulate crash database? [message #674324 is a reply to message #674323] Mon, 21 January 2019 08:56 Go to previous messageGo to next message
petar97
Messages: 90
Registered: October 2018
Member
I was thinking of something like this: https://oraclenz.wordpress.com/crashsimulator/
Re: How to simulate crash database? [message #674325 is a reply to message #674322] Mon, 21 January 2019 09:17 Go to previous messageGo to next message
EdStevens
Messages: 1047
Registered: September 2013
Senior Member
You can 'crash' the database with 'shutdown abort'. Or you can kill the pmon background process (if on *nix). But as Black Swan said, Oracle is very good at performing a crash recovery on the next startup. A much more likely need for recovery from backup is a media failure. A corruption of a data file.

But if all you want to do is practice recovery from rman backup, you don't have to actually create the failure. That said, you can easily create a genuine media failure. Shut down the database, then delete a data file. Or open a data file with a text editor and change something. It won't matter that the file is binary and the data won't present ans nice clean records and fields. Just change something, preferrably in the first few bytes, where the block header of the file header block is located. This will certainly corrupt the file. Then try to restart the database and observe the error. Since this whole exercise is to learn to do an rman recovery, you certainly want to do this on a database that you can afford to lose completely, in case you are unable to recover it.

BTW, I gave you two terms that I expect you to have enough curiosity to follow up on yourself: "instance failure" vs. "media failure"


Re: How to simulate crash database? [message #674326 is a reply to message #674325] Mon, 21 January 2019 09:23 Go to previous messageGo to next message
petar97
Messages: 90
Registered: October 2018
Member
Thanks a lot, I've learn to restore and recovery only theoretically, so I need a bit of practical examples.

Re: How to simulate crash database? [message #674328 is a reply to message #674326] Mon, 21 January 2019 10:55 Go to previous messageGo to next message
Michel Cadot
Messages: 66246
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

If you are on Linux you can easily drop (with rm) or corrupt (with dd) a data, log or control file.
On Windows these files are locked and you can't do it without using some hack tools like handle.exe part of SysInternals tool box to force close a file handle.

Re: How to simulate crash database? [message #674330 is a reply to message #674328] Mon, 21 January 2019 11:23 Go to previous messageGo to next message
petar97
Messages: 90
Registered: October 2018
Member
I use linux, thanks.
Re: How to simulate crash database? [message #674332 is a reply to message #674326] Mon, 21 January 2019 11:31 Go to previous messageGo to next message
EdStevens
Messages: 1047
Registered: September 2013
Senior Member
petar97 wrote on Mon, 21 January 2019 09:23
Thanks a lot, I've learn to restore and recovery only theoretically, so I need a bit of practical examples.

First, create yourself a database just for practicing:
https://edstevensdba.wordpress.com/category/personal-test-systems/

Once you have a test system created on a vm, shut down the vm, then back up the entire vm. I do that simply by creating a zip file of the entire directory containing the vm. On a Windows host (the host machine on which you installed Vbox), that simply means 'send directory to compressed file'. Then in the event of need to recover the entire vm (say, because you couldn't recover the database), you restore the entire vm from the zip file.

This section from the Database Backup and Recovery User's Guide should be your guide to recovery .. as well as creating the scenarios from which to recover. No, it won't tell you HOW to create the scenarios. But once you see the scenario described, that shouldn't be too hard to figure out.
Re: How to simulate crash database? [message #674335 is a reply to message #674332] Mon, 21 January 2019 12:40 Go to previous message
petar97
Messages: 90
Registered: October 2018
Member
Thanks for advices!
Previous Topic: ORA-01843 on a simple query
Next Topic: changing telephone format
Goto Forum:
  


Current Time: Tue Mar 19 20:15:47 CDT 2019