1

I want to know the size of a marklogic db backup file using xdmp function ? is there any xdmp function which can be used ?

Aviator
  • 543
  • 1
  • 4
  • 10

1 Answers1

3
declare namespace forest = "http://marklogic.com/xdmp/status/forest";
declare function local:backup-size($db as xs:string)
  as xs:decimal
{
  for $forests in xdmp:forest-status(xdmp:database-forests(xdmp:database($db)))
  let $backup-b := sum($forests/forest:backup-write-bytes)
  return $backup-b
};
fn:concat("Database backup size is: ", local:backup-size("db-name"), " Bytes")

Note: Adjust the XQuery to include or exclude replica

Fiona Chen
  • 1,358
  • 5
  • 16