Thursday, September 3, 2015

Working with SItecore MongoDB databases

Sitecore introduce mongoDB on Sitecore 7.5 for handle their Sitecore Experience database (xDB).
When you working with Sitecore mongoDB you have to know how to backup and restore mongoDB databases.

Backup Sitecore mongoDB database

The simple way is to backup as dump.

Go to mongoDB folder/bin from command prompt.

Backup single database to a different location
D:\MongoDB\bin>mongodump --out \{folder}\{folder}\ -db {database_name}

Ex- D:\MongoDB\bin>mongodump --out E:\backups\ -db mongo_old_db

Sometimes there can be an error like bellow:

Then use D:\MongoDB\bin>mongodump --out \{folder}\{folder}\ --db {database_name}

Read more on mongodump from here

Restore Sitecore mongoDB databse

You can rename the database if you want when restoring.

Go to mongoDB folder/bin from command prompt.

Restore single database with a different name
D:\MongoDB\bin>mongorestore -d {new_database_name} {old_database_backup_path}

Ex- D:\MongoDB\bin>mongorestore -d mongo_new_db D:\backups\old\mongo_old_db

Read more on mongorestore from here

Read more on other backup and restore methods in mongoDB from here

NOTE: Always use folder paths and folder names without spaces and special characters.
Otherwise use the path within double quotes ("").

To view database tables and data in a graphical way, you can use a tool like RoboMongo.
Read and download RoboMongo from here.

No comments:

Post a Comment