I accidentally overwrote system.dbf in /usr/lib/oracle/xe/oradata/XE/system.dbf
Well I did not actually do it accidentally, however I overwrote it because of other failures in the database.
And when I try running the following:
SQL> shutdown
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 289406976 bytes
Fixed Size 1258488 bytes
Variable Size 92277768 bytes
Database Buffers 192937984 bytes
Redo Buffers 2932736 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
Now I want to try to Recover the database because starting it in mounted or standard surely doesn't work.
SQL> recover database using backup controlfile;
ORA-00283: recovery session canceled due to errors
ORA-01110: data file 1: '/usr/lib/oracle/xe/oradata/XE/system.dbf'
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/usr/lib/oracle/xe/oradata/XE/system.dbf'
ORA-01206: file is not part of this database - wrong database id
How do I solve this? Is it even possible?
My "real" problem was that I ran the /etc/init.d/oracle-xe configure and it overwrote my old configuration and probably removed passwords and such so my tables were gone, however I found the mytablespace.dbf so I hope that it is possible to recover?
Please shed some light on this.
Do you have a backup of your database? Overwriting the SYSTEM tablespace data files would necessitate a complete restore from backup.
As I have no experience of Oracle, I don't know at all if this applies. But if the file was opened by a process, and that process is still running, you would be able to recover it by accessing it in the /proc filesystem.
Lets remove one of them!
Ok, removed, ls again:
There it is, deleted but still held.
Sure enough, my dear old openvpn-status-server.log was recovered!