Datapump export
-
07-10-2020 - |
Question
I'm trying to export the full database using the datapump API, I tried to use this following code:
DECLARE
handle NUMBER;
nom_job varchar(25) := to_char(SYSDATE,'YYYYMMDD_HH24MISS');
nom_dump varchar(25) := nom_job || '.dmp';
nom_log varchar(25) := nom_job || '.log';
BEGIN
handle := SYS.DBMS_DATAPUMP.OPEN(
operation => 'EXPORT',
job_mode => 'FULL',
job_name => nom_job
);
SYS.DBMS_DATAPUMP.ADD_FILE(
handle => handle,
filename => nom_dump,
directory => 'C:\Backup_folder',
filetype => 1
);
SYS.DBMS_DATAPUMP.ADD_FILE(
handle => handle,
filename => nom_log,
directory => 'C:\Backup_folder',
filetype => 3
);
SYS.DBMS_DATAPUMP.START_JOB(
handle => handle,
skip_current => 0,
abort_step => 0
);
SYS.DBMS_DATAPUMP.DETACH(
handle=> handle
);
END;
But it gives me this next error:
ORA-39001: valeur d'argument non valide
ORA-06512: à "SYS.DBMS_SYS_ERROR", ligne 79
ORA-06512: à "SYS.DBMS_DATAPUMP", ligne 2926
ORA-06512: à "SYS.DBMS_DATAPUMP", ligne 3162
ORA-06512: à ligne 21
39001. 00000 - "invalid argument value"
*Cause: The user specified API parameters were of the wrong type or
value range. Subsequent messages supplied by
DBMS_DATAPUMP.GET_STATUS will further describe the error.
*Action: Correct the bad argument and retry the API.
the line 21 is :
SYS.DBMS_DATAPUMP.ADD_FILE(
Where is the problem exactly in that function?
Solution
In the Argument 'Directory' of the ADD_FILE procedure, i should specify the name of the directory created by the next command instead of the actual path:
create directory backup_folder as 'C:\backup_folder'
PS: the name of the directory specified in ADD_FILE should be in upper case (CAPITAL LETTERS).
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange