Retrieving the script text for a deleted script task using a database backup


Article ID: 171167


Updated On:


Management Platform (Formerly known as Notification Server)


How to retrieve the script text for a deleted script task using a database backup?
You have accidentally deleted tasks containing useful scripts and wish to retrieve them from an available database backup.


Symantec Management Platform 8.1 RU5


Follow the steps below to get the raw item statexml and script text,

1. Restore the Symantec_CMDB database backup as a new (temporary) database.
2. Run the following SQL Query in SQL Management Studio to get a list of recently deleted items.

--List of recently deleted items.
Select * From ItemDeleted
Order By DeletedDate DESC

3. Once the item guid is known, use the following SQL Query to get the StateXML.
Click on the links in the StateXML column to see the Item State as XML.
Look for the </scriptText> tag.

--Get ItemVersionData as XML for a specific item(task).
ivd.Name [Item Name]
, iv.ItemGuid [ItemGuid]
, iv.Version [ItemVersion]
, CAST(ivd.State as xml) as [StateXML]
From ItemVersions as iv
JOIN ItemVersionData as ivd
ON iv.VersionGuid=ivd.VersionGuid
WHERE iv.ItemGuid='2cc2acf0-2166-4c76-a0a8-0d4f3c79765c'  /*Guid of the deleted script task.*/
Order By iv.Version DESC