其他分享
首页 > 其他分享> > Backup Catalog Housekeeping within SAP HANA

Backup Catalog Housekeeping within SAP HANA

作者:互联网

Environment

SAP HANA, platform edition

Cause

  1. The location of the data and log backups have been left at the default location of /usr/sap/<SID>/<HOST>/backup/data and /usr/sap/<SID>/<HOST>/backup/log'.
  2. Backup logs are now filling up the filesystem;

Resolution

It is possible to remove old backups from the HANA database using the following procedure:

  1. Issue the SQL command 'ALTER SYSTEM RECLAIM LOG' to free up log segments;
  2. Next, in SAP HANA Studio, go to the Backup and Recovery menu and choose the Backup Catalog tab;
  3. Locate any old backups that are no longer needed and right click the backup;
  4. Click 'Delete Data Backups' and choose the 'Catalog and Backup Location' radio button:
      

     

     

  5. Click 'Finish' to execute;

Remarks:

See Also

 

 

2921915 - Housekeeping with BACKUP CATALOG DELETE Statement

Symptom

Environment

Reproducing the Issue

Cause

Resolution

You can use the BACKUP CATALOG DELETE Statement to perform the housekeeping task in SQL console by following these steps below:

SELECT COUNT(*) FROM M_BACKUP_CATALOG
SELECT TOP 1 BACKUP_SIZE FROM M_BACKUP_CATALOG_FILES WHERE SOURCE_TYPE_NAME='catalog' ORDER BY BACKUP_ID DESC
SELECT TOP 10 * FROM M_BACKUP_CATALOG

SELECT * FROM M_BACKUP_CATALOG WHERE ENTRY_TYPE_NAME='complete data backup' AND STATE_NAME='successful' ORDER BY BACKUP_ID DESC

This procedure will  delete all log and data backup entries older than the data backup you choose. You will not be able to perform point-in-time recovery beyond its timestamp, but data backups created earlier can still be used for recovery. If you want to keep physical copies of older backups, see Step #4.

select count(*) from M_BACKUP_CATALOG where SYS_START_TIME<'<timestamp>'

to see how many entries were older than the data backup you chose, thus you can estimate the shrink in catalog file size after the deletion.

BACKUP CATALOG DELETE ALL BEFORE BACKUP_ID xxxx COMPLETE

Here xxxx is the backup ID you got from Step #2. This will delete catalog entries for all log and data backups dated before xxxx and all physical backup files in the file system and third-party backup tool.

Instead of COMPLETE you can use the following options to controls physical file deletion. Keep in mind that the catalog entries stored in database will always be deleted regardless of the option you choose.

* WITH FILE : Also delete physical backups in the file system.
* WITH BACKINT : Also delete physical backups in the third-party backup tool.
* <do not specify an option>: No physical backup deletion. If you choose this option, you will not be able to use this tool to delete the corresponding physical files in the future. You will have to manually remove them from the file system.

Hana will use file name and location stored in the catalog when the backup was created. So if you rename or move an old data backup it will be considered as deleted, and you can still use it for recovery.

You may still experience hanging/memory errors with this statement if there are too many entries to be deleted at once. In this case you can go back to Step #2 and choose an older backup to reduce database load.

After a successful execution, if you want to see a list of all files deleted, check backup.log for entries like the following:

2019-11-11T06:40:01-07:00 P109085 0 INFO LCM backup file /usr/sap/.../log_backup_1_0_xxxxxxx deleted

See Also

  BACKUP CATALOG DELETE from SAP HANA SQL and System Views Reference

Keywords

log backup, backup catalog,

标签:Housekeeping,backup,HANA,within,data,catalog,backups,BACKUP,log
来源: https://www.cnblogs.com/weikui/p/16386063.html