Open for Voting

Undeleting an element (node/interface/volume etc.)

A few minutes ago I accidentally deleted my backbone switch (and all the interfaces of course). Since undeleting an element (node, interface etc.) is not possible (Except restoring SQL from backup) it means that I've lost all the interface statistics, node statistics (CPU, Memory, Availability) and atlas map drawing. And this is not my first time. This is a common issue for all of us. If NPM can remember an element for a specific period of time that would be great. I think It shouldn't be that hard to implement this.

PS; Please vote these ideas also if you like them of course. And I bet you do. emoticons_happy.png

Parents
  • If you catch the issue before a nightly maintenance is run, you can re-associate the data but running this (it is for a volume, but with a little adjustment you could also do an interface):

    DECLARE @Name as nvarchar(200)

    DECLARE @SQL as nvarchar(1000)

    DECLARE @OldVolumeID as int

    DECLARE @VolumeID as int

    DECLARE @NodeID as int

    select @NodeID = NodeID from nodes where caption = '<SERVERNAME>'

    Set @OldVolumeID = <VOLUMEID>

    Set @VolumeID = <VOLUMEID>

    DECLARE CUR CURSOR FOR

        SELECT TABLE_NAME

                FROM information_schema.tables

                WHERE TABLE_NAME like 'VolumeUsage_%' and TABLE_TYPE = 'BASE TABLE'

                ORDER BY TABLE_NAME ;

    OPEN CUR

    FETCH NEXT FROM CUR INTO @NAME

    WHILE @@FETCH_STATUS = 0

      BEGIN

          SET @SQL = 'update ['+@NAME+']

                        set VolumeID = '+Cast(@VolumeID AS NVARCHAR(10))+'

                        where NodeID = '+Cast(@NodeID AS NVARCHAR(10))+' and VolumeID = '+Cast(@OldVolumeID AS NVARCHAR(10))

          --PRINT @SQL

          EXEC Sp_executesql @SQL

          FETCH NEXT FROM CUR INTO @NAME

      END

    CLOSE CUR

    DEALLOCATE CUR

Comment
  • If you catch the issue before a nightly maintenance is run, you can re-associate the data but running this (it is for a volume, but with a little adjustment you could also do an interface):

    DECLARE @Name as nvarchar(200)

    DECLARE @SQL as nvarchar(1000)

    DECLARE @OldVolumeID as int

    DECLARE @VolumeID as int

    DECLARE @NodeID as int

    select @NodeID = NodeID from nodes where caption = '<SERVERNAME>'

    Set @OldVolumeID = <VOLUMEID>

    Set @VolumeID = <VOLUMEID>

    DECLARE CUR CURSOR FOR

        SELECT TABLE_NAME

                FROM information_schema.tables

                WHERE TABLE_NAME like 'VolumeUsage_%' and TABLE_TYPE = 'BASE TABLE'

                ORDER BY TABLE_NAME ;

    OPEN CUR

    FETCH NEXT FROM CUR INTO @NAME

    WHILE @@FETCH_STATUS = 0

      BEGIN

          SET @SQL = 'update ['+@NAME+']

                        set VolumeID = '+Cast(@VolumeID AS NVARCHAR(10))+'

                        where NodeID = '+Cast(@NodeID AS NVARCHAR(10))+' and VolumeID = '+Cast(@OldVolumeID AS NVARCHAR(10))

          --PRINT @SQL

          EXEC Sp_executesql @SQL

          FETCH NEXT FROM CUR INTO @NAME

      END

    CLOSE CUR

    DEALLOCATE CUR

Children
No Data