Get the App
SLTechnology News&Howtos  ›  Database  › 

Rman backup, crontab scheduled task did not generate backup files

Shulou Source: shulou.com Published: 2022-06-01 16:04:05 10月28日 Update

Automatic backup of database by crontab execution plan combined with RMAN

Phenomenon:

Using scheduled tasks to perform backups only generates directories but not backup files

1: Perform backup script manually with no problems

2: crontab schedule task, can generate directory, but can not generate backup files, indicating crontab did execute the script

But no backup file is generated, and the problem may lie in the combination of crontab and rman

Understanding:

crontab Although crontab is executed under oracle user, crontab cannot automatically load environment variables, so if there is no backup script,

Read environment variables, automatic backup, naturally will not succeed

Solution:

In the backup script,

###################################################################################################

# set environment variable

source /home/oracle/.bash_profile #Source the file that configures the environment variables

It's being implemented, that is, it can be obtained

Summary:

1: Cannot execute script backup oracle under root, need to make plan task under oracle user

[root@bzdb ~]# crontab -l -u oracle

50 23 * * 0 /script/level0.sh

50 23 * * 1-6 /script/level1.sh

2: crontab cannot automatically load environment variables, you need to put the environment variable source in the script

Tags: Backups scripts variables environment files generation tasks users directories problems success just just come on manual data database time is in phenomenon Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info vpn Linux macOS