Aviator
Aviator

Reputation: 722

How can I get size of marklogic database backup file in marklogic?

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

Upvotes: 1

Views: 72

Answers (1)

Fiona Chen
Fiona Chen

Reputation: 1368

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

Upvotes: 3

Related Questions