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?
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.
$ORACLE_HOME/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:
$ORACLE_HOME/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
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. 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 switch to Read-Only Oracle Home, you don’t need to worry about copying these files. No custom files are allowed in the Oracle Home. Instead, the database stores all configuration files outside of the Oracle Home. Then you don’t need to worry about them anymore.
Conclusion
Did I miss any files? Please leave a comment if you move other files when you patch out-of-place.