Can a Derby database simply be restored by copying a backup to the original location? - derby

According to the Derby documentation, a offline backup of a database can be created by copying the directory of the database.
There's a description of how to restore or recreate a database, but both assume that this is done by adding a parameter to the database url.
I'm wondering, if it is not much easier to stop the database server, remove the current database and replace it with the backup.
I have tried this and it seems to work. Are there any drawbacks to this method?

Related

Open dbf file from oracle database

My instructor gave me a username and password and .dbf file and tell me to open it and try to retrieve with sqlplus and oracle database
I tried to open the dbf file from excel mysql and ms server but it i gave me an error
Speaking as a DBA: As Littlefoot stated, you can't just read a data file from an Oracle DB. At best they are proprietary binary file formats, assuming it isn't encrypted on top of that. Nor can you take a data file from one database instance and just plug it in to another database instance. You also can't import it to mySQL or any other database engine: as a stand-alone data file it can only be properly read by its original database installation (i.e. the specific database instance that created it).
Oracle has specific tools available to copy data and/or files from one database to another, but those would generally use the RMAN backup manager (used to make physical backups) or (more likely in your case) the Datapump "Transportable Tablespace" feature.
To restore it from an RMAN backup you would need a complete full backup of the entire source database instance: RMAN backup sets including all data files, redo logs (and perhaps archived logs), control files, parameter files, encryption keys,, and possibly more.
To restore a transportable tablespace dump you would need your own running Oracle database instance, the correct parameters to run the impdp import utility, and the assistance/cooperation of the DBA.
You need to confirm if the file you were given is such an export dump (though the .dbf file extension would suggest not), and how you are expected to access the data. You won't be able to just "open the file".
.DBF extension probably represents datafile; I don't think you can read it with any tool (at least, I don't know of any).
You should find an Oracle DBA who might try to help; in order to restore a database (which is contained in that file), they might need control file(s), redo log files and ... can't name what other files (I'm not a DBA).
Then, if everything goes OK, database might be started up so that you'd be able to connect to it using credentials you were given.

Is it possible to add an existing tablespace datafile to a new tablespace?

Background: hard-drive died in existing Oracle12cR2 server but I was able to recover all the previous tablespaces from backup, including SYSTEM01.DBF and USERS01.DBF. I created a new Oracle 12cR2 database server, and would like to know if I can recover any of the data in the tablespaces?
Thanks.
if you have oracle running in archive log mode and have a recent backup complete with all archives until the crash: yes you can. After that you can use various methods to move the data to the new database.
My question that remains is: why move it to an other database when you were able to recover the original one? The recovered database is as good as (or even better) than the new one.

Can I Restore data from ORACLE datafiles folder?

my server had been attacked by a ransomware .rapid and all my data had been encrypted , luckily for me the oracle home folder is not encrypted - yet - and most of the files including the datafiles folder and tablespaces are still accessible
Can any One please tell me how to recover my database objects?
no backup is available , only oracle home folder -most of it-
EDIT :
The System is broken , I am trying to know witch files to collect and copy that will enable me to recover my database files from another system
when I try to log into sqlplus throw cmd I get the following error :
'sqlplus' is not recognized as an internal or external command ,
operable program or batch file.
Blockquote
EDIT :
FILES THAT I STILL HAVE ACCESS TO - NOT ENCRYPTED -
Okay. If you can find an init.ora file on your server, that's the PFILE - initialization parameter file - that's the last thing missing to easily copy your database to a new server. If you can't find it, that's ok - it'll just be a little harder. As long as you have the datafiles, you can eventually get your database back.
Basically, you'll want to follow steps 2-8 in the link I posted. You can also find some helpful info in the Oracle guide to manually creating a database in Windows. I'll walk you through them.
Shutdown your old database (if it's still running). This will make sure your datafiles are in a consistent state for copying. Probably stopping the Windows Service would be the easiest way to do that if you can't access sqlplus.
Copy the data to your new server. I'm assuming it'll be in the same location, D:\app\Administrator\oradata\VTC\
Make a copy of the control file CONTROL01.CTL and name it create_db.sql (EDIT: I was assuming that this was a backup to trace ascii version of the control file, but it sounds like this is the binary file)
Edit create_db.sql. Where it says CREATE CONTROLFILE REUSE DATABASE "MY_DB" NORESETLOGS, change it to CREATE CONTROLFILE SET DATABASE "MY_DB" RESETLOGS. Make note of whatever "MY_DB" is - this is your database name. Most people make it the same as the SID. I normally do RESETLOGS which throws out the old redo logs, but you could try keeping them with NORESETLOGS if that works for you.
Remove or comment out the lines that say RECOVER DATABASE and ALTER DATABASE OPEN;. Make sure the paths for the datafiles and logfiles look correct. Save the file.
If you couldn't find your init.ora to copy, I think this very minimal one will work for you, although you'll want to fix your memory settings later. Create it in the same folder.
DB_NAME=MY_DB
INSTANCE_NAME=MY_DB
SERVICE_NAMES=MY_DB
CONTROL_FILES = ("D:\app\Administrator\oradata\VTC\CONTROL01.CTL")
DB_FILES=100
Create an Oracle Database Windows Service. Afterwards check Services to make sure it's running.
oradim -NEW -SID MY_DB -STARTMODE manual -PFILE "D:\app\Administrator\oradata\VTC\init.ora"
Log in to your new Oracle instance as SYSDBA. There's no database yet.
cd D:\app\Administrator\oradata\VTC\
set ORACLE_SID=MY_DB
sqlplus / as sysdba
Create the database, using the control file from the old server as a script.
#create_db.sql
If everything comes back OK, run:
alter database open

Verify H2 Backup is not corrupted

I am developing an H2 (TCP), based application and I created a feature that takes a backup file when a button is clicked.
I used the
BACKUP TO '<FILENAME>'
command to take online backups. I had tested it and it works, but for very rare instances, the backup is corrupted.
Is there any API in H2 to check if the backup file is corrupted? I am thinking I would load that backup zip file, then do count queries on all tables and display it on the screen.
As Thomas (creator of H2) citiated before fastest way to verify is getting connection. If you want to learn if the data is corrupted, Backup and Restore is the another encouraged way. Currently There isn't any api or tool now.
From Thomas:
There is a small risk that the database file exists, but not fully initialized. If that is the case,
then some of the tables don't exist. The standard way to verify all tables exists is to us
DatabaseMetaData.getTables.

How to duplicate an Oracle instance?

How can I duplicate an Oracle instance? Does anyone have any idea how to do so?
Assuming you want the schema and data duplicated, use the exp and imp commands to export your database, then import it as another user using the FROMUSER and TOUSER parameters.
Well, presumably you have a backup (surely!), so just test your backup recovery on your test server.
To be slightly more serious, it depends what version you are using, newer versions of RMAN make it pretty easy I believe, older versions, you basically do it as a backup recover.
How I've done it in the past, is basically
copy backup data files
create init file
create a new controlfile is the command 'CREATE CONTROLFILE SET DATABASE "TEST" RESETLOGS ARCHIVELOG'
Apply archivelogs and then open with resetlogs
Here is an article which explains the process with a bit more detail
A minor comment on your terminology - "instance" is actually the set of processes running on the database server host and you want to duplicate the "database".
As someone else mentioned, the best way is to start with an RMAN backup of the original database. However, since Oracle 9 RMAN has had the "DUPLICATE DATABASE" command, which takes care of a lot of housekeeping that used to be necessary if you just made a copy by restoring a production backup (e.g. resetting DBID, changing data and log file locations in the control file, setting database GLOBAL_NAME, etc.).
If you're not using RMAN, and the database is on the small side, you can script something that puts each tablespace in hot backup mode, copies the datafiles for that tablespace to a backup location, and then takes the tablespace out of hot backup mode. You now have a recoverable backup that can be moved to another host for archive log application. This definitely has a performance impact on the original database and should be your last resort.
Create a template based on your existing instance. You can then create other instances.

Resources