Cloud Training Exa Cs Backup Recovery

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Exadata Cloud Service Bal Sharma

Backup & Recovery using API Apr 2019


Level 300

Copyright © 2018, Oracle and/or its Copyright


affiliates.© All rights
2018, reserved.
Oracle 1 reserved.
and/or its affiliates. All rights
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 2


Objectives
After completing this lesson, you should be able to:
• ExaCS: Backup Restore Capabilities
• Pre-requisite for Backup on ExaCS
• Available Backup Options on ExaCS
• Tools/assistants
• Managing Backup-Create Backup Configuration File
• Installing Backup Configuration for database
• ExaCS- On-demand backup
• Checking Current backup configuration
• Customizing Backup Configuration
• How to take backups, list backups etc.
• Restore From Backup
• Demo

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 3


Exadata Backup/Restore Capabilities

ExaCS supports backing up databases on an Exadata DB system to an existing bucket in the Oracle Cloud
Infrastructure Object Storage service and to the local disk Fast Recovery Area.

• You need to Create a backup configuration file that indicates the backup destination, when the backup should
run, and how long backups are retained. If the backup destination is Object Storage, the file also contains the
credentials to access the service.

• As a next step you associate the backup configuration file with a database. The database will be backed up as
scheduled, or you can create an on-demand backup.

Note: You must update the cloud-specific tooling on all the compute nodes in your Exadata DB system before
performing the Backup-restore procedures. For more information, see Updating an Exadata DB System.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 4


Exadata Backup/Restore -Prerequisites
The Exadata DB system requires access to the Oracle Cloud Infrastructure Object Storage service.
Oracle recommends using a service gateway with the VCN to enable this access.

An existing Object Storage bucket to use as the backup destination. You can use the Console or the Object
Storage API to create the bucket.

•An auth token generated by Oracle Cloud Infrastructure. You can use the Console or the IAM API to generate
the password.

•The user name specified in the backup configuration file must have tenancy-level access to Object Storage.
Administrator should create a policy like the following that limits access to only the required resources in Object
Storage for backing up and restoring the database:

Allow group <group_name> to manage objects in compartment <compartment_name> where


target.bucket.name = '<bucket_name>'
Allow group <group_name> to read buckets in compartment <compartment_name>

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 5


Prerequisites: Required Networking Configuration for Backup
• Before you configure backup make sure subnet for Backup should be associated with route through
Service Gateway- which facilitates access to Object Storage(OSS).
• Backup Subnet: ExaCS uses a separate backup subnet which could be on Private subnet as below

• Create a Service Gateway and define Routing Rule as shown for Service gateway. You can have a
separate rule just for this.
• Note: NAT GW is not needed anymore, In
Case you need , you can have one.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 6


Prerequisites: Creating Auth Token for OSS Bucket

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 7


ExaCS –Assistants/Tools available for Backup
• The ExaCS uses the following tools/assistants

• /var/opt/oracle/bkup_api/bkup_api
• /var/opt/oracle/ocde/assistants/bkup/obkup
• /var/opt/oracle/oss
• /var/opt/oracle/ocde/assistants/bkup/bkup
• How are backups taken
• Automatic jobs via crontab
• On demand on VM

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 8


Managing Backup-Create Backup Configuration File
The backup configuration has to be done from first compute node of ExaCS, You can determine first node
by logging as grid user to compute node and executing “olsnodes –n”.

• SSH to the first compute node in the Exadata DB system and login as root.
• Create a new backup configuration file in /var/opt/oracle/ocde/assistants/bkup as below for scheduling
backup to both disk and Object storage
• Save the file and set permission.
# cd /var/opt/oracle/ocde/assistants/bkup
# vi bkup.cfg ==> This file may be empty by default. Enter the below values into the file and can be customized as well. Change the permission of the file

[root@xdprod-n53zg1 bkup]# cat bkup.cfg


# The bkup.cfg file will hold all the config info for BKUP
bkup_cfg_files=yes
bkup_disk=yes
bkup_disk_recovery_window=7
bkup_oss=yes
bkup_oss_url=https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/ociobenablement/balxdbucket
[email protected]
bkup_oss_passwd=3DDKr+aEMHhF61jDnrs
bkup_oss_recovery_window=30
bkup_daily_time=17:00 Make it the time window you want
bkup_cron_entry=yes

#chmod 600 bkup.cfg


#chown root bkup.cfg

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 9


Installing Backup Configuration for database
• Use the following command to install the backup configuration, configure the credentials, schedule the
backup, and associate the configuration with a database name.

/bkup -cfg bkup.cfg -dbname=<database_name>

• The backup is scheduled via cron and can be viewed at /etc/crontab.

• When the scheduled backup runs, you can check its progress with the following command.

/var/opt/oracle/bkup_api/bkup_api bkup_status

Note: For explanation on parameter see here:


https://docs.cloud.oracle.com/iaas/Content/Database/Tasks/exabackingup.htm

Note: If you used Object Storage as a backup destination, you can display the backup files in your bucket
in the Console on the Storage page, by selecting Object Storage.

Note: A backup configuration can contain the credentials to access the Object Storage bucket. For this reason,
you might want to remove the file after successfully configuring the backup.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 10
Installing Backup Configuration Example
[root@xdprod-n53zg1 bkup]# /var/opt/oracle/bkup_api/bkup_api set config --
file=/var/opt/oracle/ocde/assistants/bkup/bkup.cfg --dbname=bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
-> Action : set_config
-> logfile: /var/opt/oracle/bkup_api/log/bkup_api.log
cfgfile : /var/opt/oracle/ocde/assistants/bkup/bkup.cfg
Using configuration file: /var/opt/oracle/ocde/assistants/bkup/bkup.cfg Verifying Configuration
API::Parameters validated.
** process started with PID: 204524
** see log file for monitor progress

Backup Activity Log


root@xdprod-n53zg1 bkup]# tail -10f /var/opt/oracle/bkup_api/log/bkup_api.log
Wed, 30 Jan 2019 17:04:26 DBaaS Backup API V1.5 @2016 Multi-Oracle home
Wed, 30 Jan 2019 17:04:26 running on node: xdprod-n53zg1
Wed, 30 Jan 2019 17:05:13 7b73a19624b011e9a2dc00101a092c50@ backups after execution 10
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170258
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170340
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170348
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170409
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170432
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170435
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170445
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 rman tag TAG20190130T170448
Wed, 30 Jan 2019 17:05:14 7b73a19624b011e9a2dc00101a092c50 Backup succeded TAG20190130T170448
Wed, 30 Jan 2019 17:05:14 API::218211:: Running the following command: /var/opt/oracle/ocde/assistants/bkup/obkup -dbname=bmsprod -archivelog -uuid=7b73a19624b011e9a2dc00101a092c50
Wed, 30 Jan 2019 17:06:11 API::218211:: Archive log backup completed.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 11


ExaCS- On-demand backup
You can use the bkup_api utility to create an on-demand backup of a database.
SSH to the first compute node in the Exadata DB system and log in as opc and then sudo to the root user.
You can let the backup follow the current retention policy, or you can create a long-term backup that persists
until you delete it.

To create a backup that follows the current retention policy, enter the following command:
# /var/opt/oracle/bkup_api/bkup_api bkup_start --dbname=<database_name>

To create a long-term backup, enter the following command:


# /var/opt/oracle/bkup_api/bkup_api bkup_start --keep --dbname=<database_name>
To specify a custom backup tag, add the --tag option to the bkup_api command
# /var/opt/oracle/bkup_api/bkup_api bkup_start --keep --tag=monthly –dbname=<database_name>
To check the progress of the backup process, enter the following bkup_api command:
# /var/opt/oracle/bkup_api/bkup_api bkup_status --dbname=<database_name>
To List the available long-term backups:
# /var/opt/oracle/bkup_api/bkup_api recover_list –keep --dbname=<database_name>
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 12
ExaCS- Listing backup
[root@xdprod-n53zg1 ~]# /var/opt/oracle/bkup_api/bkup_api list -- [root@xdprod-n53zg1 ~]#
dbname=bmsprod /var/opt/oracle/bkup_api/bkup_api recover_list --keep --
dbname bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
DBaaS Backup API V1.5 @2016 Multi-Oracle home
-> Action : list
-> Action : recover_list
-> logfile: /var/opt/oracle/bkup_api/log/bkup_api.log
-> logfile: /var/opt/oracle/bkup_api/log/bkup_api.log
-> Listing all backups
Utility output:
Backup Tag Completion Date (UTC) Type
keep OREC version: 16.0.0.0
---------------------- ----------------------- ----------- -------- Starting OREC
TAG20190311T171523 03/11/2019 17:15:23 incremental Logfile is /var/opt/oracle/log/bmsprod/orec/orec_2019-04-
False 10_15:42:53.log
TAG20190312T171043 03/12/2019 17:10:43 incremental …….Lines truncated………..
False Tag parameter not required
………………………More lines………………………….. OREC::############ LONG-TERM RETENTION
TAG20190409T171141 04/09/2019 17:11:41 incremental BACKUPS #############
False * MONTHLY20190410T152138
TAG20190410T151500 04/10/2019 15:15:00 incremental
False
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 13
Deleting a local backup
To delete a backup of a database deployment on the Exadata DB system, use the bkup_api utility.

Connect to the first compute node in your Exadata DB system as the opc user and sudo to root

List the available backups:

# /var/opt/oracle/bkup_api/bkup_api recover_list --dbname=<database_name>

where dbname is the database name for the database that you want to act on. Delete the backup you want:

# /var/opt/oracle/bkup_api/bkup_api bkup_delete --bkup=<backup_tag> --dbname=<database_name>

where backup_tag is the tag of the backup you want to delete.

Deletes a full backup (keep forever backup)


/var/opt/oracle/bkup_api/bkup_api bkup_delete -b JAAS2014
To delete a backup in Object Storage

Use the RMAN delete backup command to delete a backup from the Object Store.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 14
Updating the Password by bkup_api Utility
OSS authentication check/Update password
curl -v -X GET <oss url> -u <userid of oss>:<passwd of oss>
Next step is to verify if the password is stored correctly in the wallet. Wallet is located at
/u01/app/oracle/admin/<SID>/db_wallet

$ORACLE_HOME/bin/mkstore -wrl /u01/app/oracle/admin/<SID>/db_wallet –list


$ORACLE_HOME/bin/mkstore -wrl /u01/app/oracle/admin/orcl/db_wallet –viewEntry <entryname>

Login as root user on first node of ExaCS after logging as “opc” user

To change oss password in db_wallet Create a file that contains the updated password such as /tmp/bal.cfg which looks like
password=Welcome1
chmod 0600 /tmp/bal.cfg
Run the command to set the new password.
/var/opt/oracle/bkup_api/bkup_api update_wallet --cfg=password-file
./opt/oracle/bkup_api/bkup_api update_wallet --cfg=/tmp/bal.cfg

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 15


Restoring the Backup
“bkup_api” Utility provides various options for recovery.

• backup tag
• SCN
• PITR
• Latest Backup
• Log files : /var/opt/oracle/log/<dbname>/orec

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 16


Restoring the Backup-Example

Other recovery scenarios is as below


-> recover_start --latest [Recovers from the latest backup]
-> recover_start --scn 50100 [Recovers from the specified SCN]
-> recover_start -b TAG2014 [Performs point in time recovery using the incremental tag]
-> recover_start -b JAAS2014 --keep [Performs a full backup recovery]
-> recover_start -t '31-JAN-2014 14:50:07' [Performs a recovery to the specified (UTC)timestamp]
-> recover_start -t '31-JAN-2014 14:50:07' --nonutc [Performs a recovery to the specified timestamp]
-> recover_start --rargs='-latest ' [by pass the command you want to orec tool (to be deprecated)]

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 17


Recovery Steps -From Log
[root@xdprod-n53zg1 ~]# /var/opt/oracle/bkup_api/bkup_api recover_status --dbname=bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
-> Action : recover_status
-> logfile: /var/opt/oracle/bkup_api/log/bkup_api.log
……..Truncated o/p…………………………
-> API:: Checking prerequirements before recovery process.
-> API:: DB Status : OPEN
-> API:: Checking for PFILE in file system...
-> API:: PFILE is present in file system.
-> API:: Shutting down the database... Completed.
-> API:: Changing instance to MOUNT stage.
-> API:: Shutting down the database...API:: Executing SHUTDOWN ABORT... Completed.
-> API:: (RMAN) Startup mount... Completed.
-> API:: Testing RMAN connection.
-> API:: Verifying backups dates ..
-> API:: Latest backup : TAG20190410T155655
-> API:: Continuing with the DB recovery.
-> API:: Shutting down the database... Completed.
-> API:: Startup MOUNT... Completed.
-> API:: Stopping GRID DB
-> API:: State GRID DB
-> API:: Database Instance operation ..
-> API:: Executing SHUTDOWN ABORT... Completed.
-> API:: removing DB from cluster monitoring
-> API:: Performing recovery from latest backup.API:: Startup MOUNT... Completed.
-> API:: Database Instance operation ..
-> API:: Executing SHUTDOWN ABORT... Completed.
-> API:: adding DB to cluster monitoring
-> API:: Stopping GRID DB
-> API:: State GRID DB
-> API:: Starting GRID DB
-> API:: State GRID DB
-> API:: Recovery to latest backup completed.
*
* RETURN CODE:0
##################################################

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 18


Know Your Current Backup Configuration using bkup_api
You can use the get_config_info command of the bkup_api utility to view backup configuration
settings for database deployments
•Connect to the compute node as the opc user.
•Start a root-user command shell or use sudo
•List the value of a backup configuration setting

# /var/opt/oracle/bkup_api/bkup_api get_config_info -e configuration --dbname dbname [--json


json_destination]

Configuration is one of these backup configuration settings:

bkup_cfg_db_spec, bkup_cfg_files, bkup_cfg_os_spec, bkup_cfg_recovery_window, bkup_daily_time,


bkup_disk, bkup_disk_recovery_window, bkup_nfs_mount_dir, bkup_oss, bkup_oss_recovery_window,
bkup_oss_url, bkup_oss_user, bkup_rman_retention, bkup_script_loc, bkup_type, fra_loc, opc_oss_url,
oss_auth_url, oss_base, oss_sname, oss_tid, oss_url, oss_user.

dbname is the database name.

Note: You can use sudo instead of logging to root from opc user

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 19


Know Your Current Backup Configuration using bkup_api examples
[root@xdprod-n53zg1 ~]# /var/opt/oracle/bkup_api/bkup_api get_config_info --entry bkup_oss_user --dbname=bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
-> Action : get_config_info
-> logfile: /var/opt/oracle/bkup_api/log/bkup_api.log

bkup_oss_user = [email protected]
[root@xdprod-n53zg1 ~]# /var/opt/oracle/bkup_api/bkup_api get_config_info --entry bkup_oss_url --dbname=bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
bkup_oss_url = https://swiftobjectstorage.us-ashburn-1.oraclecloud.com/v1/ociobenablement/balxdbucket
[root@xdprod-n53zg1 ~]# /var/opt/oracle/bkup_api/bkup_api get_config_info --entry bkup_oss --dbname=bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
bkup_oss = yes
[root@xdprod-n53zg1 ~]# /var/opt/oracle/bkup_api/bkup_api get_config_info --entry bkup_cfg_files --dbname=bmsprod
DBaaS Backup API V1.5 @2016 Multi-Oracle home
bkup_cfg_files = yes

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 20


Know Your Current Backup Configuration using bkup_api

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 21


Know your current backup configuration using “creg”
[root@xdprod-n53zg1 ~]# cat /var/opt/oracle/creg/bmsprod.ini | grep bkup

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 22


Customizing the Automatic Backup Configuration
You can customize many of the characteristics of the automatic backup configuration.
You can customize backup settings for a database deployment by generating a file containing the current
customizable settings, editing the file, and then using the file to update the backup settings.
To generate a configuration file with the current backup settings and use it to update the settings:
Connect as the opc user to a compute node.
Start a root-user command shell:
$ sudo -s
# Use the bkup_api get config command to generate a file containing the current backup settings for a
database deployment:
# /var/opt/oracle/bkup_api/bkup_api get config [--file=filename] --dbname=dbname
Edit the parameter values in the generated file to change any settings you want to customize in the
backup configuration.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 23


Customizable Parameters for Backup Configuration
Parameter Description
bkup_cron_entry Enables the automatic backup configuration. Valid values are yes and no.
bkup_cfg_files Enables backup of system and database configuration files. Valid values are yes and no.
bkup_daily_time Time of the automatic daily backup using 24 hour time expressed as hh:mm.
bkup_disk Enables backups to local Exadata storage. Valid values are yes and no.
bkup_disk_recovery_window Retention period for backups on local Exadata storage. Value is expressed in number of
days between 1 and 14. Only applicable when bkup_disk is set to yes.
bkup_oss Enables backups to cloud storage. Valid values are yes and no.
bkup_oss_l0_day Day of the week when a level 0 backup is taken and stored on cloud storage. Valid values
are mon, tue, wed, thu, fri, sat, sun. Only applicable when bkup_oss is set to yes.
bkup_oss_recovery_window Retention period for backups to cloud storage. Value is expressed in number of days
between 1 and 30. Only applicable when bkup_oss is set to yes. Only applicable when
bkup_oss is set to yes.
bkup_oss_url Location of the storage container that is used for backup to cloud storage. Only applicable
when bkup_oss is set to yes.
bkup_oss_user User name of the Oracle Cloud user having write privileges on the cloud storage container
specified in bkup_oss_url. Only applicable when bkup_oss is set to yes.
bkup_oss_passwd Password of the Oracle Cloud user having write privileges on the cloud storage container
specified in bkup_oss_url. Only applicable when bkup_oss is set to yes.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 24


Configuration continued
Use the bkup_api set config command to update the backup settings using the file containing your
updated backup settings:
# /var/opt/oracle/bkup_api/bkup_api set config --file=filename --dbname=dbname where filename is used
to specify the name of the file that contains the updated backup settings and dbname is the database
name for the database that you are acting on.
You can use the bkup_api configure_status command to check the status of the configuration update:
# /var/opt/oracle/bkup_api/bkup_api configure_status
Exit the root-user command shell:
Note: Any changes you make by using the bkup_api set config command are not reflected in the Oracle
Database Exadata Cloud Service console.
If your backup configuration includes bkup_cfg_files=yes, then each backup includes system and
database configuration files and directories specified in the oscfg.spec file and the dbcfg.spec file. Both
files are located under /var/opt/oracle/dbaas_acfs/bkup/dbname, where dbname is the name of the
database that is associated with the backup configuration.

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 25


Automatic Backup Configuration- crontab

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 26


Demo

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 27


Backup Recovery - Summary

You should now be able to


• Describe Available Backup Options on ExaCS
• Understand Tools/assistants
• Checking Current backup configuration
• Customizing Backup Configuration
• How to take backups, list backups etc.
• Restore From Backup

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 28


cloud.oracle.com/iaas

cloud.oracle.com/tryit

Copyright © 2018, Oracle and/or its affiliates. All rights reserved. 29

You might also like