Showing posts with label Log. Show all posts
Showing posts with label Log. Show all posts

Friday, 6 September 2024

ALTER SYSTEM LOGGING Statement (System Management)

 

ALTER SYSTEM LOGGING Statement (System Management)

Enables or disables logging.

Syntax

ALTER SYSTEM LOGGING <on_off>

Syntax Elements

<on_off>

Specifies the logging status.

<on_off> ::= ON | OFF
ON

Enables logging.

OFF

Disables logging.

Description

While logging is disabled, no log entries persist; only the data area is written when a savepoint is reached. This behavior can cause the loss of committed transactions when the indexserver terminates in the middle of a LOAD operation. In case of a termination, truncate and insert all data again.

After enabling logging, perform a savepoint to be sure that all data persists. You must also perform a data backup; otherwise, you are unable to recover this data.

ALTER SYSTEM LOGGING waits for the end (commit/rollback) of existing active write transactions. During the execution of this command, write transactions are blocked. In the event that there is a long-running write transaction, this command can fail with a lock wait timeout error. Starting a new write transaction also can be blocked and failed with the same error.

Only use this command while performing the initial load of a database. If this statement is used at other times, then data loss can occur if the indexserver is terminated while logging is disabled. Consequently, in a running system, the logging mode should be always ON and should not be modified.

Example

Disable system logging.

ALTER SYSTEM LOGGING OFF;

Enable system logging.

ALTER SYSTEM LOGGING ON;

Monday, 2 May 2022

Backup and recovery introduction

 what is persistence layer?

persistence layer is required to ensure that the HANA system can be restarted or restored back to the last consistent state in case of a power failure or abrupt shutdown or system failure.


    Database data is stored 2 places:

         1. Data volumes.
         2. Log volumes.


1.Data volume:

    It contains system data, Application data and undo logs
    it write data in Async mode.

    

2. Log volume:

Redo logs store the changes to the data (insert, update , Delete).

Synchronous writes on commit.


Savepoint: changed data and undo logs are written from memory to disk.

                     default every 5 minutes

                     Automatic execution.


to take complete backup of system, need 3 things:

  1.  Complete backup.
  2.  incremental / differential backups.
  3. Most recent log entries from the log area.






    

Wednesday, 26 February 2020

Friday, 14 February 2020

Log volumes are full in HDB

Log Volume is Full and the Database Doesn’t Accept any new Requests
If the log_mode is set to legacy the logvolume keeps all log segments since the last full backup in the logvolume.

If no backups are performed the logvolume can run out of space.

Solution

1. Stop the database:

HDB stop

2. Change into the folder mnt00001 of the logvolume (Default: /usr/sap//global/hdb/log):

cd /usr/sap//global/hdb/log/mnt00001

3. You have to move one of the logvolumes temporarily to another volume where enough space is available.

You should free at least 2 GB of space to ensure that the database has enough space to start.

To find out the space consumption of each volume execute:

du -sh

4. Move a volume which consumes at least 2 GB of space (e.g. hdb00003)

to a volume with enough free space,

e.g. to the data volume (Default: /usr/sap//global/hdb/data):

mv hdb00003 /usr/sap//global/hdb/data

5. Create a symbolic link to the new folder in the old location:

ln -s /usr/sap//global/hdb/data/hdb00003 /usr/sap//global/hdb/log/mnt00001/hdb00003

6. Start the database (HDB start) and perform a backup

7. Use the following SQL-Statement to clean up the logvolume:

ALTER SYSTEM RECLAIM LOG;

8. Stop the database again and remove the symbolic link:

rm -f /usr/sap//global/hdb/log/mnt00001/hdb00003

9. Move the log volume back to its original location:

mv /usr/sap//global/hdb/data/hdb00003 /usr/sap//global/hdb/log/mnt00001

10. Start the database (HDB start)

ref: 1679938 – Log Volume is full (log mode = legacy)