Journal.Restore
class Journal.Restore extends %Library.RegisteredObject
Example 1 (Restore everything in selected journal files of current InterSystems IRIS instance):s RestOref=##class(Journal.Restore).%New() s RestOref.FirstFile="20100107.001" s RestOref.LastFile="20100107.002" s Status=RestOref.Run()
s RestOref=##class(Journal.Restore).%New() s RestOref.FirstFile="/another_system/20100107.001" ;copied from another InterSystems IRIS instance s RestOref.LastFile="/another_system/20100107.002" ;copied from another InterSystems IRIS instance s RestOref.JournalLog="/another_system/journal.log" ;copied from another InterSystems IRIS instance d RestOref.UseJournalLocation("/another_system") ;and so on (where to locate journal files) s Status=RestOref.CheckJournalIntegrity(1) ;to populate property 'SourceDatabases' with database paths collected from the journal files to be restored s key="" for { s SourceDatabase=RestOref.SourceDatabases.GetNext(.key) q:key="" w !,SourceDatabase," => " r TargetDatabase s Status=RestOref.RedirectDatabase(SourceDatabase,TargetDatabase) s Status=RestOref.SelectUpdates(SourceDatabase,GlobalName1) s Status=RestOref.SelectUpdates(SourceDatabase,GlobalName2) ;and so on } s Status=RestOref.Run()
Property Inventory
- AbortOnDatabaseError
- AbortOnJournalError
- DisableJournaling
- Dismount
- Filter
- FirstFile
- JournalLocation
- JournalLog
- LastFile
- MarkerTrigger
- RollBack
- SourceDatabases
- StartPosition
- SwitchOnCurrentJournal
Method Inventory
- %OnClose()
- %OnNew()
- CheckJournalIntegrity()
- RedirectDatabase()
- Run()
- SelectUpdates()
- UseJournalLocation()
Parameters
fromrest is set by the caller of journal restore utility to indicate the type of journal restore (or the type of the caller). For example, ^JCONVERT sets fromrest=8 to instructs journal restore to write out the updates to a file instead of applying them to databases. Some types of restore have their own parameters (e.g., the path of an output file for fromrest=8), so a subclass for each type seems logical.
^JRNRESTO sets fromrest=0, which is the default here.
Properties
If journal restore is aborted, databases will be left in a self-consistent state as of the record that caused the restore to be aborted. Parallel dejournaling will be disabled with this setting; otherwise, affected database(s) may not be self-consistent and will need to be recovered separately.
Required if JournalLog has a non-default value.
Default: the journal history log of local InterSystems IRIS instance.
Set JournalLog=-1 to override the default without specifying a journal log.
Default: the last journal file listed in the journal history log given by JournalLog
This is necessary if DisableJournaling is NO, as otherwise the applied updates will be journaled in the file that will be dejournaled, resulting in data integrity issues.
Even if DisableJournaling is YES, it is still a good practice to switch journal file so that new updates will go into the new file.
Methods
The return value of this method is ignored.
If this method returns an error then the object will not be created.
It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:
Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.
Scan
- 0: look for missing files and inconsistent journal end offsets;
- 1: also collect a list of database directories in the selected journal files and store them in SourceDatabases;
- 2: also perform a more thorough (and more time-consuming) check by going through every record in the selected journal files, which could detect corruptions in the middle of a journal file that would otherwise go unnoticed until the read restore.
Note that for database redirection to take effect, you must also call SelectUpdates() for each database to be restored, even if you intend to have all databases restored.
This method can be called before or after the SelectUpdates() calls.
See SelectUpdates() on how to ensure the SourceDatabase argument is in a proper form.
If GlobalName is not specified, all globals in SourceDatabase will be restored, unless you also call SelectUpdates(SourceDatabase,GlobalName) (before or after the call without GlobalName), in which case only the specified global(s) are restored.
GlobalName must begin with an alpha, "%", "*" or "?", followed by alphanumerics and "*?."s ("." for dot syntax).
You must make sure the 'SourceDatabase' argument is in the canonical form acceptable to journal restore. One way to ensure that is illustrated in Example 2 at the beginning of the class document, that is, by calling CheckJournalIntegrity() with 1 to have SourceDatabases populated with database paths collected from the journal files to be restored.
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()