Question
· Jan 20, 2023

How do I add a database to a mirror

I want to add a database to a mirror.

Is this the correct way to do so:

set status=##Class(SYS.Mirror).AddDatabase("/db/iknow")

Is the status=0 if it worked and anything else means it failed?

Thanks for any help

Product version: IRIS 2020.2
Discussion (10)2
Log in or sign up to continue

Assuming you have a sync mirror established, adding new db to mirror is as simple as:

  1. Create DB on Primary.
  2. Run SYS.Mirror:AddDatabase. It returns %Status, check that it's ok with $$$ISOK(sc). It should be equal to 1.
  3. Dismount database on Primary (using SYS.Database:DismountDatabase) OR Freeze IRIS (Backup.General:ExternalFreeze).
  4. Copy IRIS.DAT to Backup.
  5. Mount database on Primary (using SYS.Database:MountDatabase) OR Thaw IRIS (Backup.General:ExternalThaw).
  6. Mount database on Backup.
  7. Activate database on Backup (SYS.Mirror:ActivateMirroredDatabase).
  8. Catchup database on Backup (SYS.Mirror:CatchupDB).

Please note that some methods accept db name, most accept db directory, and others db sfn. Please keep that in mind.

I dismounted, secure copied the IRIS.dat to my backup/DR and mount the Database, but when I attempt to Activate Mirror Database on the backup, I am getting the following error...

sc="0 "_$lb($lb(2073,"/ensemble/TEST/DB/TESTING/",,,,,,,,$lb(,"%SYS",$lb("e^ActivateMirroredDatabase+3^SYS.Mirror.1^2","e^^^0"))))/* ERROR #2073: Mirrored Database '/ensemble/TEST/DB/TESTING/' is not found on this system */
 

but it shows that the database has been mounted in the Terminal.