“This is the 22nd day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

One, foreword

It is generally recommended to back up the ORACLE_HOME and oraInventory directories before installing a patch set or patch.

The inventory is organized as follows:

Central Inventory (oraInventory)
Local Inventory (Oracle Home inventory)
Copy the code

It can be classified into cold backup and hot backup. It is recommended to shut down all database processes (instances, listeners, etc.) for cold backup.

There are many backup methods, such as ZIP, tar, CPIO to compress ORACLE_HOME.

** How to Perform ORACLE_HOME Backup? (Doc ID 565017.1) * *

Backup ORACLE_HOME

The following uses tar compression for backup:

The single-instance 11204 database is used in this article.

1. (Optional) Stop all database processes.

##Non-rac
shutdown immediate
lsnrctl stop

##rac
srvctl stop database -d orcl
srvctl stop listener
srvctl stop scan_listner
Copy the code

2. Go to the ORACLE_HOME directory

echo $ORACLE_HOME
cd/ u01 / app/oracle/product / 11.2.0Copy the code

Backup ORACLE_HOME(root user is recommended)

mkdir /backup
cd/ u01 / app/oracle/product / 11.2.0 tar - PCF/backup/oracle_home_backup210421. Tar dbCopy the code

Restore ORACLE_HOME

1. Close all database processes (required)

##Non-rac
shutdown immediate
lsnrctl stop

##rac
srvctl stop database -d orcl
srvctl stop listener
srvctl stop scan_listner
Copy the code

2. Go to the ORACLE_HOME directory

echo $ORACLE_HOME
cd/ u01 / app/oracle/product / 11.2.0Copy the code

Rename or remove the current ORACLE_HOME

mv db db_backup210421

or

mv db /backup/db_backup210421
Copy the code

SQL > restore ORACLE_HOME

chown -R oracle:oinstall /backup
cd/ u01 / app/oracle/product / 11.2.0 tar - PXF/backup/oracle_home_backup210421. The tarCopy the code

4. Start the database

## Enable database instance and listener
##Non-rac
startup
lsnrctl start

--rac
srvctl start database -d orcl
srvctl start listener
srvctl start scan_listener
Copy the code