Procedure
- Check whether recording index data in the database is lost.
- Log in to the
database using the pgAdmin
client. Select a camera on which recording files are lost, and obtain camera_id
of the camera.
NOTE:
The following operations use camera_XXXX as an example.
- Choose , find out the recording index list
device_XXXX and recording event list event_XXXX, as shown in Figure 1.
Figure 1 Data tables

- Click
. In the Query dialog box, enter the following command:
select to_char(to_timestamp(start_time), 'yyyy-MM-dd HH24:MI:SS'), to_char(to_timestamp(stop_time), 'yyyy-MM-dd HH24:MI:SS') from device_XXXX;
- Click

to execute the command. In the Output pane window shown in Figure 2, you can view the recording start time and end time as well as check whether recording files are lost.Figure 2 Viewing the recording time

- If no recording file is lost in at least one table, go to 2.
- If recording files are lost in both the tables, go to the next step.
- Check whether
index file data of the lost recording exists.
- Log in to the server as the root user.
- Run the cd /RecordIndexFile/bsm/XXXX command.
- Run the ls -l
command to check whether recording index files are lost based on the index file
creation time, as shown in Figure 3.
Figure 3 Viewing recording index files

If yes, go to 2.
If no, go to 3.
public_sys-resources/icon-note.gif NOTE:A recording index file is generated every hour on the hour, recording index information in the hour.
- Repeat the preceding operations to check for loss of database index data and files on other cameras.
NOTICE:
The data recovery will interrupt recording and may lead to more severe results upon any incorrect operation. Exercise caution when performing this operation. It is recommended that you perform this operation under Huawei engineers' guidance.
If recording files on a few cameras are lost and only database recording index data is lost, contact Huawei technical support engineers but do not use the data safe to recover data.
- Log in to the backup server as the root user.
- Run the cd /home/ivstool/bin command. You enter the bin directory.
- Run the ./restore.sh command.
The system asks you whether to continue the restoration. The message is as follows:
Please confirm to continue restoring ivs service. (yes or no)?
- Enter yes.
The system prompts you to enter backup data to be restored.
NOTE:If the timeout duration is 10s and you do not enter anything after 10s, the system exits the restoration operation by default.
- Enter the digit as prompted.
NOTE:
The data safe can restore the recent two backups. If you enter digit 1, the penultimate backup is restored. If you enter digit 2, the last backup is restored.
- Verify that the system starts data restoration. After the system displays a message indicating the restoration is complete, the system restarts.
- Run the su - postgres -c
"/home/postgres/bin/pg_ctl status -D /DB_DATA/data/" command to view
the database status.
- If the database
is normal and the following command output is displayed, go to 4.
pg_ctl: server is running (PID: 16858) /home/postgres/bin/postgres "-D" "/DB_DATA/data"
- If the database is abnormal, go to the next step.
- If the database
is normal and the following command output is displayed, go to 4.
- Run the /home/ivstool/bin/service.sh restart pgdb command to restart the database.
- If the restart fails, go to /DB_DATA/data/pg_log, obtain database logs, and contact Huawei technical support engineers.
- If the database can be restarted, go to the next step.
If the fault is rectified, no further action is required. If the fault persists, contact Huawei technical support engineers.