Tutorial - Connect to a database using Oracle Cloud Infrastructure (OCI)
Published 25 March 2026
Prerequisites
- Flyway Teams
- Oracle Instant Client installed (for capabilities requiring Redgate comparison technology)
- Have a user with permissions to connect to Oracle Cloud instance
- An Oracle Wallet configured with credentials for the target database
- The wallet files (
cwallet.ssoand/orewallet.p12) available on the machine running Flyway - The
TNS_ADMINenvironment variable pointing to the location containing yourtnsnames.orafile
Setting up the wallet
If you do not already have an Oracle Wallet configured, use the mkstore utility to create one. Normally, mkstore comes with the full Oracle Client :
# Create a new wallet mkstore -wrl /path/to/wallet -create # Add credentials for a database connection mkstore -wrl /path/to/wallet -createCredential prod-db-alias prod_user prod_password # Check existing credentials mkstore -wrl /path/to/wallet -listCredential
NOTE: If you have an Autonomous Database, the Oracle Wallet can also be obtained by by logging into Oracle Cloud Console, navigating to your Autonomous Database instance, clicking DB Connection, and selecting "Download Wallet".
The alias (prod-db-alias ) must match an entry in your tnsnames.ora file:
prod-db-alias = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = prod-oracle-host)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ORCL)) )
- Ensure the
sqlnet.orafile points to the wallet location and appendSQLNET.WALLET_OVERRIDE = TRUEto the end of this file which forces Oracle Client to use Wallet Authentication:
WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = /path/to/wallet) ) ) SQLNET.WALLET_OVERRIDE = TRUE
Configuring Flyway
Point Flyway to the wallet directory using the oracle.walletLocation parameter. No user or password is needed.
Either configure this in your TOML configuration
[environments.production] url = "jdbc:oracle:thin:@prod-db-alias" [flyway.oracle] walletLocation = "/path/to/wallet"
Or specify directly on the command-line
flyway info \ -url="jdbc:oracle:thin:@prod-db-alias" \ -oracle.walletLocation="/path/to/wallet"
Adjust the JDBC URL according to your needs. The @prod-db-alias needs to the same connection string associated to the connecting user in the Oracle Wallet.
From the Flyway Desktop connection dialog:
- Set the username - Enter just a space e.g. " ", since a username is required in the UI however you will be using the credentials via the Oracle wallet
- Leave the password blank
- Enter the JDBC URL, use one of the TNS name alias provided by OCI e.g.
jdbc:oracle:thin:@<TNS_ALIAS>
Note: For functionality relying upon Redgate comparison technology, including all operations relating to the schema model, connecting to OCI using wallet only works on Windows with the Oracle Instant Client installed.
Troubleshooting
If connection fails, verify that:
- The wallet files (
cwallet.sso) exist at the configuredwalletLocation - The alias in the JDBC URL matches an entry in
tnsnames.ora - The
sqlnet.orafile hasSQLNET.WALLET_OVERRIDE = TRUE