DEV Community

loading...
Cover image for Basic tasks using Oracle Fleet Patching and Provisioning

Basic tasks using Oracle Fleet Patching and Provisioning

project42 profile image Project-42 Updated on ・10 min read

Like I mentioned on my previous post about Oracle Fleet Patching and Provisioning I got to install BrokeDBA FPP Vagrant Fork as a test for this new (for me at least) Oracle management system.
A good place to start checking about the benefits of Oracle FPP: Oracle Fleet Patching and Provisioning - Introduction and Technical Overview

On this post, I wanted to mention some of the commands I have tried so far, nothing fancy or too complicated, but just a way to force me to use it and find new questions :)

Everything done is executed directly from our FPP Server and even though in this case I'm using only one client, you should be able to replicate the same to your entire feet

Actions List

Import Oracle DB Images

Let's import the DB 19c image in the server so we can deploy it later to our clients (we only have one client so far)

[grid@fpp-Server ~]$ rhpctl import image -image db_19300 -imagetype ORACLEDBSOFTWARE -zip /vagrant/ORCL_software/LINUX.X64_193000_db_home.zip
fpp-Server.evilcorp.com: Audit ID: 3
fpp-Server.evilcorp.com: Creating a new ACFS file system for image "db_19300" ...
fpp-Server.evilcorp.com: Extracting files to directory /rhp_storage/images/idb_19300815168/swhome...
fpp-Server.evilcorp.com: Files successfully extracted
fpp-Server.evilcorp.com: Changing the home ownership to user grid...
fpp-Server.evilcorp.com: Starting clone operation...
========================================
fpp-Server.evilcorp.com:
[INFO] [INS-32183] Use of clone.pl is deprecated in this release. Clone operation is equivalent to performing a Software Only installation from the image.
[....]
You can find the log of this install session at:
 /u01/app/oraInventory/logs/DetachHome2021-01-19_01-59-14PM.log
'DetachHome' was successful.
fpp-Server.evilcorp.com: Successfully executed detach home operation.
[grid@fpp-Server ~]$

[grid@fpp-Server ~]$ rhpctl import image -image db_12102 -imagetype ORACLEDBSOFTWARE -path /u01/app/oracle/product/12.1.0.2/dbhome_1 -targetnode fpp-Client -root
Enter user "root" password:
fpp-Server.evilcorp.com: Adding storage for image ...
fpp-Server.evilcorp.com: Creating a new ACFS file system for image "db_12102" ...
fpp-Server.evilcorp.com: Creating export file system ...
fpp-Server.evilcorp.com: Starting export file system...
fpp-Server.evilcorp.com: Mounting file system...
fpp-Server.evilcorp.com: Copying files...
fpp-Server.evilcorp.com: Removing export file system ...
[grid@fpp-Server ~]$
Enter fullscreen mode Exit fullscreen mode

Deploy New DB Oracle Home to the Fleet

Now we can add a new 19c Oracle home to our client VM:

[grid@fpp-Server ~]$ rhpctl add workingcopy -workingcopy wc_db_19300 -image db_19300 -user oracle -groups OSBACKUP=dba,OSDG=dba,OSKM=dba,OSRAC=dba -oraclebase /u01/app/oracle -path /u01/app/oracle/product/19.0.0/dbhome_1 -targetnode fpp-Client -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 7
fpp-Server.evilcorp.com: Option storagetype is set to the following default value: LOCAL.
fpp-Server.evilcorp.com: Storing metadata in repository for working copy "wc_db_19300" ...
fpp-Server.evilcorp.com: Connecting to node fpp-client ...
fpp-Server.evilcorp.com: Starting transfer for remote copy ...
[...]
fpp-client: ..................................................   100% Done.
fpp-Server.evilcorp.com: Successfully executed clone operation.
fpp-Server.evilcorp.com: Executing root script on nodes fpp-client.
fpp-client: Check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_fpp-Client_2021-01-19_14-18-52-702784822.log for the output of root script
fpp-Server.evilcorp.com: Successfully executed root script on nodes fpp-client.
fpp-Server.evilcorp.com: Working copy creation completed.
[grid@fpp-Server ~]$
Enter fullscreen mode Exit fullscreen mode

We can do the same for any other Database Oracle Home we have in our FPP Server

[grid@fpp-Server ~]$ rhpctl add workingcopy -workingcopy wc_db_12102 -image db_12102 -user oracle  -oraclebase /u01/app/oracle -path /u01/app/oracle/product/12.1.0.2/dbhome_1 -targetnode fpp-Client -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 21
fpp-Server.evilcorp.com: Option storagetype is set to the following default value: LOCAL.
fpp-Server.evilcorp.com: Storing metadata in repository for working copy "wc_db_12102" ...
[....]
fpp-Server.evilcorp.com: Executing root script on nodes fpp-client.
fpp-client: Check /u01/app/oracle/product/12.1.0.2/dbhome_1/install/root_fpp-Client_2021-01-20_13-34-01.log for the output of root script
fpp-Server.evilcorp.com: Successfully executed root script on nodes fpp-client.
fpp-Server.evilcorp.com: Working copy creation completed.
[grid@fpp-Server ~]$
Enter fullscreen mode Exit fullscreen mode

Create Database

What about creating a DB in our fpp-client? as simple as a remote command from our FPP Server
By the way, is not a "good idea" to cancel a Sever operation using "Ctrl+c" since it will actually continue in the background:

[grid@fpp-Server ~]$ rhpctl add database -workingcopy wc_db_19300 -dbname CDB19 -dbtype SINGLE -cdb -pdbName PDB -numberOfPDBs 1 -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 8
fpp-Server.evilcorp.com: Option datafileDestination is set to the following default value: /u01/app/oracle/oradata.
fpp-Server.evilcorp.com: Starting database creation on node fpp-client ...
^C^C
PRCG-1104 : User terminated the command. The command operation is not cancelled by this interruption, and may continue to be processed on the server.
[grid@fpp-Server ~]$

# Client VM

[root@fpp-Client logs]# ps -ef |grep pmon
oracle    1161     1  0 13:19 ?        00:00:00 ora_pmon_cdb1
oracle   31149     1  0 14:34 ?        00:00:00 ora_pmon_CDB19
root     32083 24582  0 14:41 pts/0    00:00:00 grep --color=auto pmon
[root@fpp-Client logs]#
Enter fullscreen mode Exit fullscreen mode

Just to confirm, we can see our new 19c Database running in fpp-Client

[oracle@fpp-Client ~]$ . oraenv
ORACLE_SID = [cdb1] ? CDB19
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@fpp-Client ~]$ sqlplus / as sysdba

DB_NAME   CDB HOST_NAME   STARTUP              DATABASE_ROLE 
--------- --- ----------- -------------------- ------------- 
CDB19     YES fpp-Client  19-JAN-2021 14:51:12 PRIMARY       



   INST_ID     CON_ID NAME                 OPEN_MODE  OPEN_TIME                                STATUS
---------- ---------- -------------------- ---------- ---------------------------------------- ----------
         1          2 PDB$SEED             READ ONLY  19-JAN-21 02.51.22.283 PM +00:00         NORMAL
         1          3 PDB                  READ WRITE 19-JAN-21 02.51.38.524 PM +00:00         NORMAL

SQL>
Enter fullscreen mode Exit fullscreen mode

You can also specify the datafile creation destination, like we are doing for this 12.1 Database

[grid@fpp-Server ~]$ rhpctl add database -workingcopy wc_db_12102 -dbname cdb12 -dbtype SINGLE -cdb -pdbName PDB12 -numberOfPDBs 1 -datafileDestination /u02/oradata -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 22
fpp-Server.evilcorp.com: Starting database creation on node fpp-client ...
fpp-client: SYS_PASSWORD_PROMPT
SYSTEM_PASSWORD_PROMPT
fpp-client:PDB_ADMIN_PASSWORD_PROMPT
fpp-client:Copying database files
fpp-client: 1% complete
[....]
fpp-client:   For the following PDBs: CDB$ROOT PDB$SEED PDB12
fpp-client:     Nothing to roll back
fpp-client:     Nothing to apply
fpp-client:
fpp-client: SQL Patching tool complete on Wed Jan 20 13:42:35 2021
[grid@fpp-Server ~]$


#DB alert confirming datfiles location
alter database rename global_name to "cdb12"
Completed: alter database rename global_name to "cdb12"
ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/cdb12/temp01.dbf' SIZE 61440K REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
Completed: ALTER TABLESPACE TEMP ADD TEMPFILE '/u02/oradata/cdb12/temp01.dbf' SIZE 61440K REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED

Enter fullscreen mode Exit fullscreen mode

Create PDB

We can also create PDBs on any CDB already running
(by the way, I'm sure will be corrected soon, but the documentation shows some typo, like -cdbName and -pdbName instead of -cdbname and -pdbname)

[grid@fpp-Server ~]$ rhpctl addpdb database -workingcopy wc_db_12102 -cdbname cdb12 -pdbname PDB122 -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 26
fpp-Server.evilcorp.com: Option dbtype is set to the following default value: SINGLE.
fpp-Server.evilcorp.com: Option datafileDestination is set to the following default value: /u01/app/oracle/oradata.
fpp-Server.evilcorp.com: Starting pluggable database addition on node fpp-client ...
fpp-client: Enter PDBADMIN User Password:
Creating Pluggable Database
fpp-client: 4% complete
fpp-client: 12% complete
fpp-client: 21% complete
fpp-client: 38% complete
fpp-client: 85% complete
fpp-client: Completing Pluggable Database Creation
fpp-client: 100% complete
fpp-client: Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb12/PDB122/cdb12.log" for further details.
[grid@fpp-Server ~]$

## fpp-client

CON_ID NAME     OPEN_MODE  OPEN_TIME                          STATUS
----------- -------- ---------- ---------------------------------- ---------
     2 PDB$SEED READ ONLY  20-JAN-21 01.42.01.262 PM +00:00   NORMAL
     3 PDB12    READ WRITE 20-JAN-21 01.42.20.847 PM +00:00   NORMAL
     4 PDB122   READ WRITE 20-JAN-21 02.19.24.252 PM +00:00   NORMAL
Enter fullscreen mode Exit fullscreen mode

Upgrade Database

This Scenario is the same upgrade exercise BrokeDBA shows in his post My Vagrant fork of Oracle Fleet Patching and provisioning (FPP)

[grid@fpp-Server ~]$ rhpctl upgrade database -dbname cdb12 -sourcehome /u01/app/oracle/product/12.1.0.2/dbhome_1  -destwc wc_db_19300 -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 28
fpp-Server.evilcorp.com: verifying versions of Oracle homes ...
fpp-Server.evilcorp.com: verifying owners of Oracle homes ...
fpp-Server.evilcorp.com: verifying groups of Oracle homes ...
fpp-Server.evilcorp.com: Processing arguments file /u01/app/grid/crsdata/fpp-server/rhp/conf/rhp.pref
fpp-Server.evilcorp.com: Connecting to node fpp-client ...
fpp-Server.evilcorp.com: Starting to upgrade database from path "/u01/app/oracle/product/12.1.0.2/dbhome_1" to path "/u01/app/oracle/product/19.0.0/dbhome_1" on node "fpp-client"
fpp-client: Logs directory:  /u01/app/oracle/cfgtoollogs/dbua/upgrade2021-01-20_02-28-20PM
fpp-client: Performing Pre-Upgrade Checks...
fpp-client: ============================
fpp-client: PRE- and POST- FIXUP ACTIONS
fpp-client: =============================
fpp-client: /u01/app/oracle/cfgtoollogs/dbua/upgrade2021-01-20_02-28-20PM/cdb12/upgrade.xml
fpp-client: /u01/app/oracle/cfgtoollogs/dbua/upgrade2021-01-20_02-28-20PM/cdb12/preupgrade_fixups.sql
fpp-client: /u01/app/oracle/cfgtoollogs/dbua/upgrade2021-01-20_02-28-20PM/cdb12/postupgrade_fixups.sql
[....]
69% complete
70% complete
80% complete
90% complete
Database upgrade has been completed successfully, and the database is ready to use.
[grid@fpp-Server ~]$

#fpp-client

DB_NAME   CDB HOST_NAME       STARTUP               DATABASE_ROLE
-------------- --- --------------- --------------------- -------------
CDB12     YES fpp-Client      20-JAN-2021 15:41:56  PRIMARY      

SQL> SQL> SQL>   2    3    4
 CON_ID NAME                 OPEN_MODE  OPEN_TIME                                STATUS
------------ -------------------- ---------- ---------------------------------------- ----------
      2 PDB$SEED             READ ONLY  20-JAN-21 05.47.39.793 PM +00:00         NORMAL
      3 PDB12                READ WRITE 20-JAN-21 06.11.24.190 PM +00:00         NORMAL
      4 PDB122               READ WRITE 20-JAN-21 06.11.24.376 PM +00:00         NORMAL

SQL>  select banner from v$version;

BANNER
-------------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Enter fullscreen mode Exit fullscreen mode

Remove Database

Let's delete the DB we just upgraded.
As you can see, we need to remember that the "workingcopy" has changed after the upgrade

[grid@fpp-Server ~]$ rhpctl delete database -workingcopy wc_db_19300 -dbname cdb12 -targetnode fpp-Client -root
Enter user "root" password:
fpp-Server.evilcorp.com: Starting database deletion...
fpp-client: [WARNING] [DBT-11503] The instance (cdb12) is not running on the local node. This may result in partial delete of Oracle database.
fpp-client:    CAUSE: A locally running instance is required for complete deletion of Oracle database instance and database files.
fpp-client:    ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.
fpp-client: [WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
fpp-client: Prepare for db operation
fpp-client: 32% complete
fpp-client: Connecting to database
[....]
fpp-client: 100% complete
fpp-client: Database deletion completed.
fpp-client: Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb12/cdb120.log" for further details.
[grid@fpp-Server ~]$
Enter fullscreen mode Exit fullscreen mode

Remove Oracle Home

We can now delete the old 12.1 DB Oracle Home from the client

[grid@fpp-Server ~]$ rhpctl delete workingcopy -workingcopy wc_db_12102 -root
Enter user "root" password:
fpp-Server.evilcorp.com: Audit ID: 29
fpp-Server.evilcorp.com: Removing working copy home ...
fpp-client: Checking for required files and bootstrapping ...
fpp-client: Please wait ...
fpp-client: Location of logs /u01/app/oracle/oraInventory/logs/
[....]
fpp-client: ####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
fpp-client: Successfully detached Oracle home '/u01/app/oracle/product/12.1.0.2/dbhome_1' from the central inventory on the local node.
fpp-client: Successfully deleted directory '/u01/app/oracle/product/12.1.0.2/dbhome_1' on the local node.
fpp-client: Oracle Universal Installer cleanup was successful.
fpp-client:
fpp-client: Oracle deinstall tool successfully cleaned up temporary directories.
fpp-client: #######################################################################
fpp-client:
fpp-client:
fpp-client: ############# ORACLE DEINSTALL TOOL END #############
fpp-client:
[grid@fpp-Server ~]$
Enter fullscreen mode Exit fullscreen mode

Operations Auditing

If your system is slow (like mine) and want to check an operation executed or running, you can use audit option to see the status and if completed, will show you how long it took, which is nice addition since this can give you some idea and expectations for new deployments ETA

[grid@fpp-Server ~]$ rhpctl query audit -record 8
fpp-Server.evilcorp.com: Audit ID: 9
Audit ID: 8
Start time: 2021-01-19T14:31:48.429
Command executed: rhpctl add database -workingcopy wc_db_19300 -dbname CDB19 -dbtype SINGLE -cdb -pdbName PDB -numberOfPDBs 1 -root
End time:
Command result: RUNNING
User name: grid
Node name: fpp-server@london-fleet-c
Target cluster: london-fleet-c

[grid@fpp-Server ~]$


[grid@fpp-Server ~]$ rhpctl query audit -record 8
fpp-Server.evilcorp.com: Audit ID: 11
Audit ID: 8
Start time: 2021-01-19T14:31:48.429
Command executed: rhpctl add database -workingcopy wc_db_19300 -dbname CDB19 -dbtype SINGLE -cdb -pdbName PDB -numberOfPDBs 1 -root
End time: 2021-01-19T14:51:44.000
Command result: SUCCESS
User name: grid
Node name: fpp-server@london-fleet-c
Target cluster: london-fleet-c

[grid@fpp-Server ~]$
Enter fullscreen mode Exit fullscreen mode

You can find more commands in Fleet Patching and Provisioning Control (RHPCTL) Command Reference
Also, you can find more examples in the Oficial Oracle FPP GitHub

This is first time I use Oracle FPP, so there is a lot to learn, but now that is up and running and BrokeDBA already promised to make more content about, I'm really looking forward to learn about it

Discussion (0)

pic
Editor guide