By LKBrwnDBA | Created on 2025-12-16 11:33:36
Written with a informative tone 📝 | Model: keyless-gpt-4o-mini
Exporting databases can be a complex task, especially when it comes to managing different versions and files. In this guide, we will explore how to export an Oracle database while incorporating date stamping into the file names.
Oracle's built-in export tool does not allow for direct integration of date stamps into the filename. This can make it difficult to manage multiple exports and keep track of which files are associated with specific dates.
LKBrwnDBA, a knowledgeable member of Oracle forums, provided a work-around for this issue. They created a PL/SQL procedure that opens a data pump job, sets the export parameters, and adds the date stamp to the filename.
To create the procedure, follow these steps:
The following is an example of what the modified procedure might look like:
declare
h1 NUMBER;
dt VARCHAR2(12);
begin
SELECT TO_CHAR(SYSDATE,'YYYYMMDD') INTO dt FROM DUAL;
begin
h1 := dbms_datapump.open (operation => 'EXPORT', job_mode => 'SCHEMA', job_name => 'DP_EXPORT_SSU_MONTH_END', version => 'COMPATIBLE');
end;
begin
dbms_datapump.set_parallel(handle => h1, degree => 1);
end;
begin
dbms_datapump.add_file(handle => h1, filename => 'EXPSSU'||dt||'.LOG', directory => 'EXP_DIR', filetype => 3);
end;
begin
dbms_datapump.set_parameter(handle => h1, name => 'KEEP_MASTER', value => 0);
end;
begin
dbms_datapump.metadata_filter(handle => h1, name => 'SCHEMA_EXPR', value => 'IN(''SSU'')');
end;
begin
dbms_datapump.add_file(handle => h1, filename => 'EXPSSU'||dt||'.DMP', directory => 'EXP_DIR', filetype => 1);
end;
begin
dbms_datapump.set_parameter(handle => h1, name => 'INCLUDE_METADATA', value => 1);
end;
begin
dbms_datapump.set_parameter(handle => h1, name => 'DATA_ACCESS_METHOD', value => 'AUTOMATIC');
end;
begin
dbms_datapump.set_parameter(handle => h1, name => 'ESTIMATE', value => 'BLOCKS');
end;
begin
dbms_datapump.start_job(handle => h1, skip_current => 0, abort_step => 0);
end;
begin
dbms_datapump.detach(handle => h1);
end;
end;
To implement this solution, follow these steps:
By following these steps, you can create a PL/SQL procedure that opens a data pump job, sets the export parameters, and adds the date stamp to the filename. This will make it easier to manage multiple exports and keep track of which files are associated with specific dates.
Have you encountered any issues while implementing this solution? Share your experience in the comments section below!
Sources:
- [How to Append Current Date to Export Dump file name | Tek-Tips] (https://www.tek-tips.com/threads/how-to-append-current-date-to-export-dump-file-name.1521583/)
- [Why does'nt text-align:justify work? Help | Tek-Tips] (https://www.tek-tips.com/threads/why-doesnt-text-align-justify-work-help.1690560/)
- [Coverage Paths | Tek-Tips] (https://www.tek-tips.com/threads/coverage-paths.1632312/)
- [Query a Registry Key | Tek-Tips] (https://www.tek-tips.com/threads/query-a-registry-key.860209/)
- [2 divs parallel w/o negative top: value | Tek-Tips] (https://www.tek-tips.com/threads/2-divs-parallel-w-o-negative-top-value.1254101/)
- [Moving Aplications to a new screen in C# | Tek-Tips] (https://www.tek-tips.com/threads/moving-aplications-to-a-new-screen-in-c.1416749/)
- [Microsoft VBScript runtime error '800a01b6' | Tek-Tips] (https://www.tek-tips.com/threads/microsoft-vbscript-runtime-error-800a01b6.419805/)
- [HTA new window with Parameters | Tek-Tips] (https://www.tek-tips.com/threads/hta-new-window-with-parameters.1295803/)
- [Error: Only content controls are allowed directly in a ... - Tek-Tips] (https://www.tek-tips.com/threads/error-only-content-controls-are-allowed-directly-in-a-content-page.1504551/)
- [bulleted list does not align the text on the 2nd line | Tek-Tips] (https://www.tek-tips.com/threads/bulleted-list-does-not-align-the-text-on-the-2nd-line.1640644/)