It’s 4:59 PM on a Friday. Outside your office window the sun is shining. Down at the local football stadium, your friends have already got their seats and they’ve messaged you several times, wondering when you’ll be there.
Unfortunately, the diagnostic queries you started running on your database system this morning still haven’t finished. What’s more, IT is planning downtime for all the machines in the office on Saturday.
Looks like you’ll have to miss the game while you wait for your queries to complete.
At least, that’s what would have happened in back when you were using SAP HANA studio to administer your databases. Last week, though, you made the switch to SAP HANA database explorer and you remember that, unlike studio, database explorer contains the Background Activity functionality.
What are background activities?
A background activity is an operation that runs on the SAP HANA server even after you disconnect from your database and close your browsing session. The status and results of the operation are stored and can be retrieved from the Background Activity Monitor whenever you’re next connected to your database in the database explorer. The background activity feature is included in the database explorer as of version 2.0 SP 05 (2.5.37) for on-premise networks, and version 2.5.12 for cloud networks.
So how do you set a query to run as a background activity? Once you’ve entered your query into your SQL console in the database explorer, click the Run dropdown button, and then click either Run as Background Activity to run your query on a single database, or click Run on Multiple Databases to select multiple databases to run your query on.
To retrieve your query results later, connect to your database in the database explorer and click the Background Activity Monitor icon ( ) in the bottom, right-hand corner of your screen. In the background activity monitor, you’ll see the status of your query, and by double-clicking the background activity, you can view its result set. If you have run numerous background activities, then you can select either all the rows or only a few rows, and click the glasses icon to view their results.
So, after a few mouse clicks, you shut down your computer, grab your keys and head out the door, confident that your queries will complete over the weekend and the query results will be waiting for you in your Background Activity Monitor on Monday morning.
Now, if only rush-hour traffic had a similarly easy solution!
For an example of the usefulness of running activities in the background, see the blog post on database explorer’s new statement library: The SAP HANA Database Explorer Statement Library .