1

I am tring to backup a kdb+ database including all scripts and resource files. i can copy table from below command but this doesn't include scripts and dependency files. Is there any way to copy entire database of Kdb+ or available any tool for this.

copy tables command.

h:hopen hsym `$"localhost:5050"
([x;y] @[`.;y;:;] x y) [h;] each h"tables[]"
JSJ
  • 5,653
  • 3
  • 25
  • 32
  • 1
    Why are you using kdb service to copy scripts and dependency files? KDB service is not for that. Use os commands to do that. Still you want to do that then you can read files (check read0 etc) in variables and then save them. – Rahul May 18 '15 at 11:25

1 Answers1

1

You can save and load contexts (taken from http://code.kx.com/q4m3/12_Workspace_Organization/#126-saving-and-loading-contexts):

`:currentws set value `.

That will include the functions that are currently loaded. Presumably scripts are already on file.

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
Manish Patel
  • 4,411
  • 4
  • 25
  • 48
  • Thanks man it good to save context. but is there any way to save scripts as well. – JSJ May 19 '15 at 10:24
  • If you know the OS of the remote db, you could make a system call to do a copy, like `scp`. But you'd need to know what to pull. E.g. `.z.f` will give you the file the database has loaded, but that file in turn might load another script. – Manish Patel May 19 '15 at 10:35