A Commentary, Critical, Practical, and Explanatory on the Old and New Testaments, by Robert Jamieson, A.R. Fausset and David Brown [1882] at sacred-texts.com
lifted me up--as one is drawn from a well (Psa 40:2).
healed me--Affliction is often described as disease (Psa 6:2; Psa 41:4; Psa 107:20), and so relief by healing.
The terms describe extreme danger.
soul--or, "myself."
grave--literally, "hell," as in Psa 16:10.
hast kept me . . . pit--quickened or revived me from the state of dying (compare Psa 28:1).
remembrance--the thing remembered or memorial.
holiness--as the sum of God's perfections (compare Psa 22:3), used as name (Exo 3:15; Psa 135:13).
Relatively, the longest experience of divine anger by the pious is momentary. These precious words have consoled millions.
What particular prosperity is meant we do not know; perhaps his accession to the throne. In his self-complacent elation he was checked by God's hiding His face (compare Psa 22:24; Psa 27:9).
troubled--confounded with fear (Psa 2:5).
As in Psa 6:5; Psa 88:10; Isa 38:18, the appeal for mercy is based on the destruction of his agency in praising God here, which death would produce. The terms expressing relief are poetical, and not to be pressed, though "dancing" is the translation of a word which means a lute, whose cheerful notes are contrasted with mourning, or (Amo 5:16) wailing.
sackcloth--was used, even by kings, in distress (Ch1 21:16; Isa 37:1) but "gladness," used for a garment, shows the language to be figurative.
Though "my" is supplied before "glory" it is better as in Psa 16:9, to receive it as used for tongue, the organ of praise. The ultimate end of God's mercies to us is our praise to Him.