Skip to main content

How to take RMAN Backup on DBCS in OCI to Object Storage using opc_install

How to take RMAN Backup on DBCS in OCI to Object Storage


We are going to learn how we can take a RMAN backup on DBCS and store it in Object storage bucket in OCI


Source System Information:


DB version: 11.2.0.4

DB on OCI DBCS

Type of Database : Oracle EBS

Single Node



Steps:


1) Create an OCI Private bucket to store RMAN backup.


Click on Navigation Menu > Object Storage > Object Storage > Buckets

 







2) As My OCI region is singapore so my Object_Storage URL: 


https://objectstorage.ap-singapore-1.oraclecloud.com


Bucket Name: PROD_RMAN_BACKUP



3) Connect to DBCS System Database Node


login as: opc
sudo su - oracle


4) Change to the directory that contains the backup module opc_install.jar file.


cd /opt/oracle/oak/pkgrepos/oss/odbcs



In case you don’t have file you can download on on-prem from below link.


URL https://www.oracle.com/database/technologies/oracle-cloud-backup-downloads.html


Also make sure java is installed on java. The version need to be correct. Don't install a higher version.


yum install java


[opc@foadbserver ~]$ which java

/usr/bin/java

[opc@foadbserver ~]$ java -version

java version "1.8.0_371"

Java(TM) SE Runtime Environment (build 1.8.0_371-b11)

Java HotSpot(TM) 64-Bit Server VM (build 25.371-b11, mixed mode)


5) Create directories to store library files and encryption key files.


mkdir -p /home/oracle/oci/lib

mkdir -p /home/oracle/oci/wallet




6) Install backup Module:


First make sure ntp is running



NTP Installation and Configuration

[root@funebs ~]# yum -y install ntp 
[root@funebs ~]# systemctl start ntpd 
[root@funebs ~]# systemctl enable ntpd



Syntax:

java -jar opc_install.jar -opcId <user_id> -opcPass '<auth_token>' -container <bucket_name> -walletDir ~/hsbtwallet/ -libDir ~/lib/ -configfile ~/config -host https://swiftobjectstorage.<region_name>.oraclecloud.com/v1/<object_storage_namespace>



opcId = User on Cloud which can access bucket. Check from user list for which auth token will be created.

opcPass = The auth token generated by using the Console or IAM API, in single quotes

Screenshot below for auth token generation



object_storage_namespace = Can be find as below. Open the bucket details





cd /opt/oracle/oak/pkgrepos/oss/odbcs


java -jar opc_install.jar -opcId ebscmadmin -opcPass 'xyz' -container PROD_RMAN_BACKUP -walletDir /home/oracle/oci/wallet/ -libDir /home/oracle/oci/lib -configFile ~/config -host https://swiftobjectstorage.ap-singapore-1.oraclecloud.com/v1/adjae238ashj



Output:


Oracle Database Cloud Backup Module Install Tool, build 12.2.0.1.0DBBKPCSBP_2018-06-12

Oracle Database Cloud Backup Module credentials are valid.

Backups would be sent to container RMAN_BACKUP.

Oracle Database Cloud Backup Module wallet created in directory /home/oracle/oci/wallet.

Oracle Database Cloud Backup Module initialization file /home/oracle/config created.

Downloading Oracle Database Cloud Backup Module Software Library from file opc_linux64.zip.

Download complete.


7) Check library and wallet directory content to make sure library files and encryption wallet key files are placed under them.


cd /home/oracle/oci/lib

ls


cd ../wallet

ls



8) Configure RMAN



Using Oracle user on DBCS node.


rman target /


Configure RMAN to use the SBT device and point to the config file that was created when you installed the backup module. 

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/config)';


CONFIGURE DEFAULT DEVICE TYPE TO SBT_TAPE;

CONFIGURE BACKUP OPTIMIZATION ON;

CONFIGURE CONTROLFILE AUTOBACKUP ON;

CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F';

CONFIGURE ENCRYPTION FOR DATABASE ON;

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;


More configuration can be changed based on requirements.



Sample RMAN Script


rman target / log=~/logs/proddb_${DATE}.log << EOF

SET ENCRYPTION IDENTIFIED BY "funebs123" ONLY;  -->Every Time we run we need to set this.

run

{

ALLOCATE CHANNEL c1 DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/oci/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/config)';

backup current controlfile format 'PROD_control_%d_%U.ctl';

BACKUP FORMAT PROD_full_%d_%u_%s_%p'  DATABASE  SPFILE  FORMAT 'PROD_SPFILE_%d_%u_%s_%p' PLUS ARCHIVELOG   FORMAT PROD_ARCH_%d_%u_%s_%p';

release channel ch1;

}

EOF




Full Sample Script

#!/bin/bash
########################################
####Created by Himanshu ###
#############02-JAN-2023################
. /home/oracle/.bash_profile
export DATE=$(date +%y-%m-%d_%H%M%S)
/u01/app/oracle/product/11.2.0.4/dbhome_1/bin/rman target / log=/home/oracle/logs/proddb_${DATE}.log << EOF
SET ENCRYPTION IDENTIFIED BY "foadbbackup23" ONLY;
run
{
  ALLOCATE CHANNEL c1 DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/oci/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/config)';
  ALLOCATE CHANNEL c2 DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/oci/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/config)';
  ALLOCATE CHANNEL c3 DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/oci/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/config)';
  ALLOCATE CHANNEL c4 DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/home/oracle/oci/lib/libopc.so, SBT_PARMS=(OPC_PFILE=/home/oracle/config)';
delete noprompt obsolete;
backup current controlfile format 'PROD_control_%U.ctl';
BACKUP AS COMPRESSED BACKUPSET TAG 'WEEEKLY_FULL_DB_MANUAL' DATABASE format 'PROD_full_%u_%s_%p' PLUS ARCHIVELOG format 'PROD_Arch_%u_%s_%p';
  RELEASE CHANNEL c1;
  RELEASE CHANNEL c2;
  RELEASE CHANNEL c3;
  RELEASE CHANNEL c4;
}
EOF






If you like please follow and comment

Comments

Popular posts from this blog

WebLogic migration to OCI using WDT tool

WebLogic migration to OCI using WDT tool Oracle WebLogic Deploy Tool (WDT) is an open-source project designed to simplify and streamline the management of Oracle WebLogic Server domains. With WDT, you can export configuration and application files from one WebLogic Server domain and import them into another, making it a highly effective tool for tasks like migrating on-premises WebLogic configurations to Oracle Cloud. This blog outlines a detailed step-by-step process for using WDT to migrate WebLogic resources and configurations. Supported WLS versions Why Use WDT for Migration? When moving Oracle WebLogic resources from an on-premises environment to Oracle Cloud (or another WebLogic Server), WDT provides an efficient and reliable approach to: Discover and export domain configurations and application binaries. Create reusable models and archives for deployment in a target domain. Key Pre-Requisites Source System: An Oracle WebLogic Server with pre-configured resources such as: Applica...

How to Validate TDE Wallet Password in Oracle Database

How to Validate TDE Wallet Password in Oracle Database Validating the Transparent Data Encryption (TDE) wallet password is crucial, especially when ensuring that the password is correct without using the OPEN or CLOSE commands in the database. This blog post explains a straightforward method to validate the TDE password using the mkstore utility. Steps to Validate TDE Wallet Password Follow these steps to validate the TDE wallet password: Step 1: Copy the Keystore/Wallet File Navigate to your existing TDE wallet directory. Copy only the ewallet.p12 file to a new directory. If a cwallet.sso file exists, do not copy it . The absence of cwallet.sso ensures that the wallet does not use auto-login, forcing the utility to prompt for the password. Step 2: Validate Using mkstore Use the mkstore utility to check the contents of the wallet file. The mkstore utility will prompt you for the TDE wallet password, allowing you to validate its correctness. Command Syntax To display the conten...

Rename a PDB in Oracle Database Multitenant Architecture in TDE and Non TDE Environment

Rename a PDB in Oracle Database Multitenant Architecture I am sharing a step-by-step guide to help you rename a PDB. This approach uses SQL commands. Without TDE or encryption Wallet Initial Check Check the Current Database Name and Open Mode: SQL > SELECT NAME, OPEN_MODE FROM V$DATABASE; NAME OPEN_MODE --------- -------------------- BEECDB READ WRITE List Current PDBs: SQL > SHOW PDBS; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 FUAT READ WRITE NO We need to RENAME FUAT to BEE  Steps to Rename the PDB Step 1: Export ORACLE_SID Set the Oracle SID to the Container Database (CDB): export ORACLE_SID=BEECDB Step 2: Verify Target PDB Name Availability If the target PDB name is different from the current PDB name, ensure no service exists with the target PDB name. Run SQL to Check Exi...