Using the compactdb() method, Removing network databases – Echelon LNS User Manual
Page 269
LNS Programmer's Guide
255
recommends that you perform the database validation while a minimal number of client
applications are connected to the database. One suggested approach is to backup the
database and restore it with a different name and location, and perform the validation on
this restored database. This approach will minimize the disruption caused by the
validation, and has the benefit of producing a backup whose validity is known.
While the new LNS database validation feature described in the previous section can be
used to repair many of the errors that may occur in your network databases, you should
not consider this feature a replacement for consistently backing up your network
databases. Echelon strongly recommends regularly backing up and validating the LNS
database, to ensure that there is always a recent, valid database backup to fall back upon
in the event of database or file system failure or recovery from user error. See the
Backing Up Network Databases section earlier in this chapter for guidelines on this.
Using the CompactDb() Method
You can also use the CompactDb() method to help maintain your network databases.
When you call CompactDb() on the ObjectServer object, LNS will defragment and
reindex the global database. When you call CompactDb() on a Network object, LNS will
defragment and reindex the network database. Defragmenting and reindexing a
database might result in smaller database size, and might improve performance of LNS
applications that access that database. If database errors are generated when you open a
network, it may indicate there are indexing problems on the network database that can
be resolved via the CompactDb() method.
You should not perform these operations on a database that is open and in use by any
client application. In addition, you should backup all databases before calling this
method and your PC should have at least twice as much free disc space as the size of the
database when you call this method.
Removing Network Databases
To remove a network database that is no longer needed, and to recover all LNS Device
Credits that are currently consumed by that network, you need to delete the network from
the LNS global database. To do so, follow these steps:
1. Open the system using a valid network interface. Set the system
management mode to lcaMgmtModePropagateConfigUpdates. This
will allow you to recover the LNS Device Credits used to install the
network. You will lose the LNS Device Credit used to install any
application device that is still commissioned when the network is deleted.
For more information on LNS Device Credits, see Chapter 13.
MySystem.MgmtMode=lcaMgmtModePropagateConfigUpdates
2. Call
the
Decommission() method on each AppDevice and Router
object in your network (except those AppDevice objects that represent
Network Service Devices).
You should decommission all applicable AppDevice objects first, and
then decommission all Router objects. This prevents decommissioned
routers from blocking access to application devices that have not yet been
decommissioned.