Cisco DCNM Fundamentals Configuration Guide, Release 4.1
Maintaining the DCNM Database
Downloads: This chapterpdf (PDF - 153.0KB) The complete bookPDF (PDF - 6.63MB) | Feedback

Maintaining the DCNM Database

Table Of Contents

Maintaining the DCNM Database

Information About Database Maintenance

Automatic and Manual Purging of Data

Database Backup

Database Clean

Database Restore

Licensing Requirements for Database Maintenance

Prerequisites for Database Maintenance

Guidelines and Limitations for Database Maintenance

Performing Database Maintenance

Backing Up the DCNM Database

Cleaning a DCNM Database

Restoring a DCNM Database from a Backup File

Additional References

Related Documents

Standards


Maintaining the DCNM Database


This chapter describes how to maintain the Cisco Data Center Network Manager (DCNM) database.

This chapter includes the following sections:

Information About Database Maintenance

Licensing Requirements for Database Maintenance

Prerequisites for Database Maintenance

Guidelines and Limitations for Database Maintenance

Performing Database Maintenance

Additional References

Information About Database Maintenance

Cisco DCNM uses a PostgreSQL database to store all data, including configuration information from managed devices, events and statistical data gathered from managed devices, and DCNM user information. In addition to PostgreSQL tools for performing database maintenance, DCNM provides features to help you delete events and statistical data that you no longer need.

This section includes the following topics:

Automatic and Manual Purging of Data

Database Backup

Database Clean

Database Restore

Automatic and Manual Purging of Data

You can use the Auto-Synchronization with Devices feature to delete unwanted event data and the Statistical Data Collection feature to delete unwanted statistical data. DCNM supports automatic purging of both types of data. You can configure the following aspects of automatic data purging:

Days of the week and time of day that automatic purging occurs.

Whether DCNM determines which data to purge by the age of the data or by a maximum number of database entries.

We recommend that you configure automatic purging of events and statistical data to ensure that the DCNM database size does not grow too large.

You can also manually purge events and statistical data.

For more information, see the following sections:

Automatic and Manual Purging of Event Data, page 15-2

Automatic and Manual Purging of Statistical Data, page 16-2

Database Backup

You can use the PostgreSQL pg_dump command to create a backup file of the DCNM database. We strongly recommend that you regularly back up the DCNM database and that you archive backup files in a secure location that is not on the DCNM server system. Retain the backup files as long as required by the standards of your organization.

Database Clean

You can use the PostgreSQL psql command to clean the DCNM database. Cleaning removes all DCNM data from the database and is a necessary step prior to restoring the DCNM database. Any database records that have not been backed up are lost when you clean the database.

You can also clean the database if you want to delete all data and rebuild your DCNM implementation without restoring data from a backup.

Database Restore

You can use the pg_restore command to restore the DCNM database from a backup file. The backup file must have been created from the same release of DCNM that you are restoring it to. For example, if you are running Cisco DCNM Release 4.1(2), you should only perform database restoration from a backup of DCNM Release 4.1(2).

Before you restore a DCNM database, you should clean the database. Restoring a database without cleaning the database can have unpredictable results.

Licensing Requirements for Database Maintenance

The following table shows the licensing requirements for this feature:

Product
License Requirement

DCNM

Database maintenance requires no license. Any feature not included in a license package is bundled with the Cisco DCNM and is provided at no charge to you. For information about obtaining and installing a DCNM LAN Enterprise license, see the "Installing Licenses" section on page 2-7.


Prerequisites for Database Maintenance

Database maintenance has the following prerequisites:

You must have successfully installed the DCNM server.

Cleaning the DCNM database requires that you stop the DCNM server.

Restoring the DCNM database requires the following:

You must have a backup file created from the exact same release of Cisco DCNM that you are restoring with the backup file.

You must clean the DCNM database before you restore it.

Guidelines and Limitations for Database Maintenance

Database maintenance has the following configuration guidelines and limitations:

We recommend that you configure automatic purging of statistical data and event data to ensure that the DCNM database size does not grow too large.

We recommend that you perform backups on a regular basis. Follow the standards of your organization to determine how frequently you should perform backups.

You can only restore a DCNM database from a backup of the same exact release of DCNM. For example, if you are running Cisco DCNM Release 4.1(2), you should only perform database restoration from a backup of DCNM Release 4.1(2).

Before you restore a DCNM database, you must clean the database first.

Performing Database Maintenance

This section includes the following topics:

Backing Up the DCNM Database

Cleaning a DCNM Database

Restoring a DCNM Database from a Backup File

Backing Up the DCNM Database

You can back up the DCNM database.

BEFORE YOU BEGIN

Make sure that you know the following information:

Name of the PostgreSQL user that DCNM uses to access the database. The default PostgreSQL username that the DCNM server installer uses is dcnmuser.

Name of the PostgreSQL database that DCNM uses. The default PostgreSQL database name that the DCNM server installer uses is dcnmdb.

Both the PostgreSQL username and database name are configurable during the DCNM server installation.

DETAILED STEPS

To back up the DCNM database, follow these steps:


Step 1 On the DCNM server, access a command prompt.

Step 2 Use the cd command to change directory to the bin directory under the PostgreSQL installation directory, as follows:

cd path

where path is the relative or absolute path to the bin directory. For Windows, the default path to the PostgreSQL bin directory is C:\Program Files\PostgreSQL\8.2\bin.

Step 3 Use the pg_dump command to back up the database.

On RHEL 4 AS, do the following command:

./pg_dump -i -h localhost -p 5432 -U dcnmuser -F c -b -f ./backup_file dcnmdb

On Windows Server 2003, use the following command:

pg_dump.exe -i -h localhost -p 5432 -U dcnmuser -F c -b -f .\backup_file dcnmdb

where

dcnmuser is the PostgreSQL username that DCNM uses to access the database

dcnmdb is the name of the PostgreSQL database that DCNM uses

backup_file is the backup filename that you want to use

The pg_dump command creates the backup file that you specify.

Step 4 Verify that the backup file was created as you specified and has a file size greater than zero.

On RHEL 4 AS, use the ls -l command.

On Windows Server 2003, use the dir command.

Step 5 Store the backup file in a safe location. We recommend that you copy the backup file to a secure location that is off the DCNM server system so that you can protect your data from the potential of a catastrophic hardware failure.


Example

The following example from a Windows server shows how to create a backup named masterbackup.bkp from a DCNM database that was installed using default values:

C:\Documents and Settings\Administrator>cd "C:\Program Files\PostgreSQL\8.2\bin"

C:\Program Files\PostgreSQL\8.2\bin>pg_dump.exe -i -h localhost -p 5432 -U dcnmuser -F c 
-b -f .\masterbackup.bkp dcnmdb

C:\Program Files\PostgreSQL\8.2\bin>dir masterbackup.bkp
 Volume in drive C has no label.
 Volume Serial Number is D415-F632

 Directory of C:\Program Files\PostgreSQL\8.2\bin

12/15/2008  01:53 PM           900,129 masterbackup.bkp
               1 File(s)        900,129 bytes
               0 Dir(s)  23,960,858,624 bytes free

C:\Program Files\PostgreSQL\8.2\bin>

Cleaning a DCNM Database

You can clean the DCNM database, which deletes all data from the DCNM database. You may want to clean the database for the following reasons:

You want to restore the DCNM database from a backup.

You want to delete all data and rebuild your DCNM implementation without restoring data from a backup.

BEFORE YOU BEGIN

Back up the DCNM database. Any data not preserved in a backup is lost when you clean the database.

Stop the DCNM server. The DCNM server must be down before you can finish the database cleaning procedure. For detailed steps, see the "Stopping the DCNM Server" section on page 2-14.

Make sure you know the following information:

Name of the PostgreSQL user that DCNM uses to access the database. The default PostgreSQL username that the DCNM server installer uses is dcnmuser.

Name of the PostgreSQL database that DCNM uses. The default PostgreSQL database name that the DCNM server installer uses is dcnmdb.

Both the PostgreSQL username and database name are configurable during the DCNM server installation.

DETAILED STEPS

To clean the DCNM database, follow these steps:


Step 1 On the DCNM server, access a command prompt.

Step 2 If you have not already done so, stop the DCNM server. For detailed steps, see the "Stopping the DCNM Server" section on page 2-14.

Step 3 Use the cd command to change directory to the bin directory under the PostgreSQL installation directory, as follows:

cd path

where path is the relative or absolute path to the bin directory. For Windows, the default path to the PostgreSQL bin directory is C:\Program Files\PostgreSQL\8.2\bin.

Step 4 Use the psql command to clean the DCNM database.

On RHEL 4 AS, use the following command:

./psql -h localhost -U dcnmuser dcnmdb -c "drop schema public cascade; create schema public authorization dcnmuser; grant all on schema public to dcnmuser;"

On Windows Server 2003, use the following command:

psql.exe -h localhost -U dcnmuser dcnmdb -c "drop schema public cascade; create schema public authorization dcnmuser; grant all on schema public to dcnmuser;"

where

dcnmuser is the PostgreSQL username that DCNM uses to access the database

dcnmdb is the name of the PostgreSQL database that DCNM uses


Tip If you installed the DCNM server using the default values for the PostgreSQL username and database name, you can use the command for your operating system exactly as it appears in this step.


The psql command cleans the DCNM database.

Step 5 If you want to restore the DCNM database from a backup, proceed to the "Restoring a DCNM Database from a Backup File" section. Do not start the DCNM server.

If you do not want to restore the DCNM database from a backup and want to rebuild your DCNM implementation manually, start the DCNM server. See the "Starting the DCNM Server" section on page 2-6.


Example

The following example from a Windows server shows how to clean the DCNM database that was installed using default values:

C:\Documents and Settings\Administrator>cd "C:\Program Files\PostgreSQL\8.2\bin"

C:\Program Files\PostgreSQL\8.2\bin>psql.exe  -h localhost -U dcnmuser dcnmdb -c "drop 
schema public cascade; create schema public authorization dcnmuser; grant all on schema 
public to dcnmuser;" 
NOTICE:  drop cascades to sequence hibernate_sequence
NOTICE:  drop cascades to sequence dcmraweventtable_sequence
NOTICE:  drop cascades to sequence configarchivetask_sequence
.
.
.
NOTICE:  drop cascades to table acl_routemapmatchcondition
GRANT

C:\Program Files\PostgreSQL\8.2\bin>

Restoring a DCNM Database from a Backup File

You can restore the DCNM database from a backup file.

BEFORE YOU BEGIN

Clean the DCNM database before restoring the database. Restoring a database without cleaning the database can have unpredictable results.

Do not restart the DCNM server after cleaning the database. The DCNM server must be stopped while you are restoring the database.

Locate the backup file that you want to use to restore the DCNM database.

DETAILED STEPS

To restore the DCNM database from a backup file, follow these steps:


Step 1 On the DCNM server, access a command prompt.

Step 2 If you have not already done so, clean the DCNM server. For detailed steps, see the "Cleaning a DCNM Database" section.

Step 3 Use the cd command to change directory to the bin directory under the PostgreSQL installation directory, as follows:

cd path

where path is the relative or absolute path to the bin directory. For Windows, the default path to the PostgreSQL bin directory is C:\Program Files\PostgreSQL\8.2\bin.

Step 4 Use the pg_restore command to restore the DCNM database.

On RHEL 4 AS, use the following command:

./pg_restore -i -h localhost -U dcnmuser -d dcnmdb --disable-triggers -v path/backup_file

On Windows Server 2003, use the following command:

pg_restore.exe -i -h localhost -U dcnmuser -d dcnmdb --disable-triggers -v path\backup_file

where

dcnmuser is the PostgreSQL username that DCNM uses to access the database

dcnmdb is the name of the PostgreSQL database that DCNM uses

path is the relative or absolute path to the directory that contains the backup file

backup_file is the filename of the backup filen that you want to use

The pg_restore command restores the DCNM database from the backup file that you specified.

Step 5 To resume using DCNM, start the DCNM server. See the "Starting the DCNM Server" section on page 2-6.


Example

The following example from a Windows server shows how to restore a DCNM database that was installed using default values and using a backup file named masterbackup.bkp that exists in the bin directory under the PostgreSQL installation directory:

C:\Documents and Settings\Administrator>cd "C:\Program Files\PostgreSQL\8.2\bin"

C:\Program Files\PostgreSQL\8.2\bin>pg_restore.exe -i -h localhost -U dcnmuser
-d dcnmdb --disable-triggers -v .\masterbackup.bkp
pg_restore: connecting to database for restore
pg_restore: creating SCHEMA public
pg_restore: creating PROCEDURAL LANGUAGE plpgsql
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 690; 2612 16386 PROCEDURAL LANG
UAGE plpgsql cisco
pg_restore: [archiver (db)] could not execute query: ERROR:  language "plpgsql"
already exists
    Command was:
CREATE PROCEDURAL LANGUAGE plpgsql;
pg_restore: creating TABLE aaaserver
pg_restore: creating TABLE aaaserveraccountingstatistics
.
.
.
pg_restore: setting owner and privileges for FK CONSTRAINT fkffd7881ced1bee31
WARNING: errors ignored on restore: 1

C:\Program Files\PostgreSQL\8.2\bin>

Additional References

For additional information related to maintaining the DCNM database, see the following sections:

Related Documents

Standards

Related Documents

Related Topic
Document Title

Automatic purge of event data

Chapter 10, "Managing Events"

Automatic purge of statistical data

Chapter 16, "Administering Statistical Data Collection"


Standards

Standards
Title

No new or modified standards are supported by this feature, and support for existing standards has not been modified by this feature.