I strongly recommend that you patch your Oracle Database using the out-of-place method. It has many advantages over in-place patching. But when you move your Oracle Database from one Oracle Home to another, you also need to move a lot of files.
Which files are that, and how can you make it easier for you? Also, some files might exist already in the target Oracle Home; what do you do then?
Files to Move
Password File
Linux:
dbs/orapw<ORACLE_SID>
Windows:
database\pwd<ORACLE_SID>.ora
You can override the default location in Windows using the following registry entries:
ORA_<ORACLE_SID>_PWFILE
ORA_PWFILE
If you use Grid Infrastructure, you can put the password file outside of the Oracle Home:
srvctl modify datatabase \
-d $ORACLE_UNQNAME
-pwfile <NEW_LOCATION_OUTSIDE_ORACLE_HOME>
I recommend storing it in ASM.
Parameter Files
Linux:
dbs/init<ORACLE_SID>.ora
dbs/spfile<ORACLE_SID>.ora
Windows:
database\init<ORACLE_SID>.ora
database\spfile<ORACLE_SID>.ora
Parameter files may include other files using the IFILE
parameter.
You can redirect the server parameter file to a location outside the Oracle Home using the SPFILE
parameter in your parameter file.
If you use Grid Infrastructure, you can also redirect the server parameter file:
srvctl modify datatabase \
-d $ORACLE_UNQNAME
-spfile <NEW_LOCATION_OUTSIDE_ORACLE_HOME>
I recommend storing it in ASM.
Oratab
You need to update the database instance entry in the oratab file:
/etc/oratab
On Solaris, you find the file in:
/var/opt/oracle/oratab
On Windows, the file does not exist. Instead, you re-register the instance in the registry when you use oradim.exe
.
Profile Scripts
Many people have profile scripts that set the environment to a specific database. Be sure to update the Oracle Home in such scripts.
Network Files
Network configuration files:
network/admin/ldap.ora
network/admin/listenener.ora
network/admin/sqlnet.ora
network/admin/tnsnames.ora
tnsnames.ora
, sqlnet.ora
and listener.ora
can include contents from other files using the IFILE
parameter, although the support of it is somewhat… questionable according to Allows for IFILE Ifile Support and Oracle Net (Doc ID 1339269.1).
You can redirect the files using the TNS_ADMIN
environment variable. On Windows, you can also redirect using the TNS_ADMIN
registry entry.
If you use Grid Infrastructure, you can set the TNS_ADMIN
environment variable as part of the cluster registration:
srvctl setenv database \
-d $ORACLE_UNQNAME \
-env "TNS_ADMIN=<NEW_LOCATION_OUTSIDE_ORACLE_HOME>"
Data Guard Broker Config Files
Linux:
dbs/dr1<ORACLE_SID>.dat
dbs/dr2<ORACLE_SID>.dat
Windows:
database\dr1<ORACLE_SID>.dat
database\dr2<ORACLE_SID>.dat
You can redirect the broker config files using the parameter DG_BROKER_CONFIG_FILEn
:
alter system set db_broker_start=false;
alter system set dg_broker_config_file1='<NEW_LOCATION>/dr1<ORACLE_SID>.dat';
alter system set dg_broker_config_file2='<NEW_LOCATION>/dr2<ORACLE_SID>.dat';
alter system set db_broker_start=true;
I recommend storing the files in ASM.
Admin directory
admin subdirectory in Oracle Home:
admin
If you don’t set ORACLE_BASE environment variable, the database uses the Oracle Home for that location. It can contain diagnostic information like logs and tracing which you might want to move to the new Oracle Home.
In rare cases, the TDE keystore will go in there as well. This is definitely a folder that you want to keep.
admin/$ORACLE_UNQNAME/wallet
I recommend having a dedicated ORACLE_BASE location. Always set ORACLE_BASE environment variable for all databases. This will ensure that the database will not create an admin directory in the Oracle Home.
If you use TDE Tablespace Encryption, I strongly recommend that you store the database keystore outside of the Oracle Home using the WALLET_ROOT
parameter.
Direct NFS
The Direct NFS configuration file:
dbs/oranfstab
The file might exist in the target Oracle Home, in which case you must merge the contents.
Typically, on Windows, the files from dbs are stored in database folder. But that’s different for this specific file (thanks Connor for helping out).
Centrally Managed Users
One of the default locations of the configuration file for Active Directory servers for centrally managed users is.
ldap/admin/dsi.ora
I recommend using the LDAP_ADMIN environment variable to redirect the file to a location outside of the Oracle Home.
LDAP
Configuration of Directory Usage Parameters:
ldap/admin/ldap.ora
I recommend using the LDAP_ADMIN or TNS_ADMIN environment variable to redirect the file to a location outside of the Oracle Home.
Oracle Messaging Gateway
The Messaging Gateway default initialization file:
mgw/admin/mgw.ora
The file might exist in the target Oracle Home, in which case you must merge the contents.
Oracle Database Provider for DRDA
Configuration file for Oracle Database Provider for DRDA:
drdaas/admin/drdaas.ora
The file might exist in the target Oracle Home, in which case you must merge the contents.
Oracle Text
If you use Oracle Text, you can generate a list of files that you must copy to the target Oracle Home:
ctx/admin/ctx_oh_files.sql
Oracle Database Gateway for ODBC
ODBC gateway initialization file:
hs/admin/init<ORACLE_SID>.ora
External Procedures
You can define the environment for external procedures in extproc.ora
. Such configuration might exist in the target Oracle Home already, in which case you must merge the contents:
hs/admin/extproc.ora
Other Things to Consider
Enterprise Manager
After moving the database to a new Oracle Home, you need to reconfigure the target in Enterprise Manager. The Oracle Home path is part of the configuration. You can easily change it with emcli
:
emcli modify_target \
-type='oracle_database' \
-name='<target_name>' \
-properties='OracleHome:<new_oracle_home_path>'
Also, if you moved the listener as part of the patching to a new Oracle Home, you need to update that as well.
On My Oracle Support you can find an example on how to bulk update multiple targets.
In a future version of AutoUpgrade, it will be able to modify the target in Enterprise Manager for you.
Oracle Key Vault
There should be no additional configuration needed if you are using Oracle Key Vault and you move the database to a new Oracle Home.
You can find information on how to configure Oracle Key Vault in an Oracle Database in the documentation.
ZDLRA
When you patch out-of-place, you should always ensure that the target Oracle Home has the latest version of libra.so. AutoUpgrade does not copy this file for you, because there is no way to tell which version is the latest version.
Ideally, you configure ZDLRA in via sqlnet.ora
and store the wallet outside of the Oracle Home. If so, the ZDLRA configuration works in the target Oracle Home because AutoUpgrade takes care of sqlnet.ora
.
If you use ra_install.jar
to configure ZDLRA, the script will:
- Create a file:
$ORACLE_HOME/dbs/ra<ORACLE_SID>.ora
- Create a folder with a wallet:
$ORACLE_HOME/dbs/wallet
In this case, you must manually copy the files to the target Oracle Home. You can avoid this by using sqlnet.ora
for the configuration instead.
AutoUpgrade does not copy these files for you, because of the issue described above with libra.so
.
Database Directories
You must update certain internal database directories, when you move the database to a new Oracle Home. The easiest way is to run:
@?/rdbms/admin/utlfixdirs.sql
In multitenant, you need to run the script in CDB$ROOT only.
On My Oracle Support you find a list of all the directories that you must update if you don’t use the script above.
In a future version of AutoUpgrade, it will change all the applicable directories for you automatically.
How to Make It Easy
Use AutoUpgrade
The easiest way to patch your Oracle Database is to use AutoUpgrade. It takes care of everything for you (unless stated otherwise above). You need a config file:
patch1.source_home=/u01/app/oracle/product/19.18.0
patch1.target_home=/u01/app/oracle/product/19.19.0
patch1.sid=MYDB
Then you start AutoUpgrade:
java -jar autoupgrade.jar -config mydb.cfg -mode deploy
That’s it! You don’t need to worry about all those configuration files. AutoUpgrade got you covered.
Use Read-Only Oracle Home
If you use Read-Only Oracle Home, the process is slightly easier.
You can’t store any custom files in the Oracle Home. Instead, you store all configuration files in Oracle Base Home; a directory outside the Oracle Home. You can find all the files you need to copy in Oracle Base Home.
When you create a new Read-Only Oracle Home, the installer will create a new Oracle Base Home specifically for that new Oracle Home. As part of the patching, you move the files into that new Oracle Base Home.
Conclusion
Did I miss any files? Please leave a comment if you move other files when you patch out-of-place.