Linux database sending a file to Windows share

I am using TOAD for Oracle 12.12.0.39. I have been at my job since 11/2016, and have used TOAD for Windows based 11g and 12c databases. My group recently switched our 12c version to use the Linux OS. I was able to successfully connect to it and use all the functionality I have on Windows databases, until today.

We have a procedure that gathers information from the database, produces a file, then sends that file to another server. On Windows, we just created the file on the Oracle server and sent it on. With Linux, the tool we use to send the file, will not work. Therefore, the idea of a staging server was brought up. We did so and did a proof of concept by creating the file and saving it on a share on the staging server. It worked great. To do so, I added the path of the shared drive (\servername\directory) in Oracle Directories (for the database user). I connected to the Linux database in TOAD and changed the shared drive path to //servername/directory. When I run the procedure to build and send the file, I get an ORA-29283. I had the SysAdmin do the following:

mount -t cifs -o username=(domain user),domain= //servername/foldername /mnt/cifs/sharename

I can now see the drive on the Linux box, but cannot use the simple //servername/directory in Oracle Directories.

My colleagues and I have come to the conclusion that I am running TOAD on a Windows 7 box, connecting to a Linux 7 database, trying to access a share on a Windows Server 2012 R2 box... something is getting lost in translation. I can't find anyone that has a similar problem. Before I waste much more time on this, is what we want to do even possible? If so, how do I need to enter the directory path in Oracle Directories? Thank you in advance.

I connected to the Linux database in TOAD and changed the shared drive path to //servername/directory.

There is probably a better way to do this, but what if you reference the mount point as your directory path, instead. Have you tried setting directory value to /mnt/cifs/sharename?

Yes. Tried that first. Same errors.

AskTom has a few suggestions in case you've not tried all of them. In particular making sure your Linux user owning your Oracle database has proper privs to the folder.

We did so and did a proof of concept by creating the file and saving it on a share on the staging server. It worked great.

Oracle user may already have access based on this comment. Do you mean your proof of concept tested your entire process through your staging server/db, but not using Toad or did you simply log into the staging server and create a file and save it elsewhere, not using the database to do so?

Tried everything through TOAD. Tried as myself (SYSDBA) and the SYS user. Same results. The Windows to Windows worked find. The Linux to Windows did not. We created the file in Windows to Windows with the procedure that was written to do so. We attempted the same with the Linux database, via TOAD, but that didn't work.

I believe you have permissions issues. I just did some tests here and this is what I see.

  1. Setup a Windows share, set permissions to Full Control for Everyone

On Ubuntu hosting my XE instance I mounted it simply using this command...

sudo mkdir /mnt/test_share
sudo mount -t cifs -o username=WinShareUser,password=WinSharePassword //192.168.1.146/Shared /mnt/test_share

In Toad I created a directory named TEST_DIR pointing to /mnt/test_share.

I ran the following anonymous block to test...

DECLARE
    out_File   UTL_FILE.FILE_TYPE;
BEGIN
    out_File := UTL_FILE.FOPEN ('TEST_DIR', 'test_file.txt', 'W');

    UTL_FILE.PUT_LINE (out_file, 'Hello, world');
    UTL_FILE.FCLOSE (out_file);
END;

...and I received the same ORA-29283 as you.

In Ubuntu I re-mounted giving my Oracle user permissions.

While logged in as my Oracle linux user...

sudo umount /mnt/test_share
sudo mount -t cifs -o username=WinShareUser,password=WinSharePassword,uid=$(id -u),gid=$(id -g) //192.168.1.146/Shared /mnt/test_share

Back in Toad I re-ran the anonymous block from above and it worked. The file was created and I'm looking at it in my Windows machine.

Thank you! That made quite a few lights come on. Hopefully we can get it working today.

I don't know if this is related, but we're trying to send email from the Linux server. In Windows, we use this Procedure:

PROCEDURE send_mail
    AS
    BEGIN
        sys.UTL_MAIL.Send (Sender       => 'From address',
                           Recipients   => 'To address(es)',
                           Cc           => NULL,
                           Bcc          => NULL,
                           Subject      => 'Test Email to indicate smtp is working from Oracle',
                           MESSAGE      => 'Test Email to indicate smtp is working from Oracle',
                           Priority     => 1,
                           mime_type    => 'text/html',
                           Replyto      => 'No_reply@from email domain');
    END send_mail;

When attempting to execute it (via TOAD) I get the following error:
image

Is it possible this is permission problems also? Thank you in advance.

I have no idea. Despite using Xubuntu as my host machine OS for over 5 years I'm mostly clueless here :slight_smile:

I've wasted (invested) much time Googling such issues and working through the resources I could locate. My guess it you just have some configuration to do on the Linux box and might be spending your afternoon sorting through search results until something hits on your issue... starting with the basics like making sure SMTP service is installed and running, making sure the Linux account owning your Oracle database has proper rights to use it, etc.

It could be a permission problem. Just about Anything you ask the DB to do on the OS is going to be performed as the ORACLE user on the OS. So permissions of the oracle user is a good place to start. (maybe log in as oracle on the server and see if you can send an email using OS commands/tools)

Thank you. I am revisiting Oracle on a Linux/Unix platform after years of supporting Windows based Oracle servers.

One thing I'm going to try. Thank you very much