pw database

Note

Use a local file system because pw database commands do not support NFS-mounted file systems.

To view help information, run the following command:

pw database

Note

This command will not work if Infrastructure Management is installed with an Oracle database.

pw database archive

The pw database archive command archives your BMC TrueSight Infrastructure Management Server database by storing a snapshot of the database and transaction log files in the specified archive directory. After completion, the original transaction log is pruned. This procedure is performed without interruption of data collection or any proactive processes. The archive directory can be specified as an input parameter or specified interactively. The default archive directory is InstallationDirectory/pw/dbarchive.

If you run this command and the specified directory exists, the directory is overwritten without warning.

Note

This command sends an alert email if the specified path does not have enough disk space to archive the database.

To save the backup directory, complete this procedure and then rename the directory.

  • Example for (UNIX or Linux): cp /usr/pw/dbarchive /usr/pw/dbarchive01
  • Example for (Windows): copy C:\Program Files\BMC Software\Infrastructure Management\pw\dbarachive C:\Program Files\BMC Software\Infrastructure Management\pw\dbarachive01

Archiving the database is as part of regular maintenance is highly recommended. doing so provides a measure of safety against hardware failure or administrative errors.Also, because this command performs the important additional function of pruning the transaction log, it is recommended that the pw database archive command be run at least once every week. If the database is not archived periodically, the transaction log can grow to an enormous size.

The pw database archive command enables an argument for the location of the archive file. This command is necessary for optimal system performance. The command truncates the database transaction log and keeps a copy of the database for emergency backup retrieval. It is recommended that this archive be executed on a different disk.

Example of pw database archive with a command-line argument

pw database archive /tmp/archive

Example of pw database archive without a command-line argument

pw database archive
About 49MB free disk space is needed to archive the database.
/datadisk/EUGEN has sufficient space for database archival.
Do you want to specify another location to archive data?(y/n)[default is n]: y
Checking filesystems to archive Infrastructure Management ...
Following filesystems have diskspace greater than 49MB.
--------------------------------------------------
 Filesystem Available DiskSpace
/ 38MB
/datadisk      7697MB
/export/home    6379MB
 Enter the archive directory for Infrastructure Management [default is '/datadisk']. 

To archive the TrueSight Infrastructure Management Server database

At the command line-interface, enter the following command:
pw database archive [<archive directory>]

If <archive directory> is specified, the command runs without prompting the user for any additional inputs. If <archive directory> is not specified, then the user is prompted to specify the archive directory and then the command proceeds to complete the archive.

The archive job requires enough disk space, excluding the disk space occupied by the current archive and transaction log.

The existing archive and transaction log are temporarily stored before the archive job starts, and are deleted on successful completion of the backup process. In case the archive job fails due to any reason, such as insufficient disk space and so on, the original files are restored so that there is no data loss.

pw database archive is part of weekly jobs. The database backup is taken on a weekly basis by a job scheduler using pw database archive

Notes

  • If the default active directory (/usr) cannot be specified with the pw database archive command, specify another directory.
  • Do not run the pw database archive command in a disaster recovery environment. For more information see the Knowledge Article KA348890.

To make an incremental backup of the database

An incremental backup makes a copy of the transaction log only. An incremental backup stores all changes since the last FULL or INCREMENTAL backup.

At the command-line interface, enter the following command:
pw database archive -inc

A snapshot of the transaction log file is stored in the FULL_BACKUP_DIR/incremental directory.
FULL_BACKUP_DIR is the directory where complete database file backup copies are stored. The backup directory is specified while making a full backup of the database using the following command:
pw database archive[<archive directory>][send-email]

The full backup location is stored in a text file BackupLocation in the /usr/pw directory on UNIX or Linux or the Installation_Directory\pw directory on Microsoft Windows. The list of incremental backup files generated is stored in FULL_BACKUP_DIR/IBFiles for reference.

Incremental backup of the database as part of regular maintenance is recommended to incremental backups provide a measure of safety against hardware failure or administrative errors.

Details of files related to the database archive restore

  • storm_<hostname>.db — The database where Infrastructure Management related data is stored, located in the InstallationDirectory\pw\dbarchive directory on Microsoft Windows or the /usr/pw/dbarchive directory on UNIX or Linux.
  • pronto.log — The current transaction log file. This file contains the database transactions after the last incremental or full backup and is present in the /usr/pw/sybase directory.
  • Incremental — The directory where all the incremental backup files are stored, located in the InstallationDirectory\pw\dbarchive -directory on Microsoft Windows or the /usr/pw/dbarchive directory on UNIX or Linux. Incremental backup is made on a daily basis. The new incremental backup file will be of the form YYMMDDXX.log, where YYMMDD is the year, month, and day the log was generated, and XX ranges from AA to ZZ. For example, 070129AB.log.
  • IBFiles — A plaintext file that stores the list of incremental backup files. This file is located in the Installation_Directory\pw\dbarchive directory on Microsoft Windows or the /usr/pw/dbarchive directory on UNIX or Linux. Whenever you make an incremental backup, this file is appended with the name of the new incremental backup file created.
  • BackupLocation — The plain text file that stores the location of the full backup of the database. This file is located in the InstallationDirectory\pw\dbarchive directory on Microsoft Windows or the /usr/pw/dbarchive directory on UNIX or Linux.

    Note

    Do not edit the BackupLocation file manually. Whenever a full backup is made, the contents of this file and all existing incremental backup files are deleted.

pw database restore

Note

  • Running the pw database restore command stops all BMC TrueSight Infrastructure Management Server processes. After the restore operation is executed successfully, all BMC TrueSight Infrastructure Management Server processes are started.
  • If the pronto.log transaction log file is moved from the InstallationDirectory\pw\sybase directory on Microsoft Windows or the /usr/pw/sybase directory on UNIX or Linux, restart BMC TrueSight Infrastructure Management Server and make a full backup of the database.
  • The pw database restore command will make a copy of pronto.log and storm_<hostname>.db file in the default location, InstallationDirectory\pw\dbrestore directory on Microsoft Windows or the /usr/pw/dbrestore directory on UNIX or Linux, for secured restore process.
  • The pw database restore command must be executed after taking valid backup of the database. If the command is executed without valid backup, in the designated archive directory, then the command can fail and can give spurious errors.

Restoring the database without using incremental backup files

Microsoft Windows

Run the following command to restore the database by using only the full backup files from the directory InstallationDirectory\pw\dbarchive without applying the incremental backup files:

pw database restore -full

Example:

This command restores the storm_<hostname> and pronto.log files from the InstallationDirectory\pw\dbarchive directory to InstallationDirectory\pw\sybase directory. The command will not apply incremental backup files while restoring the database.

C:\ProactiveNet>pw database restore -full

Restoring data can take a long time for a large system.
This requires that data collection be shut down temporarily while this operation takes place.
Continue(y/n)[Default is 'n']?y
pw database restore used with the \-full option will use only the last full backup file for restoration and will delete the incremental backups.
Copy all incremental backup files because pw database restore \-full utilizes only the full back-up file for restoration, deleting all incremental backups.
Do you want to continue? \[Default is Y\] y
 Stopping Infrastructure Management Server...
  Successfully stopped Infrastructure Management Server...
Restoring the database only using the full backup files.
Backup directory specified: C:\ProactiveNet\pw\dbarchive
Removing the existing database file storm_cluster2.db and the transaction log pronto.log
Restoring ProactiveNet Data to C:\ProactiveNet\pw\sybase, please wait ...done.
Database Restored.
Stopping Infrastructure Management Server...
Starting Infrastructure Management Server...
Successfully brought up Infrastructure Management Server...
It is recommended to take backup of the database, as the older one appears to be corrupted. Do you want to take a backup now? \[default is 'y'\]?:y
About 32 MB free disk space is needed to archive the database
Taking backup of the database and the transaction log ..
Backup Completed
Backup Directory is C:\ProactiveNet\pw\dbarchive

UNIX or Linux

Run the following command to restore the database by using only the full backup files from the /usr/pw/dbarchive directory without applying the incremental backup files:

pw database restore -full

Example:

This operation restores the storm_<hostname> & pronto.log files from the /usr/pw/dbarchive directory to the /usr/pw/sybase directory. The operation will not apply incremental backup files while restoring the database.

bash-2.03# pw database restore -full

Restoring data can take a long time for a large system.
This requires that data collection be shut down temporarily while this operation takes place.
Continue(y/n)\[default is 'n'\]?:y
Shutting down current ProactiveNet processes ... done.
Restoring the database only using the full backup files.
Back directory specified: /usr/pw/dbarchive
Removing the existing database file storm_malpe.db and the transaction log pronto.log
Restoring ProactiveNet data to /usr/pw/sybase, please wait ...
done. Database Restored.
Starting ProactiveNet processes ...
Taking the full backup to /usr/pw/dbarchive after restoring the database.
About 46MB free disk space is needed to archive the database.
Taking backup of the database and the transaction log ...
Backup Completed.

Archive log file is relocated at /usr/pw/pronto/logs/dbarchive.log for administration.

Restore log file is relocated to /usr/pw/pronto/logs/dbrestore.log for administration.

Note

Restoring the database removes all group-related relationships for existing Interface MIB monitor instances.

Restoring the database by using incremental backup files

Run the following command to restore the database by applying the incremental backup files to the copy of the full backup file:

pw database restore

This command restores the database with the last full backup database and incremental backup files available.

The location of the full backup file is obtained from /usr/pw/BackupLocation for UNIX or Linux operating systems and InstallationDirectory\pw\dbarchive for Windows. The incremental backup files present in the incremental subdirectory are applied to the full backup copy of the database.

Example (Windows):

C:\ProactiveNet>pw database restore

Restoring data can take a long time for a large system.
This requires that data collection be shut down temporarily while this operation takes place. Continue(y/n)\[default is 'n'\]?:y
Backup Directory is C:\ProactiveNet\pw\dbarchive
Stopping Infrastructure Management Server...
Successfully stopped Infrastructure Management Server...
About 32 MB free disk space is required to restore the database. Following log files are required to restore the db.
070427AA.log
070427AB.log
070427AC.log
Applying last Full Backup transaction log file...
Applied last Full Backup transaction log file successfully
Do you want to apply the incremental log file 070427AA.log?\[Default is Y\]:y
Applied log file 070427AA.log successfully
Do you want to apply the incremental log file 070427AB.log?\[Default is Y\]:y
Applied log file 070427AB.log successfully
Do you want to apply the incremental log file 070427AC.log?\[Default is Y\]:y
Applied log file 070427AC.log successfully
Do you want to apply current transaction log file?\[Default is Y\]:y
Applied current transaction log file successfully
Removing the existing database file storm_cluster2.db
Restoring ProactiveNet Data to C:\ProactiveNet\pw\sybase, please wait ...done.
Database Restored
Stopping Infrastructure Management Server...
Starting Infrastructure Management Server...
Successfully brought up Infrastructure Management Server...

It is recommended to take backup of the database, as the older one appears to be corrupted. Do you want to take a backup now? \[default is 'y'\]?:y
About 32 MB free diskspace is needed to archive the database
Taking backup of the database and the transaction log ..
Backup Failed.

Restore log file is relocated at C:\ProactiveNet\pw\pronto\logs\dbrestore.log for administration.

Example (UNIX or Linux operating system):

This operation will restore the database by applying the incremental backup files one by one. Increment backup files are present in the <Backup_Location>/incremental directory.

bash-2.03# pw database restore

Restoring data can take a long time for a large system.
This requires that data collection be shut down temporarily while this operation takes place. Continue(y/n)\[default is 'n'\]?y
backup directory is /usr/pw/dbarchive
Following log files are required to restore the db.
070430AA.log
070501AA.log
070502AA.log
070503AA.log
About 49MB free disk space is required to restore the database.
Following filesystems have diskspace greater than 49MB.
\-------------------------------------------------\-
Filesystem Available DiskSpace
/ 142MB
/usr 5468MB
/data 2626MB
Enter a directory which has sufficient disk space. \[default is /usr/pw/dbrestore\]:
/usr/pw/dbrestore has sufficient disk space
Shutting down current ProactiveNet processes ... done.
Copying /usr/pw/dbarchive/storm_malpe.db to /usr/pw/dbrestore* directory...
Done.
Applying last Full Backup transaction log file...
Applied last Full Backup transaction log file successfully
Would you like to apply 070430AA.log file (y/n) \[default is 'y' \]:y
Applied 070430AA.log file successfully
Would you like to apply 070501AA.log file (y/n) \[default is 'y' \]:y
Applied 070501AA.log file successfully
 Would you like to apply 070502AA.log file (y/n) \[default is 'y' \]:y
Applied 070502AA.log file successfully
Would you like to apply 070503AA.log file (y/n) \[default is 'y' \]:y
Applied 070503AA.log file successfully
Would you like to apply current transaction log file: /usr/pw/sybase/pronto.log (y/n) \[default is 'y' \]:y
Applied current transaction log file successfully.
Removing the existing database file storm_malpe.db
Restoring ProactiveNet data to /usr/pw/sybase, please wait ...
 Starting ProactiveNet processes ...

It is recommended to take backup of the database, as the older one appears to be corrupted. Do you want to take a backup now? \[default is 'y'\]?:y
Taking the full backup to /usr/pw/dbarchive after restoring the database.
About 48MB free diskspace is needed to archive the database.
Taking backup of the database and the transaction log ...
Backup Completed.
Archive log file is relocated at /usr/pw/pronto/logs/dbarchive.log for administration.
Removing /usr/pw/dbrestore/storm_malpe.db ...
Done
Restore log file is relocated to /usr/pw/pronto/logs/dbrestore.log for administration.

Limitation

Limitation: If storm_<hostName>.db file is moved to a non-default location (but not its associated pronto.log file), then, a new pronto.log file is generated in the new location of the .db file, making the pronto.log file in the default location unusable.

Workaround: Always move the pronto.log file along with the storm_<hostName>.db file to any chosen location.

Troubleshooting

If one or more incremental backup files are corrupted, continue from that point or exit the restoration process. If the full backup pronto.log file is corrupted, then the restoration process will exit.

pw database truncatelog

This command has been deprecated.

pw database validate

This command validates the indexes and keys on some or all of the tables in database. Also, this command scans the entire table and confirms whether each row in the table exists in the appropriate indexes.

Warning

Do not run the pw database validate command while the BMC TrueSight Infrastructure Management Server is connected to the database. If the BMC TrueSight Infrastructure Management Server is running, pw database validate will not give accurate results.

For more information about validating the database, see Validating the Infrastructure Management database

pw database validate[switches][object-name-list]

Switches (use the specified lowercase option as given below):

  • -f — Validates tables with full check
  • -fd — Validates tables with data check
  • -fi — Validates tables with index check
  • -fn — Validates tables with historical validation
  • -fx — Validates tables with express check
  • -i — Object-name-list is a list of indexes.
  • -o <file> — Logs output messages to a file
  • -}q — Quiet mode. Does not print messages
  • -s — Validates database pages by using checksum
  • -t— Object-name-list is a list of tables (default)

    Note

    Options -f, -fd, -fi, and -fx cannot be used with -i. Options -f, -fd, -fi, -fx, -fn, -i and -t cannot be used with -s.

Was this page helpful? Yes No Submitting... Thank you

Comments