Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
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

Comments

Kinshuk Rakshith · Jul 27, 2021

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
0
Evgeny Shvarov  Jul 27, 2021 to Kinshuk Rakshith

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?

0
Kinshuk Rakshith  Jul 27, 2021 to Evgeny Shvarov

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.

0
Vic Sun  Jul 27, 2021 to Evgeny Shvarov

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

0
Yaron Munz · Jul 27, 2021

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)

0
Lucas Fernandes · Jul 27, 2021

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()
0
Evgeny Shvarov  Jul 27, 2021 to Lucas Fernandes

Thanks, Lucas!

This is what I'm looking for!

0
James Woo  Mar 24, 2022 to Lucas Fernandes

Where can I find the Config.Database class?

Config.DatabasesConfig.Database class
0
James Woo  Mar 24, 2022 to James Woo

It's in the %SYS namespace

0
Ricardo Baehr · Mar 26, 2022

Hi!
In older versions of Caché, this command works:
Do DISABLE^%NOJRN
Do ENABLE^%NOJRN
I hope it can help you.
Hug
Rica

0