How can I experiment on a production kdb while keeping the data free from accidental damage?

Use the -b command line argument to start kdb in read only mode, or start up with a negative port number.

one can verify the read-only mode by examining the return value of function _

$ q -b
KDB+ 2.7 2011.02.16 Copyright (C) 1993-2011 Kx Systems
...
q)\_
1
q)