Home » RDBMS Server » Backup & Recovery » ORA-19504 - "failed to create file"
icon5.gif  ORA-19504 - "failed to create file" [message #667065] Wed, 06 December 2017 04:19 Go to next message
davebyrne
Messages: 4
Registered: December 2017
Location: UK
Junior Member
Hi All,

I'm fairly new to RMAN, so please bear with me.. I have the following bash script:

#!/bin/bash
mkdir /u02/rman/<REDACTED>/full`date +%Y%m%d`
source /home/oracle/.bash_profile
rman cmdfile /u02/rman/scripts/<REDACTED>_lev0.cmd log=/u02/rman/scripts/lev0.log

This script is called when a full backups is required, it creates a time/date stamped folder within the /u02 mount to store the full backup within. That's all fine, lets say it creates one on the 25th December 2017, so it would create "/u02/rman/<REDACTED>/full20171225"

The RMAN command file that is run from this is:
connect target sys/<REDACTED>;
RUN {
ALLOCATE CHANNEL <REDACTED> TYPE DISK FORMAT '/u02/rman/<REDACTED>/full%Y%M%D/%U';
set controlfile autobackup format for device type disk to '/u02/rman/<REDACTED>/full%Y%M%D/cf_%F';
backup incremental level 0 as compressed backupset database plus archivelog;
delete force noprompt obsolete;
RELEASE CHANNEL <REDACTED>;
}

In here is where I'm having a problem, a full backup of our 750Gb+ dataset takes around 36hours, and there is no way at the moment for us to speed that up. The issue that results in is that at around 1minute past midnight, the RMAN operation fails because it attempts to write to "/u02/rman/<REDACTED>/full20171226/%U" (note the 26th, because we've gone past midnight). Now, of course that directory doesn't exist, it was never created, we only created the 25th directory in the bash script.

We (wrongly) assumed that the directories would be "set" when the RMAN cmd file is first run, but clearly this is not the case, and those dynamic directories are referenced and "calculated" several times over during the course of the full backup.

What is the preferred method (or indeed just the easiest method) to resolve this? Can we somehow pass the DIR made in the bash script to RMAN as a static string rather than letting RMAN calculate its own DIR's? Can we give RMAN some kind of command that makes it only set its target folder once?

Here is the resulting ORA and RMAN errors for what its worth (not a lot):
RMAN-03002: failure of backup plus archivelog command at 12/03/2017 05:25:03
ORA-19504: failed to create file "/u02/rman/<REDACTED>/full20171203/arsl5t5d_1_1"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory

[Updated on: Wed, 06 December 2017 04:31]

Report message to a moderator

Re: ORA-19504 - "failed to create file" [message #667067 is a reply to message #667065] Wed, 06 December 2017 05:01 Go to previous messageGo to next message
Michel Cadot
Messages: 65249
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Is "<REDACTED>" really "<REDACTED>" or something you modified because using < and > characters inside a file or directory is really a good way to have unpredictable results.

Re: ORA-19504 - "failed to create file" [message #667068 is a reply to message #667067] Wed, 06 December 2017 05:03 Go to previous messageGo to next message
davebyrne
Messages: 4
Registered: December 2017
Location: UK
Junior Member
Michel Cadot wrote on Wed, 06 December 2017 05:01

Is "<REDACTED>" really "<REDACTED>" or something you modified because using < and > characters inside a file or directory is really a good way to have unpredictable results.

No that's just been put there by me to save exposing the clients company names on the internet (and the password..)
Re: ORA-19504 - "failed to create file" [message #667069 is a reply to message #667068] Wed, 06 December 2017 05:07 Go to previous messageGo to next message
Michel Cadot
Messages: 65249
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

So be sure that Oracle and the user that executes RMAN has the correct privileges on all the directories of the path.

Re: ORA-19504 - "failed to create file" [message #667070 is a reply to message #667069] Wed, 06 December 2017 05:10 Go to previous messageGo to next message
davebyrne
Messages: 4
Registered: December 2017
Location: UK
Junior Member
Michel Cadot wrote on Wed, 06 December 2017 05:07

So be sure that Oracle and the user that executes RMAN has the correct privileges on all the directories of the path.

Hi,
Permissions are all good, as they are created within an oracle owned directory, they end up being 0755 and oracle:oinstall owned. The problem is that the final error in the logs says it couldn't create file at XYZ, when XYZ doesn't even exist, because its gone past midnight and XYZ is now a directory name that doesn't exist because the date changed.


Just for sanity...
[root@quo-mai-ora1]# ls -lah | grep full
drwxr-xr-x  2 oracle oinstall   33 Nov 26 23:34 full20171124
drwxr-xr-x  2 oracle oinstall 4.0K Dec  5 17:20 full20171201
[root@quo-mai-ora1]# pwd
/u02/rman/<REDACTED>
[root@quo-mai-ora1]#

[Updated on: Wed, 06 December 2017 05:11]

Report message to a moderator

Re: ORA-19504 - "failed to create file" [message #667073 is a reply to message #667065] Wed, 06 December 2017 06:15 Go to previous messageGo to next message
John Watson
Messages: 7180
Registered: January 2010
Location: Global Village
Senior Member
I think you are getting the expected bahaviour: your FORMAT will be applied to all the backup pieces of all the sets as they are created. You will have multiple backup sets: at least one for the datafiles and at least two for the archive logfiles.

Overall, though, the simplest solution would be to stop trying to put the backups in separate date named directories. Or if for some reason that I cannot imagine you really need these directories, you could direct the backups to the FRA and let Uncle Oracle create the date named directories automatically.
Re: ORA-19504 - "failed to create file" [message #667086 is a reply to message #667073] Wed, 06 December 2017 10:19 Go to previous message
davebyrne
Messages: 4
Registered: December 2017
Location: UK
Junior Member
John Watson wrote on Wed, 06 December 2017 06:15
I think you are getting the expected bahaviour: your FORMAT will be applied to all the backup pieces of all the sets as they are created. You will have multiple backup sets: at least one for the datafiles and at least two for the archive logfiles.

Overall, though, the simplest solution would be to stop trying to put the backups in separate date named directories. Or if for some reason that I cannot imagine you really need these directories, you could direct the backups to the FRA and let Uncle Oracle create the date named directories automatically.
Hi, thanks for the reply.
I am happy to take that as the answer to be honest. I've spoken to the team that deployed this and there was no valid reason as to why they wanted the backups in date stamped folders, other than it looked easier to read at CLI... In production, and in the event of restoring a backup, it would matter not what folder they are in. So I've adjusted their scripts and command files to static folders one level above.

Thanks for the advice, appreciated.
Previous Topic: RMAN Another Processing Is Running
Next Topic: Restore 10.2.0.4 RAC Backup to 11.2.0.4 dbhome
Goto Forum:
  


Current Time: Tue Dec 12 09:30:34 CST 2017

Total time taken to generate the page: 0.03003 seconds