Home » Posts tagged '#DatabaseAdministration'
Tag Archives: #DatabaseAdministration
Commands to configure SAP HANA HSR
To configure HANA system replication between a primary and secondary site, you’ll need to perform several steps. Here’s an overview of the commands involved in the configuration process:
- Connect to the primary site’s HANA database using the HANA Studio or HANA Cockpit, or by using the
hdbsqlcommand line tool. - Check the current replication status and configuration:
ALTER SYSTEM GET CONFIGURATION ('systemReplication')
This command will show you the current replication status and settings.
- If replication is not yet enabled, you’ll need to enable it. Use the following command:
ALTER SYSTEM SET CONFIGURATION ('systemReplication', 'enabled', 'true') WITH RECONFIGURE
This command enables system replication and triggers a reconfiguration.
- Create the secondary site configuration. Connect to the secondary site’s HANA database and execute the following command:
CREATE SYSTEM REPLICATION CONFIGURATION '<configuration_name>' SITE 'secondary_site' HOST '<secondary_host>' PORT <secondary_port> USER '<replication_user>' PASSWORD '<replication_password>'Replace<configuration_name>,<secondary_site>,<secondary_host>,<secondary_port>,<replication_user>, and<replication_password>with the appropriate values.
- Configure the replication mode and other parameters. Execute the following command at the primary site:
ALTER SYSTEM ALTER CONFIGURATION ('systemReplication') SET ('mode', '<sync_mode>') WHERE TARGET = 'secondary_site'Replace<sync_mode>with the desired synchronization mode. Common options are 'sync', 'async', or 'near_sync'.
- Start the replication process:
ALTER SYSTEM START REPLICA ADMIN FOR CONFIGURATION '<configuration_name>'Replace<configuration_name>with the name specified in step 4.
- Validate the replication setup. Check the replication status using:
SELECT * FROM M_SYSTEM_REPLICATION_STATUS
This command will show you the current replication status.