Question
Evgeny Shvarov · Jul 27, 2021

How to Turn Off Journalling Programmatically

I need to turn off Journalling for a particular database programmatically.

How can I make it happen?

Product version: IRIS 2020.4
2
0 346
Discussion (12)1
Log in or sign up to continue

I have used the following inside one of the classes before executing a huge ingest process.

do DISABLE^%SYS.NOJRN

Then turned journalling back on again after the ingestion was complete.

do ENABLE^%SYS.NOJRN

Thanks, Kinshuk!

This is helpful but this is a SYSTEM wide call. Do you know a way how to turn off journalling for a particular database?

Evgeny,

Fortunately, I had a simple setup and so the consequence of disabling jounalling across the system was imperceptible to me. Hoping someone else has a better answer.

Hello Evgeny,

The ^%SYS.NOJRN tags are actually not system-wide, and just at the process level. That being said, for changing the actual database journaling status, perhaps Lucas' solution makes sense.

For more info on disabling journaling, I think Tani's article series is great. Here's his chapter on some methods to disable journaling. Perhaps you'll find something useful to you now or later:

https://community.intersystems.com/post/preventing-globals-getting-journaled-continued-how-do-i-minimize-my-journals

consider also that even when you use the DISABLE^%SYS.NOJRN if you are within a transaction globals will be saved (e.g when doing a %Save() on an object).

To prevent this you may use:
$system.OBJ.SetTrandsactionMode(0) - to disable transaction
$system.OBJ.SetTrandsactionMode(1) - to enable transaction (leter)

In Caché I use this:

set path = ##class(Config.Databases).Open("USER").Directory
set database = ##class(SYS.Database).%OpenId($get(path))

do database.DisableJournaling()
set status = database.%Save()

do database.EnableJournaling()
set status = database.%Save()

Thanks, Lucas!

This is what I'm looking for!

Where can I find the Config.Database class?

Config.DatabasesConfig.Database class

It's in the %SYS namespace

Hi!

In older versions of Caché, this command works:

Do DISABLE^%NOJRN
Do ENABLE^%NOJRN

I hope it can help you.

Hug
Rica