Skip to content

Conversation

@copybara-service
Copy link

Update the StopDatabase handler to handle Data Guard standby databases.

The updated logic:

Checks the database_role from v$database.
If the role is PHYSICAL STANDBY, it attempts to cancel managed recovery using ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL before issuing SHUTDOWN IMMEDIATE.
Uses WHENEVER SQLERROR CONTINUE for the cancellation command to make sure the shutdown proceeds even if the cancellation fails (e.g. if recovery was not active).
Logs a warning if the role check fails (e.g., database not mounted) but proceeds with the standard shutdown.

The updated logic:

Checks the database_role from `v$database`.
If the role is `PHYSICAL STANDBY`, it attempts to cancel managed recovery using `ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL` before issuing `SHUTDOWN IMMEDIATE`.
Uses `WHENEVER SQLERROR CONTINUE` for the cancellation command to make sure the shutdown proceeds even if the cancellation fails (e.g. if recovery was not active).
Logs a warning if the role check fails (e.g., database not mounted) but proceeds with the standard shutdown.

PiperOrigin-RevId: 856396445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant