Oracle Sean

View Original

Generate Random Passwords for Automated Oracle Installs

Oracle enforces complexity rules for passwords when creating a database:

See this content in the original post

This can be a bit of a pain when automating database builds for migration, perhaps to Oracle Database Appliance or Oracle Cloud. Eventually the password file from source gets restored. The password isn’t really important in this case, leaving two options.

  1. Use a static password for everything

  2. Generate passwords for each database

Producing random strings is easy, but guaranteeing minimums for upper and lowercase, numbers and special characters from a list is a little more complex.

I addressed this by producing a minimum of each type, adding random characters for length, then shuffling the output into a variable my automation uses to set the database password in the CLI:

See this content in the original post

Pass the value to the CLI:

See this content in the original post

Viola!