© 2024 InterSystems Corporation, Cambridge, MA. All rights reserved.Privacy & TermsGuaranteeSection 508Contest Terms
Get source data using database-level global ref
This is a tool to move a part of a global from a database to another database.
Sample repository with mirroring and ECP: global-archiver-sample
Build:
docker-compose build --no-cache
Start container :
docker-compose up -d
zpm "install global-archiver"
Create a database named “ARCHIVE”
Do ##class(lscalese.globalarchiver.sample.DataLog).CreateDB("ARCHIVE")
Open IRIS terminal:
Generate 10 000 records in a sample table.
Do ##class(lscalese.globalarchiver.sample.DataLog).GenerateData(10000)
Get the last id older than 30 days:
Set lastId = ##class(lscalese.globalarchiver.sample.DataLog).GetLastId(30)
Copy data older than 30 days to the ARCHIVE database:
Set Global = $Name(^lscalese.globalarcCA13.DataLogD)
Set sc = ##class(lscalese.globalarchiver.Copier).Copy(Global, lastId, "ARCHIVE")
Delete data from the source database:
Set sc = ##class(lscalese.globalarchiver.Cleaner).DeleteArchivedData(Global,"ARCHIVE")