Skip to Main Content
  • Questions
  • Export Oracle Label Security info from one DB to be imported into another DB

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Valerio.

Asked: October 24, 2025 - 10:11 pm UTC

Last updated: October 27, 2025 - 1:28 am UTC

Version: Oracle DB 19.25

You Asked

Hi Sir,

I'm trying to copy the Oracle Label Security information from one database and apply it to another one.

I tried to use expdp/impdp and dbms_metadata.get_ddl, but I didn't have success using them.

Is there a special package or tool to get this work done?

Thanks in advance.
Valerio Almeida

and Connor said...

In chapter 15 of the administrators guide

https://docs.oracle.com/en/database/oracle/oracle-database/21/olsag/label-security-administrators-guide.pdf

the use of DataPump is covered. In a nutshell

- full database export/import should handle it for you (as long you as have the FULL priv which entitles you to see everything). The LBACSYS schema will be cloned over.
- schema/table level requires a few more prereqs, eg

EXECUTE privilege on the SA_POLICY_ADMIN package
FULL privilege to write the labels

and pre-creating labels before import, eg

set serveroutput on
BEGIN
 dbms_output.put_line('BEGIN');
 FOR l IN (SELECT label_tag, label
 FROM dba_sa_labels
 WHERE policy_name='HR'
 ORDER BY label_tag) LOOP
 dbms_output.put_line
 (' SA_LABEL_ADMIN.CREATE_LABEL(''HR'', ' ||
 l.label_tag || ', ''' || l.label || ''');');
 END LOOP;
 dbms_output.put_line ('END;');
 dbms_output.put_line ('/');
END;
/


but please check chapter 15 to get the complete set of requirements/tasks.


More to Explore

Data Pump

All of the database utilities including Data Pump are explained in the Utilities guide.