20 pts.
 Lost my SQL log
SQL statements from a session (first session) have been lost because I opened a second SQL session and saved this when exiting AFTER exiting my first session. So, when I STRSQL, I only see the statements from my second session, those from the first session are gone. Can I somehow retrieve the statements from my first session?

Software/Hardware used:
System i
ASKED: March 12, 2013  9:23 AM
UPDATED: March 12, 2013  12:49 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,390 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The basic process used by the system is described in Using an existing SQL session. The actual saving of a session is done in a space object in library QRECOVERY. These objects get created by iSQL for each user who exits iSQL and chooses to save a session.
 
Normally you can’t see any of these objects because they aren’t external objects. They require MI functions to access and manipulate. There is one external function you can use, though, to see them and what they contain, the DMPSYSOBJ command.
 
Run this command to dump your set of iSQL objects to a spooled file:

DMPSYSOBJ OBJ(ISQLSTmyuserid*) CONTEXT(QRECOVERY) TYPE(19) SUBTYPE(EE)

Replace “myuserid” with your user profile name and use an asterisk for generic name format.
 
The spooled output should show one or more dumped objects. Each one will have a name consisting of “ISQLST” in the first six characters, your user ID in the next ten characters (padded with blanks), a device name in the next ten characters (also padded if needed), and probably four zeros in the final four characters. Internal names are 30-characters long.
 
From the dump, you can see how many different sessions you have saved and which devices they are associated with. You can search the spooled file with “ISQLST” to find the beginning of each session. Each one will have a device name you can use to sign on to (if there is more than one).
 
Locate the session that you want to recover. Sign on to the associated device, and it should show up in iSQL. If no such session can be found, then it cannot be recovered; it’s gone.
 
If you find two saved sessions and want to keep only one of them, sign on to the device you want to get rid of, go into iSQL, and exit the session without saving. (You can save it into a source member if you want a copy.) Do this for any extra sessions that you want gone, if there are more than two.
 
Once the extra session is gone, only the single session you want will remain. It will then be the one that shows up no matter where you sign on, unless you start iSQL sessions on two devices at the same time and save again. That will again create multiple sessions and require signing on to matching devices.
 
Note that using named devices can make this easier.
 
Tom

 107,845 pts.

 

I added a comment that describes this, but it’s not showing up. Perhaps it’ll appear in the morning. — Tom

 107,845 pts.

 

Brilliant! Thanks Tom a great help and yes, I got my statements back.
usuala

 20 pts.