Article
· Nov 16, 2023 2m read

How to run online backup from command

InterSystems FAQ rubric

To run an online backup from a command you can use the API BACKUP^DBACK routine.
An example of performing a full backup is as follows.

set  status = $$ BACKUP ^DBACK( "" , "F" , "full backup" , "c:\backup\full.cbk" , "Y" , "c:\backup\full-log.log" , " NOINPUT" , "Y" , "Y" , "" , "" )

The return value is 1 if the backup is successful, and 0 if the backup is unsuccessful. Please refer to the log file for details on failure.

Additionally, you can specify C for the second argument TYPE to specify a cumulative backup, and specify I to specify a differential backup.

An example routine is below.

FULL ()  public  {
    set  cbk = "c:\kit\InterSystemsFull" _ $ZDATE ( $Horolog ,8)_ ".cbk"
    set  log = "c:\kit\InterSystemsFullLog" _ $ZDATE ( $Horolog ,8) _ ".log"
    set  status = $$ BACKUP ^DBACK( "" , "F" , "full backup" , cbk , "Y" , log , "NOINPUT" , "Y" , "Y" , "" , " " )
 }
COMULATIVE ()  public  {
    set  cbk = "c:\kit\InterSystemsComupative" _ $ZDATE ( $Horolog ,8)_ ".cbk"
    set  log = "c:\kit\InterSystemsComulativeLog" _ $ZDATE ( $Horolog ,8)_ ".log"
    set  status = $$ BACKUP ^DBACK( "" , "C" , "Comulative backup" , cbk , "Y" , log , "NOINPUT" , "Y" , "Y" , " " , "" )
 }
INCREMENTAL ()  public  {
    set  cbk = "c:\kit\InterSystemsIncremental" _ $ZDATE ( $Horolog ,8)_ ".cbk"
    set  log = "c:\kit\InterSystemsIncrementalLog" _ $ZDATE ( $Horolog ,8)_ ".log"
    set  status = $$ BACKUP ^DBACK( "" , "I" , "Incremental backup" , cbk , "Y" , log , "NOINPUT" , "Y" , "Y " ,"" , "" )
 }

Please refer to the documentation for details on the DBACK routine arguments and return values.

About the BACKUP^DBACK routine

Discussion (0)1
Log in or sign up to continue