Update a Database
This article describes the procedure to update a database in a DB system by using the Console and the API.
Required IAM Policy
To use Oracle Cloud Infrastructure, you must be granted security access in a policy by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don’t have permission or are unauthorized, verify with your administrator what type of access you have and which compartment to work in.
For administrators: The policy in Let database admins manage Oracle Cloud database systems lets the specified group do everything with databases and related Database resources.
If you're new to policies, see Getting Started with Policies and Common Policies. If you want to dig deeper into writing policies for databases, see Details for the Database Service.
Related Topics
About Updating a Database
Oracle recommends updating the DB system before updating the database within that DB system.
For the Oracle Database, updates are available for four most recent versions (N through N-3). For example, if an instance is using 21c and the latest version of 21c offered is 21.10.0.0, then 21.10.0.0, 21.9.0.0, 21.8.0.0, and 21.7.0.0 are available for Oracle Database updates. You can use any of these updates, but Oracle recommends using the latest.
You can also update your Oracle Database using a custom database software image. When updating with a software image, Oracle supports updating with any image based on any of the four most recent versions (N through N-3).
The following applies only to Oracle based updates starting April 2022 updates for 12.1 and 12.2 and July 2022 updates for 19c.
If you have any interim updates (previously known as a one-off patch) installed, then those interim updates will be rolled back automatically before installing the new update. If the new update does not include the interim updates, you could install the interim update again after you complete installing the new update.
If you have any interim updates installed in your database, then to avoid installing interim updates after the new update, Oracle recommends using a custom database software image and updating your database using that image.
After running precheck, you can identify if you have installed any additional interim updates by executing the following command in dbcli.
dbcli describe-job -i <job id>
where job id
(dbcli list-jobs
) is the
job id of the precheck run.
All the changes in the Oracle Home will be copied to the newly updated and installed database.
Note:
- Oracle does not recommend changing any files within the Database Home.
- It is essential to ensure that all the changes you made to the
Database Home are copied correctly. If you have copied any files or folders
in the Database Home, like
tnsnames.ora
,listener.ora
etc., you should back up those files manually.
The DB system should have access to the Identity and Object Storage endpoints within OCI. If the DB system running on a private subnet was only configured with a service gateway and no additional gateway (e.g., NAT Gateway), you should ensure that the service gateway is set to allow the access to all Oracle Services and not just the Object Storage. No change is required if the Identity and Object Storage endpoints can be reached by other means.
For more information on the list of currently available database updates, see Currently Available Updates.
Note:
OJVM updates have to be applied manually using the OPATCH tool.Apply Interim Updates Using a Database Software Image
We do not recommend applying interim updates to the DB systems. Instead, you should create and deploy a database software image that contains the necessary fixes. Only in cases where you cannot use a database software image, for example, to apply an interim update to a GI Home, you can file a Service Request (SR) and request support assistance to download an interim update.
For more information on database software images, see Software Images.
Apply a Database Update
Perform the following steps to update the database from an older update release.
- Open the navigation menu. Select Oracle Database, then select Oracle Base Database Service.
- Select your Compartment. A list of DB systems is displayed.
- In the list of DB systems, click the name of the DB system that contains the database you want to update.
- The details of the DB system followed by a list of databases are displayed.
- In the list of databases, click the name of the database that you want to update.
- In the Database information tab, under Version, click the View link beside the Database version field.
- Under Database, review the list of available updates for the
database.
- The Oracle Database Software Images tab displays generally available Oracle Database software images that you can use to update your database.
- The Custom Database Software Images tab allows you to
select a database software image you have created in advance.
- Use the Select a compartment selector to specify the compartment that contains the software image.
- Use the Region filter to access the software images created in a different region.
- Click the Actions menu for the update you are interested in,
and then click one of the following actions:
- Precheck: Check for any prerequisites to ensure that the update can be successfully applied. To run precheck, click Precheck and provide confirmation in the Confirm precheck dialog.
- Apply: Applies the selected update. Oracle recommends that you run the precheck operation for an update before applying it. To apply the update, click Apply and provide confirmation in the Confirm dialog.
In the list, the State displays the status of the operation. While an update is being applied, the State displays as Updating. The status of the database also displays as Updating. Lifecycle operations on the database and its resources might be temporarily unavailable. If the update completes successfully, the State changes to Applied and the status of the database changes to Available.
View the Database Update History
Perform the following steps to view the update history of a database.
Note:
Update history views in the Console do not show updates that were applied by using command line tools like dbcli or the Patch utility.- Open the navigation menu. Select Oracle Database, then select Oracle Base Database Service.
- Select your Compartment. A list of DB systems is displayed.
- In the list of DB systems, click the name of the DB system that contains the database you want to view the update details.
- The details of the DB system followed by a list of databases are displayed.
- In the list of databases, click the name of the database that you want to view the update details.
- In the Database information tab, under Version, click the View link beside the Database version field.
- On the Updates page, click Update history on the left-hand side menu.
- The history of update and upgrade operations for that database is displayed.
Apply an Interim Update
Note:
This topic applies only to database homes in single-node and multi-node RAC DB systems.To apply an interim update to fix a specific defect, follow the procedure in this section. Use the Opatch
utility to apply an interim update to the Database Home.
Note:
In the procedure example, the Database Home directory is /u02/app/oracle/product/12.1.0.2/dbhome_1 and the update number is 26543344.- Obtain the applicable interim update from My Oracle Support.
- Review the information in the update
README.txt
file. This file might contain additional and/or custom instructions to follow to apply the update successfully. - Use SCP or SFTP to place the update on your target database.
- Shut down each database that is running in the Database
Home.
srvctl stop database -db <db name> -stopoption immediate -verbose
- Set the Oracle Home environment variable to point to the target Oracle
Home.
sudo su - oracle export ORACLE_HOME=/u02/app/oracle/product/12.1.0.2/dbhome_1
- Change to the directory where you placed the update, and unzip the
update.
cd <working directory where opatch is stored> unzip p26543344_122010_Linux-x86-64.zip
- Change to the directory with the unzipped update, and check for
conflicts.
cd 26543344 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
- Apply the
update.
$ORACLE_HOME/OPatch/opatch apply
- Verify that the update was applied
successfully.
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
- If the Database Home contains databases, restart
them.
$ORACLE_HOME/bin/srvctl start database -db <db name>
Otherwise, run the following command as
root
user.# /u01/app/<db version>/grid/bin/setasmgidwrap o=/u01/app/oracle/product/<db version>/dbhome_1/bin/oracle
- If the readme indicates that the update has a
sqlpatch
component, run thedatapatch
command against each database.Before you run
datapatch
, ensure that all pluggable databases (PDBs) are open. To open a PDB, you can use SQL*Plus to execute the following against the PDB.ALTER PLUGGABLE DATABASE <pdb name> OPEN READ WRITE
$ORACLE_HOME/OPatch/datapatch
Use the API
For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.
Use the following APIs to manage database updates:
- ListDbHomePatches
- ListDbHomePatchHistoryEntries
- GetDbHomePatch
- GetDbHomePatchHistoryEntry
- UpdateDbHome
- UpdateDatabase
For the complete list of APIs for the Database service, see Database Service API.