Friday, July 26, 2024

Oracle “SYS” Credentials Update

 To change the Oracle sys password in a primary database and physical standby database, follow these steps:


*Primary Database:*


1. Connect to the primary database as sysdba:

```

sqlplus / as sysdba

```

1. Change the sys password:

```

ALTER USER SYS IDENTIFIED BY <new_password>;

```

*Physical Standby Database:*


1. Connect to the physical standby database as sysdba:

```

sqlplus / as sysdba

```

1. Change the sys password:

```

ALTER USER SYS IDENTIFIED BY <new_password> CONTAINER=ALL;

```

Note: The `CONTAINER=ALL` clause is required to change the password for all containers (root and PDBs) in a multitenant environment.


*Synchronize Passwords:*


To synchronize the sys password between the primary and physical standby databases, use the following command on the primary database:

```

ALTER SYSTEM SET STANDBY_PASSWORD = <new_password> SCOPE=BOTH;

```

This command updates the standby password in the primary database and propagates the change to the physical standby database.


*Verify Password Change:*


Verify that the sys password has been changed successfully by connecting to both databases with the new password:

```

sqlplus sys/<new_password>@<primary_db>

sqlplus sys/<new_password>@<physical_standby_db>

```

Remember to update any scripts, applications, or tools that use the sys password to connect to the databases.