How to clear a Surrogate Key file using Linux

Linux - Ho to Empty Surrogate Key File

Linux – Ho to Empty Surrogate Key File

Occasionally, the question comes up about how to clear/reset the surrogate key file from the Linux command line.  It is a simple process really, but it should be done with care and, only, if you need the keys in the dimension to be reset to the beginning.   A complete reset would require:

  • The target table to be truncated and,
  • All keys in use in facts to be removed, or reset after the fact, and/or the table truncated and reloaded,
  • The Surrogate Key file emptied, and
  • The ETL rerun.

Basic Command

  • cat /dev/null > <<FileName>>

Example Command

  • cat /dev/null > Season.srky

Related Links