How do I restore a standalone main database?

Purpose

The following steps describe how to restore a standalone main database using a backup file set. You require the following:

  • a database backup file set from the same NFM-P release

  • the original file path of the database backup

Note: You require the following user privileges:

  • main server — root, nsp

  • main database — root, Oracle management user

Note: The Oracle management user requires read and write permissions on the backup directory. The user and group names are specified during database installation; the default is ‘oracle’ in the ‘dba’ group.

Note: If the NFM-P system is not part of a shared-mode NSP deployment, a main database backup performed using the NFM-P client GUI also backs up the local Neo4j and PostgreSQL databases; a backup performed using a CLI does not.

In such a deployment, when you restore the main database from a GUI-created backup, you also restore the local Neo4j and PostgreSQL databases as described in the procedure.

Steps
 

If the database backup file set is on the database station, copy the file set to a different station for safekeeping.


Perform the following steps to stop the main server.

  1. Log in to the main server station as the nsp user.

  2. Open a console window.

  3. Enter the following:

    bash$ cd /opt/nsp/nfmp/server/nms/bin ↵

  4. Enter the following to stop the main server:

    bash$ ./nmsserver.bash stop ↵

  5. Enter the following to display the NFM-P server status:

    bash$ ./nmsserver.bash appserver_status ↵

    The server status is displayed; the server is fully stopped if the status is the following:

    Application Server is stopped

    If the server is not fully stopped, wait five minutes and then repeat this step. Do not perform the next step until the server is fully stopped.


Enter the following to switch to the root user:

bash$ su ↵


Enter the following to disable the automatic main server startup.

systemctl disable nfmp-main.service ↵


If you are restoring the database on a new station, for example, if the current database station is unusable, go to Step 10.


Log in to the database station as the root user.


Enter the following to uninstall the database:

dnf remove nsp-nfmp-main-db --setopt=clean_requirements_on_remove=false ↵

The dnf utility displays the following prompt:

Installed size: nn G 

Is this ok [y/N]: 


Enter y. The following is displayed:

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Uninstalling the NFM-P Database...

When the uninstallation is complete, the following is displayed:

Complete!


When the uninstallation is complete, enter the following to reboot the database station:

systemctl reboot ↵

The station reboots.


10 

Log in as the root user on the database station.


11 

Open a console window.


12 

Remove any files in the /opt/nsp/nfmp/db/tablespace and /opt/nsp/nfmp/db/archivelog directories.


13 

Copy the database backup file set to the station.

Note: The path to the backup file set must be the same as the path to the file set at creation time.


14 

Perform one of the following.

  1. If you are restoring the database on the same station, download or copy the following NFM-P installation files for the existing release to an empty directory on the database station:

    • nsp-nfmp-main-db-R.r.p-rel.v.rpm

    • OracleSw_PreInstall.sh

  2. If you are restoring the database on a new station, for example, if the current database station is unusable, download or copy the following NFM-P installation files for the existing release to an empty directory on the database station:

  • nsp-nfmp-jre-R.r.p-rel.v.rpm

  • nsp-nfmp-config-R.r.p-rel.v.rpm

  • nsp-nfmp-oracle-R.r.p-rel.v.rpm

  • nsp-nfmp-main-db-R.r.p-rel.v.rpm

  • OracleSw_PreInstall.sh

where

R.r.p is the NSP release identifier, in the form MAJOR.minor.patch

v is a version identifier


15 

Navigate to the directory that contains the NFM-P installation files.

Note: Ensure that the directory contains only the installation files.


16 

Enter the following:

chmod +x * ↵


17 

Enter the following:

./OracleSw_PreInstall.sh ↵

Note: The default values displayed by the script are shown as [default]. To accept a default value, press ↵.

The following prompt is displayed:

This script will prepare the system for a new install/restore of an NFM-P Version R.r Rn database.

Do you want to continue? [Yes/No]:


18 

Enter Yes. The following prompt is displayed:

Enter the Oracle dba group name [group]:


19 

Enter a group name and press ↵.

Note: To reduce the complexity of subsequent software upgrades and technical support activities, it is recommended that you accept the default.

The following message is displayed:

Creating group group if it does not exist...

If you specify a new group, the following message is displayed:

done


20 

If you specify an existing group, the following prompt is displayed:

WARNING: Group group already exists locally.

Do you want to use the existing group? [Yes/No]:

Perform one of the following.

  1. Enter Yes ↵.

  2. Enter No ↵. Go to Step 19 .


21 

If the default user exists in the specified group, the following prompt is displayed:

The user [username] for the group [group] already exists locally.

Do you want to use the existing user? [Yes/No]:


22 

Perform one of the following.

  1. Enter Yes ↵; the following messages are displayed:

    Checking or Creating the Oracle user home directory /opt/nsp/nfmp/oracle19...

    Checking user username...

    WARNING: Oracle user with the specified name already exists locally.

    Redefining the primary group and home directory of user username ... usermod: no changes

    Changing ownership of the directory /opt/nsp/nfmp/oracle19 to username:group.

    About to unlock the UNIX user [username]

    Unlocking password for user username

    passwd: Success Unlocking the UNIX user [username] completed

  2. Enter No ↵. The following prompt is displayed:

    Enter the Oracle user name:

    Type a username and press ↵.

    The following messages and prompt are displayed:

    Oracle user [username] new home directory will be [/opt/nsp/nfmp/oracle19].

    Checking or Creating the Oracle user home directory /opt/nsp/nfmp/oracle19..

    Checking user username...

    Adding username...

    Changing ownership of the directory /opt/nsp/nfmp/oracle19 to username:group.

    About to unlock the UNIX user [username]

    Unlocking password for user username.

    passwd: Success

    Unlocking the UNIX user [username] completed

    Please assign a password to the UNIX user username ..

    New Password:


23 

Perform one of the following.

  1. If you specify a new user in Step 22 , the following prompt is displayed:

    Please assign a password to the UNIX user username ..

    New Password:

    Perform the following steps.

    1. Type a password and press ↵. The following prompt is displayed:

      Re-enter new Password:

    2. Retype the password and press ↵. The following message is displayed if the password update is successful:

      passwd: password successfully changed for username

  2. If you specify an existing user in Step 22 , the following prompt is displayed:

    Do you want to change the password for the UNIX user username? [Yes/No]:

    Type No ↵.


24 

The following prompt is displayed:

Specify whether an NFM-P server will be installed on this workstation.

The database memory requirements will be adjusted to account for the additional load.

Will the database co-exist with an NFM-P server on this workstation [Yes/No]:

Enter Yes or No, as required, and press ↵.

Messages like the following are displayed as the script execution completes:

INFO: About to set kernel parameters in /etc/sysctl.conf...

INFO: Completed setting kernel parameters in /etc/sysctl.conf...

INFO: About to change the current values of the kernel parameters

INFO: Completed changing the current values of the kernel parameters

INFO: About to set ulimit parameters in /etc/security/limits.conf...

INFO: Completed setting ulimit parameters in /etc/security/limits.conf...

INFO: Completed running Oracle Pre-Install Tasks


25 

When the script execution is complete, enter the following to reboot the database station:

systemctl reboot ↵

The station reboots.


26 

When the reboot is complete, log in as the root user on the database station.


27 

Navigate to the directory that contains the NFM-P installation files.


28 

Perform one of the following:

  1. If you are restoring the database on the same station, enter the following:

    dnf install nsp-nfmp-main-db* ↵

  2. If you are restoring the database on a new station, enter the following:

    dnf install *.rpm ↵

The dnf utility resolves any package dependencies, and displays the following prompt:

Total size: nn G

Installed size: nn G 

Is this ok [y/d/N]: 


29 

Enter y. The following and the installation status are displayed as each package is installed:

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

The package installation is complete when the following is displayed:

Complete!


30 

Enter the following:

samrestoreDb path

where path is the absolute path of the directory that contains the database backup file set

The database restore begins.

If the backup file set has been created using file compression, messages like the following are displayed.

About to uncompress backup files under path

Completed uncompressing backup files under path

Messages like the following are displayed as the restore progresses.

Restore log is /opt/nsp/nfmp/db/install/NFM-P_Main_Database.restore.yyyy.mm.dd-hh.mm.ss.stdout.txt

<date time> working..

<date time> Performing Step 1 of 7 - Initializing ..

<date time> Executing StartupDB.sql ...

<date time> Performing Step 2 of 7 - Extracting backup files .....

<date time> Performing Step 3 of 7 - Restoring archive log files ..

<date time> Performing Step 4 of 7 - Executing restore.rcv ..........

<date time> Performing Step 5 of 7 - Restoring Accounting tablespaces .......

<date time> Performing Step 6 of 7 - Opening database .....

<date time> working....

<date time> Executing ConfigRestoreDB.sql ....................

<date time> working...............

<date time> Performing Step 7 of 7 - Configuring SAM Server settings ...

The restore is complete when the following is displayed:

<date time> Database restore was successful

DONE


31 

Log in to the main server station as the root user.


32 

If the NFM-P system is part of a shared-mode NSP deployment, go to Step 35.


33 

If the following are true, restore the Neo4j database.

  • The NFM-P system is not in a shared-mode NSP deployment.

  • You have restored the main database from a scheduled backup, or from a manual backup performed using the client GUI.

  1. Log in to the main server station as the root user.

  2. Enter the following:

    cd /opt/nsp/os/install/tools/database ↵

  3. Enter the following:

    ./db-restore.sh ↵

    The following message and prompt are displayed:

     Verifying prerequisites...

     Starting database restore ...

    Backupset file to restore (.tar.gz format):

  4. Enter the following and press ↵:

    path/nspos-neo4j_backup_timestamp.tar.gz

    where

    path is the absolute path of the Neo4j backup file

    timestamp is the backup creation time

    Note: Neo4j backup files are stored in the following locations on a main server, depending on the backup type:

    • scheduled backup—/opt/nsp/os/backup/backupset_n

    • manual backup—/opt/nsp/os/backup/manual_timestamp

    The following messages and prompt are displayed:

    PLAY [all] **************************************************

    TASK [dbrestore : Create temporary directory] ***************

    changed: [server_IP]

    [dbrestore : pause]

    Do you want to restore the nspOS Neo4j db from file: path/nspos-neo4j_backup_timestamp.tar.gz? Press return to continue, or Ctrl+C to abort:

  5. Press ↵.

    Messages like the following are displayed:

    TASK [dbrestore : Copy backupset] ***************************

    changed: [server_IP]

    TASK [dbrestore : Running nspdctl stop] *********************

    changed: [server_IP]

    TASK [dbrestore : Ensure database service is stopped] *******

    changed: [server_IP]

    TASK [dbrestore : Perform database restore] *****************

    changed: [server_IP]

    TASK [dbrestore : Delete temporary directory] ***************

    changed: [server_IP]

    PLAY RECAP **************************************************

    server_IP     : ok=n   changed=n    unreachable=n   failed=n

  6. If the failed value is greater than zero, a restore failure has occurred; contact technical support for assistance.


34 

If the following are true, restore the PostgreSQL database.

  • The NFM-P system is not in a shared-mode NSP deployment.

  • You have restored the main database from a scheduled backup, or from a manual backup performed using the client GUI.

  1. Enter the following:

    cd /opt/nsp/os/install/tools/database ↵

  2. Enter the following:

    ./db-restore.sh ↵

    The following message and prompt are displayed:

     Verifying prerequisites...

     Starting database restore ...

    Backupset file to restore (.tar.gz format):

  3. Enter the following and press ↵:

    path/nspos-postgresql_backup_timestamp.tar.gz

    where

    path is the absolute path of the PostgreSQL backup file

    timestamp is the backup creation time

    Note: PostgreSQL backup files are stored in the following locations on a main server, depending on the backup type:

    • scheduled backup—/opt/nsp/os/backup/backupset_n

    • manual backup—/opt/nsp/os/backup/manual_timestamp

    The following messages and prompt are displayed:

    PLAY [all] **************************************************

    [dbrestore : pause]

    Do you want to restore the nspOS PostgreSQL db from file: path/nspos-postgresql_backup_timestamp.tar.gz? Press return to continue, or Ctrl+C to abort:

  4. Press ↵.

    Messages like the following are displayed:

    TASK [dbrestore : Running nspdctl stop] *********************

    changed: [server_IP]

    TASK [dbrestore : Perform database restore] *****************

    changed: [server_IP]

    TASK [dbrestore : Delete temporary directory] ***************

    changed: [server_IP]

    PLAY RECAP **************************************************

    server_IP     : ok=n   changed=n    unreachable=n   failed=n

  5. If the failed value is greater than zero, a restore failure has occurred; contact technical support for assistance.


35 

Enter the following to enable the automatic main server startup.

systemctl enable nfmp-main.service ↵


36 

Start the main server.

  1. Enter the following to switch to the nsp user:

    su - nsp ↵

  2. Enter the following:

    bash$ /opt/nsp/nfmp/server/nms/bin/nmsserver.bash start ↵

    The main server starts.


37 

Close the open console windows, as required.


38 

Perform a full network resynchronization to discover the interim changes in the managed network.

End of steps