It depends on the database. The embedded db files (rrd4j, mapdb, etc) are stored in userdata/persistence. For other dbs like MySQL and InfluxDB you will have to look at how to backup and restore for that db. I do know that InfluxDB and PostgreSQL store their db files in /var/lib.
If you are on a recent OH (2.2) there are backup and restore scripts in /usr/share/openhab2/bin (I think) that you should use.
But, if you are sticking to the same version of OH and just upgrading openHABian then the following should work.
Create backups of /etc/openhab2 and /var/lib/openhab2 and move them off the SD card
Download the latest openHABian to a new SD card and follow the instructions for a new openHABian install.
In openhabian-config make sure to configure samba to share all the OH files (I forget what menu and my little test machine is offline).
Copy the backup of /etc/openhab2 to //openhabian/config (or something like that)
Copy the backup of /var/lib/openhab2 to //openhabian/userdata (or something like that)
All the addons installed through Karaf or PaperUI end up in userdata. By copying userdata over completely you will get all the addons. Note that this only works if you are moving to the same version of OH. If you are moving to a new version then you need to reinstall the addons and the above procedure won’t work.
If you want to manage your addons through text config instead of PaperUI et al you cna use conf/services/addons.cfg.
Depends on the binding. Some bindings have a well defined and documented way to create Things in .things files (e.g. Astro). Others do not. For example, to use .things files with Zwave you need to use the development version of the binding and you have to troll through the forum to find the syntax for the Things. Support for text based Things is not yet supported in the officially released binding or even in the snapshot.