Oracle-Based Deployment Guide for Cisco IoT FND, Release 5.x.x and Later

PDF

Oracle-Based Deployment Guide for Cisco IoT FND, Release 5.x.x and Later

Backup and restore Cisco IoT FND DB

Want to summarize with AI?

Log in

This topic explains how to back up and restore the Cisco IoT FND database to ensure data integrity and system recovery.



Create a full backup of Cisco IoT FND DB

Full backups back up all the blocks from the data file. Full backups are time consuming and consume more disk space and system resources than partial backups.

Cisco IoT FND lets you perform full hot backups of Cisco IoT FND database. In a hot backup, Cisco IoT FND and the Cisco IoT FND database are running during the backup.

Note

The destination backup directory must be writable by the oracle user and have enough space for the Cisco IoT FND data.

To create a backup file of the Cisco IoT FND software:

Procedure

1.

On the Cisco IoT FND database server, open a CLI window.

2.

Switch to the user oracle:


                        su - oracle
                    
3.

Change directory to the location of the Cisco IoT FND backup script (backupCgmsDb.sh):


                        cd /home/oracle/app/oracle/cgms/scripts
                    
4.

Run the backup script and specify the destination folder. For example, to store the backup data in the /home/oracle/bkp folder, enter this command:

./backupCgmsDb.sh full /home/oracle/bkp 08-03-2018 15:54:10 PST: INFO: ========== CGMS Database Backup Started ==========08-03-2018 15:54:10 PST: INFO: Log file: /tmp/cgms_backup_restore.logAre you sure you want to backup CG-NMS database (y/n)? y

5.

Enter y to begin the backup process.


Schedule a full Cisco IoT FND Backup

To schedule a full Cisco IoT FND backup to run daily at 1:00 AM (default setting):

Note

The destination backup directory must be writable by the oracle user and have enough space for the Cisco IoT FND data.

Procedure

1.

On the Cisco IoT FND database server, open a CLI window.

2.

Switch to the user oracle :


                        su - oracle
                    
3.

Change directory to the location of the Cisco IoT FND backup script (backupCgmsDb.sh):


                        cd /home/oracle/app/oracle/cgms/scripts
                    
4.

Run the backup script and specify the destination folder.

To change the backup scheduling interval, edit the installCgmsBackupJob.sh script before running it. For example, to store the backup data in /home/oracle/bkp, enter this command:


                        ./installCgmsBackupJob.sh /home/oracle/bkp
                    

To delete the backup job, enter these commands:


                        cd /home/oracle/app/oracle/cgms/scripts
                            ./deinstallCgmsBackupJob.sh
                    

Restore a Cisco IoT FND Backup

Perform database backups and restores using the scripts provided in the cgms-oracle.rpm package. If using the supplied scripts, backups and restores only work if performed on the same Oracle database version.

Note

Backups from Oracle version 12.1.0 can only be restored on v12.1.0 if using the supplied scripts. Backups do not work across different versions of Oracle, for example, a backup taken on 12.1.0 cannot be restored on a different version of a future v12.x version using the supplied scripts. If a database upgrade from v12.1.0 to a future v12.x version is required, follow the Oracle upgrade procedure. Refer to the Oracle upgrade document and website.

Cisco IoT FND supports restoring Cisco IoT FND backups on the same host or different host. If you choose to restore Cisco IoT FND backups on a different host, ensure that the host runs the same version of the Oracle database software and that Cisco IoT FND database on the destination host was created using the setupCgmsDb.sh script.

Note

Cisco IoT FND does not support cross-platform backups.

Procedure

1.

Run the following command to stop Cisco IoT FND.

RHEL Version

Command

8.x

systemctl stop cgms

7.x

service cgms stop
2.

Switch to the user oracle, change directories to the script location, and stop Oracle:

su - oracle
cd /home/oracle/app/oracle/cgms/scripts
./stopOracle.sh
3.

To restore the Cisco IoT FND database, run the command:

./restoreCgmsDb.sh full-backup-file
Tip

Performing a restore from a full backup can be time consuming. For large deployments, we recommend restoring the database from incremental backups.

To restore Cisco IoT FND database from an incremental backup, run these commands and specify the path to last incremental backup file:

su - oracle
cd /home/oracle/app/oracle/cgms/scripts
./restoreCgmsDb.sh last-incr1-backup-file

The restore script might display these errors:

06-08-2018 13:12:56 PDT: INFO: Import completed successfully
                        06-08-2018 13:12:56 PDT: INFO: Shared memory file system. Required (1K-blocks): 6084456,
                        Available (1K-blocks): 4083180
                        06-08-2018 13:12:56 PDT: ERROR: Insufficient shared memory file system. Increase your
                        shared memory file system before restoring this database.
                        06-08-2018 13:12:56 PDT: ERROR: ========== CGMS Database Restore Failed ==========
                        06-08-2018 13:12:56 PDT: ERROR: Check log file for more information.

To avoid these errors, increase the size of the shared memory file system:

###### as "root" user
                        ###### Following command allocates 6G to shm. Adjust size as needed.
                        # umount tmpfs
                        # mount -t tmpfs tmpfs -o size=6G /dev/shm
                        ###### Edit /etc/fstab and replace defaults as shown below
                        tmpfs /dev/shm tmpfs size=6G 0 0
4.

Start Oracle:

./startOracle.sh
5.

Change directories to /opt/cgms and run the db-migrate script:


                        $ cd /opt/cgms
                        $ bin/db-migrate

When you restore a Cisco IoT FND database, the restore script restores the database to the Cisco IoT FND version the database was using. An error returns if you restore an old database to a newer version of Cisco IoT FND. Run the migrate script to ensure that the database runs with the current version of Cisco IoT FND.

6.

Start Cisco IoT FND by running the following command:

RHEL Version

Command

8.x

systemctl start cgms

7.x

service cgms start
Note

For disaster recovery, perform a clean restore. The script starts by deleting the current Cisco IoT FND database:


                            $ su - oracle
                            $ cd /home/oracle/app/oracle/cgms/scripts
                            $ ./deleteCgmsDb.sh
                            INFO: ======== CGMS Database Deletion Started - 2011-10-16-07-24-09 ==========
                            INFO: Log file: /tmp/cgmsdb_setup.log
                            INFO: Deleting database. This may take a while. Please be patient...
                            INFO: Delete database completed successfully
                            INFO: ========== CGMS Database Deletion Completed Successfully 
                            - 2011-10-16-07-25-01 ==========
Note

If a clean restore is not required, use the Oracle tool to restore the database.


Incremental backup of Cisco IoT FND DB

Incremental backups in Cisco IoT FND only back up data file blocks that have changed since the previous specified backup.

  • Cisco IoT FND supports two incremental backup levels: incr0 and incr1 .

  • There is also an hourly archivelog backup to manage database archive log files.

  • Incremental backups help optimize storage and ensure efficient recovery by only saving changed data blocks.

Incremental Backup Levels and Scheduling

Incremental backups in Cisco IoT FND are categorized into incr0 (base), incr1 (differential), and hourly archivelog backups, each with specific scheduling recommendations for large deployments.

  • incr0 – Base backup for subsequent incremental backups. This is similar to a full backup. For large deployments (millions of mesh endpoints and several thousand routers such as CGR1000 and IR800), run incr0 backups twice a week.

  • incr1 – Differential backup of all blocks changed since the last incremental backup. For large deployments, run incr1 backups once a day.

  • Hourly archivelog backup – The Oracle Database uses archived logs to record all changes made to the database. These files grow over time and can consume a large amount of disk space. Schedule the backup_archive_log.sh script to run every hour. This script backs up the database archive (.arc) log files, stores them on a different server, and deletes the source archivelog files to free space on the database server.

Note

An incr0 backup must run before an incr1 backup to establish a base for the incr1 differential backup.

Tip

Before performing any significant operation that causes many changes in the Cisco IoT FND database (for example, importing a million mesh endpoints or uploading firmware images to mesh endpoints), perform an incr0 backup. After the operation completes, perform another incr0 backup, and then resume the scheduled incremental backups.


Perform an incremental backup

Note

The destination backup directory must be writable by the oracle user and have enough space for the Cisco IoT FND data.

To perform an incremental backup:

Procedure

1.

On the Cisco IoT FND database server, open a CLI window.

2.

Switch to the user oracle and change directory to the location of the Cisco IoT FND backup script:


                        su - oracle
                            cd /home/oracle/app/oracle/cgms/scripts
                    
3.

Run the backup script and specify the incremental backup level and the destination folder where the backup data is stored (for example, /home/oracle/bkp). For example, to perform an incr0 backup to /home/oracle/bkp, enter the command:


                        ./backupCgmsDb.sh incr0 /home/oracle/bkp
                    

To perform an incr1 backup, enter the command:


                        ./backupCgmsDb.sh incr1 /home/oracle/bkp