Restore marklogic database by extracting config from backup - database

I have been given a copy of a Marklogic v9 database backup which was taken from a Marklogic server running on linux.
I now need to restore the database from the backup dump, onto a windows 2016 server, but the MarkLogic database on the destination windows server doesnt exist.
Is it possible to somehow extract the MarkLogic database configuration from the backup dump , create a database on the destination server then restore over that database? In the backup dump I have a forests directory and all the XML/cfg/label files in the root directory of backup dump.
Or do I need a MarkLogic admin to extract the config of prod database that was backed up, then create an empty database on the destination server ( using the extracted prod database config ), then restore over that? I notice you cant restore without an existing database to restore over.
Or do I alternatively create a dummy database on my destination server of the same name as the prod database, then restore over that? The disk layout obviously will be different.
Any help appreciated.

You cannot restore a backup from a different architecture. If you need to move from Linux to Windows, I'd recommend using MLCP export/import, or maybe even copy. In any case you will need to have a target database up and running. You could export the configuration from one system, and import it in the other using our REST apis, like Configuration Management API or Management API. Our community tool ML-Gradle could be of help with that.
HTH!

Related

Transporting a SQL Server database dump (of data and models) from one environment to another using Microsoft SQL Server Management Studio

Surprisingly, I did not find a concise way on Stackoverflow or elsewhere, so please allow me to ask.
I want transport a complete SQL Server database from one environment to another using the Microsoft SQL Server Management Studio (SSMS).
I guess I need a complete database dump (of model and data) e.g. from the production environment, which I then restore e.g. on the pre-production environment.
I am more the MongoDB guy, and it is straight forward there. But how do I quickly backup, transfer and restore a complete T-SQL database (context) using SSMS? The issue is that I should explain somebody else what to do since I do not have the rights to try it myself.
The official documentation on backup and restore is rather lengthy, but I get the concept, I hope. Except for the copy only backup, maybe. The definition reads:
Copy-only full backups (all recovery models)
A copy-only backup cannot serve as a differential base or differential backup and does not affect the differential base. Restoring a copy-only full backup is the same as restoring any other full backup.
Do I need a copy-only backup for my purpose? If so, why?
Recipe Draft
Within SSMS on the source server, open the Object Explorer (F8), right click on the DB you want to transport (e.g.myDB) and choose Tasks > Backup...
In the pop-up window, choose Backup Type: Full. Under Destination, choose Back up to: Disk and add a folder.
Navigate to the folder where the .bak file is stored, e.g. C:\Program Files\Microsoft SQL Server\MSSQL 14.MSSQLSERVER\MSSQL\Backups\, transfer it to the destination server onto a similar location.
On the destination server, open the Object Explorer (F8). Make sure you have no database context called myDB, then right click on another context, choose Task > Restore > Database... and then what?
I would also need help with the last step, please. The popup window shows on top No backup set selected to be restored. and keeps freezing if I want to choose the myDB.bak file.
References
SQL Server Management Studio: Backup and restore database without data
Import / Export database with SQL Server Server Management Studio - loads of hits, but rather old and not quite fool-proof recipes
Copy database from SQL server management to another instance Directely
Microsoft SQL DB to MySQL DB
restore sql backup with microsoft management studio
You should use COPY_ONLY if you don't want to mess with the potentially existing backup set. For example, if you have some backup solution that takes differential backups (log backups) in between full backups. You need to use COPY_ONLY if you're manually going to take a FULL backup, otherwise you will make the differential backups useless until the next FULL backup is performed by your backup solution (or you have to use that FULL backup of yours together with the diff backups in case of a point-in-time restore, but you risk having issues using that with your normal backup solution).

how to repair master database in sql server 2005

For some unknown reasons, all of a sudden my sql servers master database has been corrupted and sql service won't run. I have spent hours and tried various things like trying to run the service under different accounts, also checked that no compression is set in the data folder etc but nothing seems to work. I copied master database from another instance and the service would start and I can connect to the database instance via management studio but I won't see my databases. I have backup of the corrupted master database (mdf and log file) but just wondering how can we fix this database to see all my databases? thanks
Just restore from the backup (good to have one!), it's the recommended way:
http://blogs.technet.com/b/fort_sql/archive/2011/02/01/the-easiest-way-to-rebuild-the-sql-server-master-database.aspx
In case you don't have a good backup, you will have to rebuild master database:
http://msdn.microsoft.com/en-us/library/ms144259%28v=sql.90%29.aspx
Copying over from another existing instance is not recommended.

Migrating massive databases in SQL Server

One of the tasks in a project that I'm working on is to migrate an existing database on SQL Server 2000, to a new server which runs SQL Server 2008. This database is extremely huge, with 23 million rows and a 78GB mdf file.
What is the best way to migrate a database of this size?
My current approach would be to:
allow for application downtime so that the application doesn't write records to the database
perform a full backup on SQL Server 2000.
move backup file over to new server across the network.
restore full backup on SQL Server 2008.
configure the application to refer to the database on the new server
restart application.
decommission the database on SQL Server 2000.
However, I'm not sure how much application downtime that would involve.
Are there any easier approaches, or an approach that involves very little downtime? Can a backup be taken while the application is running? Obviously I would need to stop the application when the backup file is transferred and the restore is completed. Interested to hear your approaches to a task like this.
If you're open to downtime:
Detach the database
Copy data file(s) and log file(s) to the new server
Attach the database on the new server instance
Detaching closes the database and finalizes the files so they safely can be moved (or backed up via filesystem backup). It will no longer be accessible on the server instance until you reattach it.
Don't cut and paste / move the data and log files, just in case something bombs during the copy.
There are several other things to keep in mind when migrating to a new server instance, like making sure logins exist on the new instance, features in use that might be deprecated, etc.
Here's the reference for detach/attach.

Restore to remote database from my local machine

I am registered at Go Daddy and want to restore the database there from my local machine. The tool they provide me with doesn't work unless it's from them. I'm trying to restore from my local SQL server, but when I browse I can't restore the local files of the remote database.
They're intentionally preventing users from restoring backups that are "foreign" to them in order to satisfy an obscure Microsoft security recommendation.
You will have to perform a schema comparison and a data comparison between your local machine and the empty database on the hosting to generate the scripts to re-create all of the objects and data. (Having those scripts available in a source control storage would also be helpful.)
There are basically two ways to restored the Database using Sql Server.
Through SSMS Restore Utility.
Manual Database restore Script from here

Restore a SQL Express database from a file backup

I'm using a SQL Express database on my development machine. Unfortunately, I had to re-install the operating system and all the software on the machine. Now I need help to restoring the database that I was using before the re-installation. I have a backup of all files on the computer from before re-installing, but how do I find and restore the database from it?
You say you have a backup, but I'm not convinced that you do. Do you have any *.BAK files on your machine?
If not, you need to locate the data file (and preferably the log file as well). Depending on how you created the database originally, the files /should/ be in the form of <database name>[_data].mdf (data file) and <database name>[_log].ldf (log file).
Once you've found the files, you can use CREATE DATABASE ... FOR ATTACH and if the log file is damaged you can use the option FOR ATTACH_REBUILD_LOG instead.
A couple of notes:
(a) if you have a backup of the database, the link Rick Liddle created will be useful. Depending on whether your new instance of SQLExpress is located in the same location, you may need to use WITH MOVE to move the data and/or log file to valid folders in order to restore your databases.
(b) depending on what happened to your old machine (e.g. did it crash and die, how was the backup obtained, etc.), the mdf and/or ldf files may not be restorable. This is what proper database backups are designed to insure against.
Are you sure you have an actual backup (.BAK)?
Create a new database.
Right click
Select Tasks
Restore
Files and FileGroups...
Select File

Resources