You can use the spool device :
Set a(100)="test" Set a(100,100)="encore" Open 2 Use 2 zwrite a Close 2 The global ^SPOOL will contain the contents of the zwrite
In a simple configuration, one namespace uses one database.
But often, a namespace is a combination of a code database(=Routines), a data database (=Globals), and a bunch of mappings to other databases.
Looking at the names of your databases, it could well be the case that you need e.g. a namespace MYDATA1 which points for code and data to the database MYDATA1, and has Global Mappings for a list of specific globals to the database MYDATA1TEMP.
(You can see this list If you go to the portal -> explorer -> Globals, and select in the first combo 'databases' and the second 'MYDATA1TEMP', you should see a limited amount of globals that will probably hold temporary data which is stored seprately from you other live data.)
Ideally, the backup should also backup the file cache.cpf to get a list of the configuration of namespaces, databases, and mappings.
You can also use the open exchange solution from Lorenzo Scalese :
https://openexchange.intersystems.com/package/IO-Redirect