You don't have to tar or zip all of Oracle central inventory, because the inventory is pretty small, normally, it's in several megabytes.
Same FolderIf we're in a hurry, you can duplicate the folder in the same place:
[oracle@ora19c1 ~]$ cp -rp /u01/app/oraInventory /u01/app/oraInventory-20200821
Or we can duplicate the folder in another place.
[oracle@ora19c1 ~]$ cp -rp /u01/app/oraInventory /oracle_backups/oraInv/oraInventory-20200821
It's pretty convenient.
We take two steps to restore the directory, but this time, we don't use cp, we use mv.
First, we rename the original folder into another.
[oracle@ora19c1 ~]$ mv /u01/app/oraInventory /u01/app/oraInventory-original
Second, we move back the backup folder and rename it to the original one.
[oracle@ora19c1 ~]$ mv /oracle_backups/oraInv/oraInventory-20200821 /u01/app/oraInventory
Suppose we'd like to put all backups in /home/oracle/oracle_inventory_backups, we should make a directory for it.
[oracle@ora19c1 ~]$ mkdir ~/oracle_inventory_backups
Then we tar the whole directory oraInventory in /u01/app.
[oracle@ora19c1 ~]$ cd /u01/app; tar -zcvf ~/oracle_inventory_backups/oraInv_backups.tar.gz oraInventory
You may have noticed, we change the directory first, then we tar the folder name in the current directory.
In case that you want to restore the archive, you can do this.
[oracle@ora19c1 ~]$ cd /u01/app; tar -zxvf ~/oracle_inventory_backups/oraInv_backups.tar.gz
Directory structure, modified time and permission set will be perfectly the same as before.
Please note that, tar is able to memorize the relative location of the archive, but not the absolute path.
To move the entire central inventory to another place, you should consider more interactions between files.