Home » Infrastructure » Windows » Export .dmp files to a LAN location? (Oracle 12.2.0.1.0, Windows Server 2016)
Export .dmp files to a LAN location? [message #676847] |
Tue, 23 July 2019 01:38 |
|
Dandaman
Messages: 15 Registered: July 2019
|
Junior Member |
|
|
It is my understanding that the directory parameter of the dbms_datapump.add_file has to be a local path on the database server.
For shared infrastructure where multiple users use the same database server and want to access say a .dmp schema backup they would need to get this from a networked location they have access to and not a folder on the database server? I guess they could access a share on the Oracle database server... but really don't want any end users knowing about the server name of the Oracle server.
For specific instance the following
CREATE OR REPLACE DIRECTORY MIGDMP3 AS '\\myfileserver\dmpBackupFolder';
GRANT READ, WRITE ON DIRECTORY MIGDMP3 TO C##BBE_FRESH13;
GRANT export full database TO C##BBE_FRESH13;
DECLARE
h1 number;
s varchar2(1000);
errorvarchar varchar2(100):= 'ERROR';
tryGetStatus number := 0;
success_with_info EXCEPTION;
PRAGMA EXCEPTION_INIT(success_with_info, -31627);
begin
h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'Mig2_BBE_13v5', version => 'COMPATIBLE');
tryGetStatus := 1;
dbms_datapump.set_parallel(handle => h1, degree => 1);
dbms_datapump.add_file(handle => h1, filename => 'BBE_FRESH13v5_EXPDAT.LOG', directory => 'MIGDMP3', filetype => 3);
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 1);
dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''C##BBE_FRESH13'')');
dbms_datapump.add_file(handle => h1, filename => 'BBE_FRESH13v5_EXPDAT%U.DMP', directory => 'MIGDMP3', filesize => '100M', filetype => 1);
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS');
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
dbms_datapump.detach(handle => h1);
errorvarchar := 'NO_ERROR';
EXCEPTION
WHEN OTHERS THEN
BEGIN
IF((errorvarchar = 'ERROR')AND(tryGetStatus = 1)) THEN
DBMS_DATAPUMP.DETACH(h1);
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
RAISE;
END;
results in....
Directory MIGDMP3 created.
Grant succeeded.
Grant succeeded.
Error starting at line : 4 in command -
DECLARE
h1 number;
s varchar2(1000);
errorvarchar varchar2(100):= 'ERROR';
tryGetStatus number := 0;
success_with_info EXCEPTION;
PRAGMA EXCEPTION_INIT(success_with_info, -31627);
begin
h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'Mig2_BBE_13v5', version => 'COMPATIBLE');
tryGetStatus := 1;
dbms_datapump.set_parallel(handle => h1, degree => 1);
dbms_datapump.add_file(handle => h1, filename => 'BBE_FRESH13v5_EXPDAT.LOG', directory => 'MIGDMP3', filetype => 3);
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 1);
dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''C##BBE_FRESH13'')');
dbms_datapump.add_file(handle => h1, filename => 'BBE_FRESH13v5_EXPDAT%U.DMP', directory => 'MIGDMP3', filesize => '100M', filetype => 1);
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS');
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
dbms_datapump.detach(handle => h1);
errorvarchar := 'NO_ERROR';
EXCEPTION
WHEN OTHERS THEN
BEGIN
IF((errorvarchar = 'ERROR')AND(tryGetStatus = 1)) THEN
DBMS_DATAPUMP.DETACH(h1);
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
RAISE;
END;
Error report -
ORA-39002: invalid operation
ORA-06512: at line 32
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4932
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5183
ORA-06512: at line 12
39002. 00000 - "invalid operation"
*Cause: The current API cannot be executed because of inconsistencies
between the API and the current definition of the job.
Subsequent messages supplied by DBMS_DATAPUMP.GET_STATUS
will further describe the error.
*Action: Modify the API call to be consistent with the current job or
redefine the job in a manner that will support the specified API.
It took a while but i take
ORA-06512: at line 12 39002. 00000 - "invalid operation"
and
ORA-39002: invalid operation
as it has issues with this network location. Like access denied/no write permissions etc.
I see the service is running under "NT SERVICE\OracleServerXXX". And do see from post http://www.orafaq.com/forum/m/653950/?srch=network+directory#msg_653950 that giving this network access could open up security holes.
So what is the best approach for creating a .dmp file in a LAN location?
To answer my own question the best approach is:
1. Never to export directly to network location. (Security/export performance)?
2. Always export locally and make the user get the file from the shared folder from the Oracle Database server?
3. Export locally and automate synchronisation of that folder to clients shared network folder?
4. Export to UNC and do XXX to allow it to happen?
|
|
|
|
|
Re: Export .dmp files to a LAN location? [message #676850 is a reply to message #676847] |
Tue, 23 July 2019 06:49 |
John Watson
Messages: 8963 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I would think it unlikely that the Windows account under which the database instance is running would have any sort of permissions on a UNC path to a remote machine. So you'll have to do it the other way: give your users access to the DB server's file system. It does rather beg the question "why?". Backup and restore/recover (which Data Pump is certainly not) would usually be the DBA's responsibility, not the users'.
[Updated on: Tue, 23 July 2019 06:52] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: Export .dmp files to a LAN location? [message #676895 is a reply to message #676885] |
Thu, 25 July 2019 19:26 |
|
Dandaman
Messages: 15 Registered: July 2019
|
Junior Member |
|
|
Yeah the NETWORK_LINK created via the CREATE DATABASE LINK or CREATE PUBLIC DATABASE LINK.
My understanding is that is for direct database to database connection. That could work but still want to go down the physical export and import process. So the .dmp can be restore on another Oracle server in another premises or within the same one.
[Updated on: Thu, 25 July 2019 19:26] Report message to a moderator
|
|
|
Re: Export .dmp files to a LAN location? [message #676908 is a reply to message #676895] |
Fri, 26 July 2019 07:25 |
|
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
Dandaman wrote on Thu, 25 July 2019 19:26Yeah the NETWORK_LINK created via the CREATE DATABASE LINK or CREATE PUBLIC DATABASE LINK.
My understanding is that is for direct database to database connection. That could work but still want to go down the physical export and import process. So the .dmp can be restore on another Oracle server in another premises or within the same one.
If I read that correctly, you want to "go down the physical export and import process" because you believe it is required, it is the only way, to "restore on another Oracle server in another premises". I my understanding of your reasoning is correct, then your assumption is incorrect. A database link can work across any two databases, as long as there is network connectivity. Those two databases can be anywhere.
You have two options as has already been discussed ad nauseum:
1) Create a disk storage area that is mounted on, available to, both the source database and target database. As for keeping the .dmp files of different users/schemas/developers separate, you could either:
1a) actually create different directories on the source server, with matching directory objects within the database.
1b) use a single directory, but establish naming conventions for the different users' dmp files. That would be simpler, and would be my preference if using shared disk. I see no problem with different users seeing others' dmp files, as long as they can differentiate whose is whose.
2) Direct import over database link.
|
|
|
Goto Forum:
Current Time: Mon Jan 20 15:49:01 CST 2025
|