Rem
Rem $Header: imp_remap.sql 25-jun-2003.16:51:02 gtang Exp $
Rem
Rem imp_remap.sql
Rem
Rem Copyright (c) 2003, Oracle Corporation.  All rights reserved.  
Rem
Rem    NAME
Rem      imp_remap.sql - Data Mining model import demo
Rem
Rem    DESCRIPTION
Rem      This script demonstrates the use of import_model(),
Rem      to import all models from a dump exported from
Rem      a different schema
Rem
Rem    NOTES
Rem     Prerequisits:
Rem     - a dump file was created by expdp or export_model()
Rem     - the dump file sits in the directory mapped by directory 'DM_DUMP'
Rem     - 'thisuser' has READ and WRITE priviledge on 'DM_DUMP'
Rem     - 'thisuser' has IMP_FULL_DATABASE priviledge or has SYS role
Rem
Rem    MODIFIED   (MM/DD/YY) 
Rem    gtang       06/25/03 - gtang_txn107754
Rem    gtang       06/24/03 - Creation
Rem

DECLARE
  file_name VARCHAR2(40) := 'SAMP101.dmp';
  v_err_msg VARCHAR2(200);
BEGIN 
  dbms_data_mining.import_model(filename=>file_name,
                                directory=>'DM_DUMP',
                                operation=>'import',
                                schema_remap=>'scott:thisuser');
  dbms_output.put_line('IMPORT '||file_name||' completed successfully!');
  
  EXCEPTION
    WHEN OTHERS THEN 
      v_err_msg := SUBSTR(SQLERRM, 1, 200);
      dbms_output.put_line('IMPORT failed! Error='||v_err_msg);
END;
/
