dbms_datapump error

I have oracle 10g installed on my system.

I created an expdir file and add the oracle directory.

For datapump, I ran this:

declare
number of H1;
Start
H1: = dbms_datapump.open ('EXPORT', 'SCHEMA');
dbms_datapump.add_file (h1, 'exp1.dmp', 'expdir');
dbms_datapump.metadata_filter (h1, 'schema_expr', '= "hr" ');
dbms_datapump.set_parallel (h1, 4);
dbms_datapump. START_JOB (H1);
dbms_datapump. Detach (H1);
end;
/

and got this error:

ERROR on line 1:
ORA-39001: invalid argument value
ORA-06512: at "SYS." DBMS_SYS_ERROR', line 79
ORA-06512: at "SYS." DBMS_DATAPUMP', line 2926
ORA-06512: at "SYS." DBMS_DATAPUMP', line 3162
ORA-06512: at line 5


Any help-

Robette,

Use this example and replace by your directory and schemaname and jobname.

SET SERVEROUTPUT ON SIZE 1000000

DECLARE
   l_dp_handle        NUMBER;
   l_last_job_state   VARCHAR2 (30) := 'UNDEFINED';
   l_job_state        VARCHAR2 (30) := 'UNDEFINED';
   l_sts              ku$_status;
BEGIN
   l_dp_handle   :=
      DBMS_DATAPUMP.open (operation => 'EXPORT',
                          job_mode => 'SCHEMA',
                          remote_link => NULL,
                          job_name => 'RET_EXPORT',
                          version => 'LATEST'
      );

   DBMS_DATAPUMP.add_file (handle => l_dp_handle,
                           filename => 'myexport.dmp',
                           directory => 'EXPORT_DIR'
   );

   DBMS_DATAPUMP.add_file (handle => l_dp_handle,
                           filename => 'myexport.log',
                           directory => 'EXPORT_DIR',
                           filetype => DBMS_DATAPUMP.ku$_file_type_log_file
   );

   DBMS_DATAPUMP.metadata_filter (handle => l_dp_handle,
                                  name => 'SCHEMA_EXPR',
                                  VALUE => '= ''MYSCHEMA'''
   );

   DBMS_DATAPUMP.start_job (l_dp_handle);

   DBMS_DATAPUMP.detach (l_dp_handle);
END;
/

Concerning

Tags: Database

Similar Questions

  • DBMS_DATAPUMP.metadata_remap - a matter of REMAP_TABLE.

    I want to export SCOTT. DEPT table and imports than HR. DEPT_HR with constraint. I'm using DBMS_METADATA. METADATA_REMAP with REMAP_SCHEMA (to change the schema anme) and REMAP_TABLE (to change the name of the table). I don't know where I am getting the error. It seems that REMAP_SCHEMA is changing all the names of schema successfully, but REMAP_TABLE does not change the name of the table on the constraint. So constraint is not be created. Is there another workaround solution? Here is a small proof of concept:

    SQL> --My database version.
    SQL> ----------------------
    SQL> SELECT * FROM v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> SET SERVEROUT ON
    SQL> ed
    Wrote file afiedt.buf
    
      1  DECLARE
      2  l_data_pump_handle    NUMBER;
      3  l_logfilename    VARCHAR2(30) := 'DWABI_'||to_char(sysdate, 'DDMMRRRRhh24miss') || '.log';
      4  l_expfilename    VARCHAR2(30) := 'DWABI_'||to_char(sysdate, 'DDMMRRRRhh24miss') || '.dmp';
      5  BEGIN
      6  l_data_pump_handle:= DBMS_DATAPUMP.OPEN(operation   => 'EXPORT',
      7                        job_mode    => 'TABLE',
      8                        remote_link => NULL,
      9                        job_name    => 'TEST_REMAP_DP',
    10                        version     => 'LATEST');
    11   DBMS_DATAPUMP.ADD_FILE(handle    => l_data_pump_handle,
    12                     filename    => l_expfilename,
    13                     directory => 'SAUBHIK',
    14                     filetype    => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
    15  DBMS_DATAPUMP.ADD_FILE(handle    => l_data_pump_handle,
    16                     filename    => l_logfilename,
    17                     directory => 'SAUBHIK',
    18                     filetype    => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
    19   DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle,
    20                        name   => 'SCHEMA_EXPR',
    21                        value  =>'= '||''''||'SCOTT'||'''');
    22   DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle,
    23                        name   => 'NAME_EXPR',
    24                        value  =>'= '||''''||'DEPT'||'''');
    25  --We don't need index
    26    DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle,
    27                        name   => 'EXCLUDE_PATH_EXPR',
    28                        value  =>'=''INDEX''');
    29  -- We don't copy table statistics!!
    30    DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle,
    31                        name   => 'EXCLUDE_PATH_EXPR',
    32                        value  =>'=''STATISTICS''');
    33   -- We don't copy index statistics either!!
    34    DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle,
    35                        name   => 'EXCLUDE_PATH_EXPR',
    36                        value  =>'=''INDEX_STATISTICS''');
    37    -- We do not need the data!!
    38    DBMS_DATAPUMP.DATA_FILTER(
    39     handle => l_data_pump_handle,
    40     name => 'INCLUDE_ROWS',
    41     value =>0
    42     );
    43  -- Start the export now.
    44       DBMS_DATAPUMP.start_job(l_data_pump_handle);
    45       dbms_output.put_line('Export started....');
    46   -- Detach, it's finish!
    47      DBMS_DATAPUMP.detach(l_data_pump_handle);
    48      dbms_output.put_line('Export ended....');
    49  EXCEPTION
    50       WHEN OTHERS THEN
    51        dbms_datapump.stop_job(l_data_pump_handle);
    52        RAISE;
    53*  END;
    54  /
    Export started....
    Export ended....
    
    PL/SQL procedure successfully completed.
    
    SQL> SELECT * FROM user_datapump_jobs;
    
    no rows selected
    
    
    
    

    Now, I'm importing that:

    SQL> ed
    Wrote file afiedt.buf
    
      1  --DWABI_28052015143133.dmp
      2  DECLARE
      3  l_data_pump_imp_handle NUMBER;
      4  l_logfilename  VARCHAR2(30) := 'DWABI_'||to_char(sysdate, 'DDMMRRRRhh24miss') || '.log';
      5  ind       NUMBER;        -- loop index
      6   pct_done  NUMBER;        -- percentage complete
      7   job_state VARCHAR2(30);  -- track job state
      8   le        ku$_LogEntry;  -- WIP and error messages
      9   js        ku$_JobStatus; -- job status from get_status
    10   jd        ku$_JobDesc;   -- job description from get_status
    11   sts       ku$_Status;    -- status object returned by get_status
    12  BEGIN
    13  l_data_pump_imp_handle:= DBMS_DATAPUMP.OPEN(operation   => 'IMPORT',
    14                        job_mode    => 'FULL',
    15                        remote_link => NULL,
    16                        job_name    => 'TEST',
    17                        version     => 'LATEST');
    18   DBMS_DATAPUMP.ADD_FILE(handle    => l_data_pump_imp_handle,
    19                     filename    => 'DWABI_28052015143133.dmp',
    20                     directory => 'SAUBHIK',
    21                     filetype    => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
    22  DBMS_DATAPUMP.ADD_FILE(handle    => l_data_pump_imp_handle,
    23                     filename    => l_logfilename,
    24                     directory => 'SAUBHIK',
    25                     filetype    => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
    26   --If table is already there then do not import.
    27   dbms_datapump.set_parameter(handle => l_data_pump_imp_handle,
    28                              name => 'TABLE_EXISTS_ACTION',
    29                              value =>'SKIP');
    30    -- We need to remap the schema!!.
    31    dbms_output.put_line('Changing Schema...');
    32    DBMS_DATAPUMP.METADATA_REMAP (
    33     handle => l_data_pump_imp_handle,
    34     name => 'REMAP_SCHEMA',
    35     old_value => 'SCOTT',
    36     value=>'HR'
    37     );
    38    -- We need to remap the table!!. This is not working properly.
    39    dbms_output.put_line('Changing Table...');
    40    DBMS_DATAPUMP.METADATA_REMAP (
    41     handle => l_data_pump_imp_handle,
    42     name => 'REMAP_TABLE',
    43     old_value => 'DEPT',
    44     value=>'DEPT_HR',
    45     object_type => NULL
    46     );
    47   -- Start the import now.
    48       DBMS_DATAPUMP.start_job(l_data_pump_imp_handle);
    49    -- monitor job
    50    pct_done := 0;
    51    job_state := 'UNDEFINED';
    52    WHILE (job_state != 'COMPLETED') AND (job_state != 'STOPPED') LOOP
    53      dbms_datapump.get_status(l_data_pump_imp_handle, dbms_datapump.ku$_status_job_error +
    54      dbms_datapump.ku$_status_job_status +
    55      dbms_datapump.ku$_status_wip, -1, job_state, sts);
    56      js := sts.job_status;
    57      -- If the percentage done changed, display the new value
    58      IF js.percent_done != pct_done THEN
    59        dbms_output.put_line('*** Job percent done = ' ||
    60        to_char(js.percent_done));
    61        pct_done := js.percent_done;
    62      END IF;
    63      -- If any work-in-progress (WIP) or error messages
    64      -- were received for the job, display them.
    65      IF (BITAND(sts.mask,dbms_datapump.ku$_status_wip) != 0) THEN
    66        le := sts.wip;
    67      ELSE
    68        IF (BITAND(sts.mask,dbms_datapump.ku$_status_job_error) != 0) THEN
    69          le := sts.error;
    70        ELSE
    71          le := NULL;
    72        END IF;
    73      END IF;
    74      IF le IS NOT NULL THEN
    75        ind := le.FIRST;
    76        WHILE ind IS NOT NULL LOOP
    77          dbms_output.put_line(le(ind).LogText);
    78          ind := le.NEXT(ind);
    79        END LOOP;
    80      END IF;
    81      --DBMS_LOCK.sleep (10);
    82    END LOOP;
    83    -- Indicate that the job finished and detach from it.
    84    dbms_output.put_line('Job has completed');
    85   -- Detach, it's finish!
    86       DBMS_DATAPUMP.detach(l_data_pump_imp_handle);
    87  EXCEPTION
    88       WHEN OTHERS THEN
    89        dbms_datapump.stop_job(l_data_pump_imp_handle);
    90        RAISE;
    91* END;
    SQL> /
    Changing Schema...
    Changing Table...
    Master table "SYS"."TEST" successfully loaded/unloaded
    Starting "SYS"."TEST":
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    ORA-39083: Object type CONSTRAINT failed to create with error:
    ORA-00942: table
    or view does not exist
    Failing sql is:
    ALTER TABLE "HR"."DEPT" ADD CONSTRAINT
    "PK_DEPT" PRIMARY KEY ("DEPTNO") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE
    DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS"  ENABLE
    
    Job "SYS"."TEST" completed with 1 error(s) at 15:04:02
    Job has completed
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
    
    
    

    If you look at the failing sql code, it is clear that the name of the table in the constraint definition has not changed, but the DEPT_HR table is created in the HR schema without constraint. What's not here?

    Post edited by: Massimiliano edited the subject line, because he said as DBMS_METADATA. Changed to DBMS_DATAPUMP.

    Hello

    This is a bug in 11.2.0.1 I think - please this Ref

    Oracle Support Document 1609238.1 (REMAP_TABLE on IMPDP FAILS WITH ORA-942) can be found at: https://support.oracle.com/epmos/faces/DocumentDisplay?id=1609238.1

    See you soon,.

    Rich

  • Error when using dbms_pumpdata to export data

    DECLARE

    l_dp_handle NUMBER;

    BEGIN

    l_dp_handle: =.

    DBMS_DATAPUMP. Open (operation = > 'EXPORT', job_mode = > 'TABLE');

    dbms_datapump.

    add_file (manage = > l_dp_handle)

    , file name = > 'scott_tb_emp.dmp '.

    , Directory = > 'DB_DUMP_DIR '.

    , file type = > DBMS_DATAPUMP. KU$ _file_type_dump_file);

    dbms_datapump.

    add_file (manage = > l_dp_handle)

    , file name = > 'scott_tb_emp.log '.

    , Directory = > 'DB_DUMP_DIR '.

    , file type = > DBMS_DATAPUMP. KU$ _file_type_log_file);

    DBMS_DATAPUMP.metadata_filter (manage = > l_dp_handle)

    , name = > 'NAME_EXPR '.

    , VALUE = > "=" MYTABLE ".

    object_type = > 'TABLE');

    DBMS_DATAPUMP.data_filter (manage = > l_dp_handle)

    , name = > 'subquery '.

    , VALUE = > ' WHERE DT < "11-01-2010"'

    table_name = > 'MYTABLE');

    DBMS_DATAPUMP. START_JOB (l_dp_handle);

    DBMS_DATAPUMP. Detach (l_dp_handle);

    END;

    I want to export a subset of the data in MYTABLE, it gave error

    11:17:54 [DECLARE - 0 row (s), dry 0.000] [error Code: 39001, SQL State: 99999] ORA-39001: invalid argument value

    ORA-06512: at "SYS." DBMS_SYS_ERROR', line 79

    ORA-06512: at "SYS." DBMS_DATAPUMP', line 3444

    ORA-06512: at "SYS." DBMS_DATAPUMP', line 3693

    ORA-06512: at line 6

    ... 1 instructions executed, 0 row (s) affected, exec/fetch time: dry 0.000/0.000 [success, 0 0 warnings, errors 1]

    Hello

    Check this test, can I get the successful dump file

    SQL > DECLARE

    l_dp_handle NUMBER;

    job_status VARCHAR2 (30);

    BEGIN

    l_dp_handle: =.

    DBMS_DATAPUMP. Open (operation => 'EXPORT', job_mode => 'TABLE');

    dbms_datapump.

    add_file (grip-online l_dp_handle

    , name of file-online "scott_tb_emp.dmp."

    , directory-online "DATA_DD_DIR."

    type of file-online DBMS_DATAPUMP. KU$ _file_type_dump_file);

    dbms_datapump.

    add_file (grip-online l_dp_handle

    , name of file-online "scott_tb_emp.log."

    , directory-online "DATA_DD_DIR."

    type of file-online DBMS_DATAPUMP. KU$ _file_type_log_file);

    DBMS_DATAPUMP.metadata_filter (handle-online l_dp_handle

    , name-online "NAME_EXPR."

    , VALUE => "=" EMP ".

    object_type => 'TABLE');

    DBMS_DATAPUMP.data_filter (handle-online l_dp_handle

    , name-online 'subquery '.

    , VALUE => ' WHERE SAL > 1000'

    table_name => 'EMP');

    DBMS_DATAPUMP. START_JOB (l_dp_handle);

    dbms_output.put_line ('DataPump Export -' | to_char (sysdate, ' DD/MM/YYYY HH24:MI:SS') |) "Status" | " job_status);

    DBMS_DATAPUMP. Detach (l_dp_handle);

    END;

    2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

    32.

    PL/SQL procedure successfully completed.

    SQL >! ls - lrt | tail

    Total 144

    -rw-rw-r - oracle oracle 1 858 13 Oct 11:08 scott_tb_emp.log

    -rw - rw - 1 Oct 13 110592 oracle oracle 11:08 scott_tb_emp.dmp

    SQL >! Cat scott_tb_emp.log

    Check out 'ME '. "" SYS_EXPORT_TABLE_01:

    Current estimation using BLOCKS method...

    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

    Total estimation using BLOCKS method: 64 KB

    Object type TABLE_EXPORT/TABLE/TABLE processing

    Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

    Object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS of treatment

    Processing object type TABLE_EXPORT/TABLE/AUDIT_OBJ

    Object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS treatment

    . . 'ME' exported. "" EMP "13 lines 8,515 KB

    Master table 'ME '. "" SYS_EXPORT_TABLE_01 "properly load/unloaded

    ******************************************************************************

    Empty the files together for me. SYS_EXPORT_TABLE_01 is:

    /Home/Oracle/MYSHELL/scott_tb_emp.dmp

    Job 'ME '. "" SYS_EXPORT_TABLE_01 "carried out at 11:08:47

    SQL > select count (*) from emp where sal > 1000;

    COUNT (*)

    ----------

    13

    Hope this helps

  • Import (IMPDP) error 4031

    Aloha!

    I'm currently import a dump with a parameter.

    the system schemas Impdp = name directory = BW_TEMP TABLE_EXISTS_ACTION = REPLACE dumpfile = DUMP. Logfile = log.log DMP

    and import, I encountered this error;

    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

    . . imported 'name '. "' TABLE ' lines of 13.08 82007 MB

    . . imported 'name '. "' TABLE_T ' lines of 12.98 MB 81392

    UDI-04031: operation has generated ORACLE 4031 error

    ORA-04031: unable to allocate 32 bytes of memory ('pool', ' SELECT job_id FROM v$ datapum... ") (', 'SQLA","tmp") shared

    ORA-06512: at "SYS." "KUPV$ FT_INT", line 2904

    ORA-06512: at "SYS." ' KUPC$ QUE_INT ', line 572

    ORA-25254: time-out in LISTENING while waiting for a message

    ORA-06512: at "SYS." DBMS_DATAPUMP', line 3263

    ORA-06512: at "SYS." DBMS_DATAPUMP', line 4488

    ORA-06512: at line 1


    =====================================

    SQL > show sga

    Total System Global Area 367439872 bytes

    Bytes of size 2213456 fixed

    293603760 variable size bytes

    Buffers data 67108864 bytes

    Redo buffers 4513792 bytes

    SQL >

    Above are my parameter.

    The system is 11g R2 on OLE5

    Your help is greatly appreciated.

    Kind regards

    Hades

    Hello

    You may need to increase the value of the SGA. also check the doc of metalink:

    Troubleshooting and diagnosis of error ORA-4031 [Video] [ID 396940.1]

    HTH

  • dbms_datapump.data_remap is to have question in the edition of the Oracle SE

    Hello

    Is there no difference b/w the function dbms_datapump.data_remap and EE edition of oracle.

    I have my code in the environment have complied and Edition oracle EE works data_remap fine function remapping table all I need in my database.
    but in the edition SE it gives Oracle error

    ORA-31623: a job is not attached to this session by the specified handle.

    I use the database to Oracle 11 g Release 11.2.0.3.0 - 64 bit Production database SE

    and Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production of EE database.

    I just want to clarify this dbms_datapump have any question in SE or not (IE it's functionality is available in SE)?

    Thank you.

    Hello
    I don't think that DATA_REMAP it is different between the two versions behave. Are you sure that the user is configured correctly - the most common cause of the error you are getting is that the user who runs the datapump doesn't have explicit "create table" privilege.

    Try running:

    grant create table to xx;

    where xx is the user, and then try again.

    If this help not try to add an exception block similar to the one I posted here: http://dbaharrison.blogspot.de/2013/05/dbmsdatapump-finding-out-what-actual.html

    See you soon,.
    Harry

  • dbms_datapump import dblink ORA-39165

    Hi all

    I try to import a table on a from dblink to a diagram a diagram b but I get ORA-39165 scheme ('A') has not been found. and ORA-39166 object ('ACCOUNT') has not been found. When you try to import b to b it works but oddly always saves an ORA-39166. User B has imp_full_database and permission on two databases:

    declare
    Number of JobHandle;
    JS varchar2 (9); -COMPLETED or STOPPED
    q varchar2 (1): = chr (39);


    BEGIN / * open a new level of schema import job using a link to default DB * /.
    JobHandle: = dbms_datapump.open (operation = > 'IMPORT',)
    job_mode = > 'TABLE',
    remote_link = > "MRT");

    dbms_datapump.add_file (JobHandle,
    filename = > "mylog";
    Directory = > 'DATA_PUMP_DIR. "
    filetype = > dbms_datapump.ku$ _file_type_log_file);

    dbms_datapump.metadata_remap (manage = > JobHandle,)
    name = > 'REMAP_SCHEMA ',.
    old_value = > "A"
    value = > 'B');

    dbms_datapump.metadata_filter (manage = > JobHandle,)
    name = > 'SCHEMA_EXPR ',.
    value = > "IN"A","
    object_type = > 'TABLE');

    dbms_datapump.metadata_filter (manage = > JobHandle,)
    name = > 'NAME_LIST;
    ' value = > '('' COMPTE ''), '
    object_type = > 'TABLE');

    dbms_datapump.set_parameter (JobHandle,
    "TABLE_EXISTS_ACTION."
    'REPLACE');

    dbms_datapump. START_JOB (JobHandle);

    dbms_datapump.wait_for_job (JobHandle, js);

    end;

    For the life of me I don't understand how can I tell him that the source table is in A diagram. Any help would be greatly appreciated.

    Thank you very much

    Ok. Then you export in job_mode SCHEME and patterns of filter and tables, using metadata filter with SCHEMA_EXPR and INCLUDE_PATH_EXPR.

    Using the code you provided, here it is changed:

    declare
      JobHandle number;
      js varchar2(9); -- COMPLETED or STOPPED
      q varchar2(1) := chr(39); 
    
    BEGIN /* open a new schema level import job using a default DB link */
      JobHandle := dbms_datapump.open (operation=>'IMPORT', job_mode=>'SCHEMA', remote_link=>'RMT'); 
    
      dbms_datapump.add_file (JobHandle, filename => 'mylog', directory => 'DATA_PUMP_DIR', filetype => dbms_datapump.ku$_file_type_log_file);
      ---
      DBMS_DATAPUMP.metadata_filter (handle=> JobHandle, name=> 'SCHEMA_EXPR',VALUE=> 'IN(''A'')');
      dbms_datapump.metadata_filter (handle => JobHandle,name => 'INCLUDE_PATH_EXPR',value => 'IN (''TABLE'')');
      --
      dbms_datapump.metadata_remap ( handle=>JobHandle,name=> 'REMAP_SCHEMA',old_value=> 'A',value=> 'B');
      dbms_datapump.metadata_filter (handle =>JobHandle, name =>'NAME_LIST', value =>'(''ACCOUNT'')',object_type => 'TABLE');
      dbms_datapump.set_parameter ( JobHandle,'TABLE_EXISTS_ACTION','REPLACE' );
    
      dbms_datapump.start_job( JobHandle);
      dbms_datapump.wait_for_job( JobHandle, js);
    end;
    /
    

    I tested it with 10.2.0.3 on both sites, and it worked:

    -- mylog.log content:
    
    Starting "B"."SYS_IMPORT_SCHEMA_03":
    Estimate in progress using BLOCKS method...
    Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
    Total estimation using BLOCKS method: 64 KB
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    . . imported "B"."ACCOUNT"                                    1 rows
    Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
    ORA-39083: Object type OBJECT_GRANT failed to create with error:
    ORA-01749: you may not GRANT/REVOKE privileges to/from yourself
    Failing sql is:
    GRANT SELECT ON "B"."ACCOUNT" TO "B"
    ORA-39166: Object ('ACCOUNT') was not found.
    Job "B"."SYS_IMPORT_SCHEMA_03" completed with 2 error(s) at 17:35:40
    

    And the table was created to the destination site:

    B@local> select * from account;
             N
    ----------
             1
    

    If you do not have a direct subsidy that B A.ACCOUNT on the remote site, then you will see this output, but the table is imported anyway:

    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    . . imported "B"."ACCOUNT"                                    1 rows
    ORA-39166: Object ('ACCOUNT') was not found.
    

    Kind regards.
    Nelson

  • Backup error DataPump

    Hello
    I have created a backup of datapump task which suppose to repeat every day using the following script. But it fails after an execution to return an error-"ORA-39000: bad dump file specification"
    ORA-31641: failed to create the dump file 'e:\oracledmp\EXPDAT01. DMP ".
    ORA-27038: created file already exists
    OSD-04010: < create > option specified, the file already exists.

    How can I replace the file. or how I can set some parameters to the file in which each name may be different. Thanks in advance
    ----------------------------------------------------
    PL/SQL declares
    NUMBER of H1;
    Start
    Start
    H1: = dbms_datapump.open (operation = > 'EXPORT', job_mode = > job_name 'FULL' = > 'EXPORTFullDB', version = > 'COMPATIBLE');
    end;
    Start
    dbms_datapump.set_parallel (handle = > h1, degree = > 1);
    end;
    Start
    dbms_datapump.add_file (handle = > h1, filename = > ' EXPDAT.) (Login", directory = >"Dmp", filetype = > 3);
    end;
    Start
    dbms_datapump.set_parameter (handle = > h1, name = > 'KEEP_MASTER', value = > 0);
    end;
    Start
    dbms_datapump.set_parameter (handle = > h1, name = > "ESTIMATION", value = > 'BLOCKS');
    end;
    Start
    dbms_datapump.add_file (handle = > h1, filename = > 'EXPDAT%U.DMP', directory = > "Dmp", filetype = > 1);
    end;
    Start
    dbms_datapump.set_parameter (handle = > h1, name = > 'INCLUDE_METADATA', value = > 1);
    end;
    Start
    dbms_datapump.set_parameter (handle = > h1, name = > 'DATA_ACCESS_METHOD', value = > "AUTOMATIC").
    end;
    Start
    dbms_datapump. START_JOB (handle = > h1, skip_current = > 0, abort_step = > 0);
    end;
    Start
    dbms_datapump. Detach (handle = > h1);
    end;
    end;

    dbms_datapump.add_file (handle-online h1, => 'EXPDAT%U.DMP' file name, directory => "Dmp" file-online 1 type);

    You could do something like:

    declare
    mydate:=to_char(sysdate,'yyyymmddhh24miss');
    begin
    dbms_datapump.add_file(handle => h1, filename => 'EXPDAT_'||mydate||'_%U.DMP', directory => 'Dmp', filetype => 1);
    end;
    

    Nicolas.

  • DBMS_DATAPUMP. OPEN

    Hello

    I am a newbie in PL/SQL & DATAPUMP!

    I tried to generate (OPEN) IMPORT-WORK with:
    CREATE OR REPLACE PROCEDURE XX IS
    BEGIN
      BEGIN
        DECLARE
          HANDLE1 NUMBER;
        BEGIN
          HANDLE1 := DBMS_DATAPUMP.OPEN(OPERATION   => 'IMPORT',
                                        JOB_MODE    => 'SCHEMA',
                                        REMOTE_LINK => 'STRM');
          DBMS_OUTPUT.PUT_LINE('HANDLE1 :' || HANDLE1);
        EXCEPTION
          WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('EX_HANDLE1 :' || HANDLE1);
            DBMS_OUTPUT.PUT_LINE('Import Error 1 :' || SQLERRM(SQLCODE));
        END;
      
      END;
    END XX;
    and always have the following error after running:
    SQL> execute xx;
     
    EX_HANDLE1 :
    Import Error 1 :ORA-31626: Job ist nicht vorhanden
     
    PL/SQL procedure successfully completed
     
    SQL> 
    And the handle Variable is empty !

    What I did wrong?

    Help, please!

    hqt200475

    Published by: hqt200475 on March 29, 2011 03:16

    Try with:

     l_dp_handle := DBMS_DATAPUMP.OPEN(operation   => 'IMPORT',
                                        job_mode    => 'SCHEMA',
                                        remote_link => NULL,
                                        job_name    => 'IMPORT_JOB',
                                        version     => 'COMPATIBLE');
    

    Are you sure remote connection? See the documentation for this parameter and use it.

  • Procedure DBMS_DATAPUMP to function

    Hello

    I created a procedure that works quite well as follows:
    CREATE OR REPLACE PROCEDURE proc_expdp(p_schema_name VARCHAR2, p_table_name VARCHAR2)
    IS
        v_handle NUMBER;
        v_jobname VARCHAR2 (100);
        v_dirname VARCHAR2 (100);
        v_filename VARCHAR2 (100);
    BEGIN
        v_filename := to_char(sysdate,'YYYYMMDDHH24MISS')||'.DMP';
        v_jobname := v_filename||'_EXPDP';
        v_dirname := 'DMPDIR';
        v_handle := dbms_datapump.open(operation => 'EXPORT', job_mode => 'TABLE', job_name => v_jobname);
        dbms_datapump.add_file(handle => v_handle, filename => v_filename, directory => v_dirname, filetype => 1);
        dbms_datapump.add_file(handle => v_handle, filename => v_filename||'_EXPDP'||'.LOG', directory => v_dirname, filetype => 3);
        dbms_datapump.metadata_filter (handle => v_handle, name => 'SCHEMA_EXPR', value => 'IN ('||p_schema_name||')');
        dbms_datapump.metadata_filter (handle => v_handle, name => 'NAME_EXPR', value => 'IN ('||p_table_name||')');
    --    dbms_datapump.data_filter (handle => v_handle, name => 'PARTITION_LIST', value => '''ODS_SLS_ITEM_DETAIL_20090101'', ''ODS_SLS_ITEM_DETAIL_20090102'', more here ''ODS_SLS_ITEM_DETAIL_20090227'', ''ODS_SLS_ITEM_DETAIL_20090228''', table_name => 'ODS_SLS_ITEM_DETAIL', schema_name => 'ODSPROD');
        dbms_datapump.start_job(v_handle);
        dbms_datapump.detach(v_handle);
    END;
    ... and I use the following code from PL/SQL to execute, which works very well also.
    BEGIN
      proc_expdp('''HR''','''DEPARTMENTS'',''EMPLOYEES''');
    END;
    I needed this as a function, so I corrected the following text:
    CREATE OR REPLACE FUNCTION system.func_expdp(p_schema_name VARCHAR2, p_table_name VARCHAR2) RETURN VARCHAR2
    IS
        v_handle NUMBER;
        v_jobname VARCHAR2 (100);
        v_dirname VARCHAR2 (100);
        v_filename VARCHAR2 (100);
    BEGIN
        v_filename := to_char(sysdate,'YYYYMMDDHH24MISS')||'.DMP';
        v_jobname := v_filename||'_EXPDP';
        v_dirname := 'DMPDIR';
        v_handle := dbms_datapump.open(operation => 'EXPORT', job_mode => 'TABLE', job_name => v_jobname);
        dbms_datapump.add_file(handle => v_handle, filename => v_filename, directory => v_dirname, filetype => 1);
        dbms_datapump.add_file(handle => v_handle, filename => v_filename||'_EXPDP'||'.LOG', directory => v_dirname, filetype => 3);
        dbms_datapump.metadata_filter (handle => v_handle, name => 'SCHEMA_EXPR', value => 'IN ('||p_schema_name||')');
        dbms_datapump.metadata_filter (handle => v_handle, name => 'NAME_EXPR', value => 'IN ('||p_table_name||')');
    --    dbms_datapump.data_filter (handle => v_handle, name => 'PARTITION_LIST', value => '''ODS_SLS_ITEM_DETAIL_20090101'', ''ODS_SLS_ITEM_DETAIL_20090102'', more here ''ODS_SLS_ITEM_DETAIL_20090227'', ''ODS_SLS_ITEM_DETAIL_20090228''', table_name => 'ODS_SLS_ITEM_DETAIL', schema_name => 'ODSPROD');
        dbms_datapump.start_job(v_handle);
        dbms_datapump.detach(v_handle);
        return v_filename;
    END func_expdp;
    ... and I wouldn't be able to run it with a select statement. Well, this part is the problem. When I try to run as a select statement
    select system.func_expdp('''HR''','''DEPARTMENTS'',''EMPLOYEES''') from dual;
    I get the following error:
    An error was encountered performing the requested operation:
    ORA-31626:job does not exist
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
    ORA-06512: at "SYS.DBMS_DATAPUMP", line 911
    ORA-06512: at "SYSTEM.FUNC_EXPDP", line 4356
    ORA-06512: at "SYSTEM.FUNC_EXPDP", line 11
    31626. 00000 - "job does not exist"
    *Cause: An invalid reference to a job which is no longer executing, is no executing on the instance where the operation was attempted, or that does not have a valid Master Table. Refer to any following error messages for clarification.
    *Action: Start a new job, or attach to an existing job that has a valid Master Table.
    What I would do... ?

    Thanks for your time

    PS: I use 10g Express Edition. Lately I have created and deleted several datapump jobs, but I think it's irrelevant since my procedure works very well.

    You cannot use the function inside a SELECT statement because dbms_datapump.open does an implicit validation. However, you can use the function within a pl/sql as block:

    declare
       l_filename varchar2(100);
    begin
       l_filename := system.func_expdp('''HR''','''DEPARTMENTS'',''EMPLOYEES''')
    end;
    /
    

    Also, please avoid creating all objects in the SYS and SYSTEM schemas.

  • DBMS_DATAPUMP. METADATA_REMAP

    What I'm missing here? I have reference Mr. [Christopher Poole | http://www.chrispoole.co.uk/tips/dbatip4.htm] while trying to use the function METADATA_REMAP of DATAPUMP... but I can't make it work. Here is my code... my proc succeeds however it attempts to import the schema of origin instead of remapping it. So, I get a ton of errors saying "this schema already exists...". ».

    What Miss me?




    DECLARE
    / * IMPORT/EXPORT VARIABLES * /.
    v_dp_job_handle NUMBER;          -The handful of job data pump
    v_count NUMBER;          -Index of the loop
    v_percent_done NUMBER;          -Percentage of job complete
    v_job_state VARCHAR2 (30);     -To keep track of job status
    v_message KU$ _LOGENTRY;     -For error messages and work in PROGRESS
    v_job_status KU$ _JOBSTATUS;     -The State of the work of get_status
    v_status KU$ _STATUS;     -The status returned by get_status object
    T_DATE VARCHAR2 (13).
    v_schema VARCHAR2 (25);
    v_new_schema VARCHAR2 (25);
    v_source_database_name VARCHAR2 (50);

    BEGIN
    v_schema: = 'TEST ';
    T_DATE: = TO_CHAR (SYSDATE, 'MMDDYYYY_HHMI');
    v_source_database_name: = 'TEST_DB ';
    v_new_schema: = 'TEST_NEW ';

    / * OPEN THE DATA PUMP PROCEDURE * /.
    v_dp_job_handle: = DBMS_DATAPUMP. OPEN)
    OPERATION = > "IMPORT."
    JOB_MODE = > "SCHEMA."
    REMOTE_LINK = > v_source_database_name,
    JOB_NAME = > v_schema | ' _REMAP_' | T_DATE,
    VERSION = > 'LAST');

    / * ADD THE NAME OF THE EXPORT LOG FILE TO THE DATA PUMP PROCEDURE * /.
    DBMS_DATAPUMP. ADD_FILE)
    MANAGE = > v_dp_job_handle,
    FILENAME = > v_schema | ' _REMAP_' | T_DATE |'. JOURNAL '.
    DIRECTORY = > 'DATAPUMP. "
    FILETYPE = > DBMS_DATAPUMP. KU$ _FILE_TYPE_LOG_FILE);

    / * ADD THE NAME OF THE SCHEMA TO THE PROCEDURE OF DATA PUMP EXPORT * /.
    DBMS_DATAPUMP. () METADATA_FILTER
    MANAGE = > v_dp_job_handle,
    NAME = > 'SCHEMA_EXPR ',.
    VALUE = > ' = "' | v_schema | " ' ') ;

    / * REMAP THE ORIGINAL THE NEW SCHEMA SCHEMA * /.
    DBMS_DATAPUMP. () METADATA_REMAP
    MANAGE = > v_dp_job_handle,
    NAME = > 'REMAP_SCHEMA ',.
    OLD_VALUE = > ' = "' | v_schema | " ' ',
    VALUE = > ' = "' | v_new_schema | " ' ') ;

    / * START THE EXPORT * /.
    DBMS_DATAPUMP. START_JOB (v_dp_job_handle);



    / * EXPORT ERROR HANDLING * /.
    v_percent_done: = 0;
    v_job_state: = "UNDEFINED";

    WHILE (v_job_state! = "COMPLETED") AND (v_job_state! = "STOPPED")
    LOOP
    DBMS_DATAPUMP. GET_STATUS)
    v_dp_job_handle,
    DBMS_DATAPUMP. KU$ _STATUS_JOB_ERROR + DBMS_DATAPUMP. KU$ _STATUS_JOB_STATUS + DBMS_DATAPUMP. KU$ _STATUS_WIP.
    -1,
    v_job_state,
    v_status);

    v_job_status: = v_status. JOB_STATUS;

    / * IF THE PERCENTAGE CHANGED, DISPLAYS THE NEW VALUE * /.
    IF v_job_status. PERCENT_DONE! = v_percent_done THEN
    DBMS_OUTPUT. Put_line ('* percent of the job done = ' |) To_char (v_job_status. PERCENT_DONE));
    v_percent_done: = v_job_status. PERCENT_DONE;
    END IF;

    / * IF THE WORK IN PROGRESS (WIP) OR ERROR MESSAGES HAVE BEEN RECEIVED FOR THE POST, POST THEM * /.
    IF BITAND (v_status. MASK, DBMS_DATAPUMP. KU$ _STATUS_WIP)! = 0 THEN
    v_message: = v_status. WORK IN PROGRESS;
    ELSIF BITAND (v_status.mask, DBMS_DATAPUMP. KU$ _STATUS_JOB_ERROR)! = 0 THEN
    v_message: = v_status. ERROR;
    ON THE OTHER
    v_message: = NULL;
    END IF;

    IF v_message IS NOT NULL THEN
    v_count: = v_message. FIRST;
    While v_count IS NOT NULL
    LOOP
    DBMS_OUTPUT. Put_line (v_message (v_count). LOGTEXT);
    v_count: = v_message. Next (v_count);
    END LOOP;
    END IF;
    END LOOP;

    -Indicate that the finished work and detach.
    DBMS_OUTPUT. Put_line ("' job has completed");
    DBMS_OUTPUT. Put_line (' State of the Final work = ' | v_job_state);

    / * END OF THE DATA PUMP PROCEDURE * /.
    DBMS_DATAPUMP. Detach (v_dp_job_handle);
    END;

    A simple display... not tested... Why not change it...

    DBMS_DATAPUMP.METADATA_REMAP (
    HANDLE => v_dp_job_handle,
    NAME => 'REMAP_SCHEMA',
    OLD_VALUE => v_schema,
    VALUE => v_new_schema) ;
    
  • Using DBMS_DATAPUMP with the LONG data type

    I have a procedure below that calls the DBMS_DATAPUMP procedure using a REMOTE_LINK move a schema of one database to another. However, some tables in this schema have columns with the data type of LONG. And when I run it I get an error saying that you cannot move the data with the LONG data type using a REMOTE CONNECTION. So no data in these specific tables gets flying over.

    Does anyone else have this problem? If so, do you have a work around? I tried to add a CLOB column in my table and affecting the new CLOB equal THROUGHOUT, but I couldn't get that to not work either... even when I tried to use a TO_LOB. If I could get that pass, then I could just slide ALONG, the schema, and then re-create the LONG column on the opposite side.

    Here is my procedure...



    DECLARE
    / * IMPORT/EXPORT VARIABLES * /.
    v_dp_job_handle NUMBER;          -The handful of job data pump
    v_count NUMBER;          -Index of the loop
    v_percent_done NUMBER;          -Percentage of job complete
    v_job_state VARCHAR2 (30);     -To keep track of job status
    v_message KU$ _LOGENTRY;     -For error messages and work in PROGRESS
    v_job_status KU$ _JOBSTATUS;     -The State of the work of get_status
    v_status KU$ _STATUS;     -The status returned by get_status object
    v_logfile NUMBER;
    T_DATE VARCHAR2 (13).
    v_source_server_name VARCHAR2 (50);
    v_destination_server_name VARCHAR2 (50);

    BEGIN
    v_project: = 'TEST ';
    T_DATE: = TO_CHAR (SYSDATE, 'MMDDYYYY_HHMI');
    v_source_server_name: = 'TEST_DB ';

    v_dp_job_handle: = DBMS_DATAPUMP. OPEN)
    OPERATION = > "IMPORT."
    JOB_MODE = > "SCHEMA."
    REMOTE_LINK = > v_source_server_name,
    JOB_NAME = > v_project | ' _EXP_' | T_DATE,
    VERSION = > 'LAST');

    v_logfile: = DBMS_DATAPUMP. KU$ _FILE_TYPE_LOG_FILE;

    DBMS_DATAPUMP. ADD_FILE)
    MANAGE = > v_dp_job_handle,
    FILENAME = > v_project | ' _EXP_' | T_DATE |'. JOURNAL '.
    DIRECTORY = > 'DATAPUMP. "
    FILETYPE = > v_logfile);

    DBMS_DATAPUMP. () METADATA_FILTER
    MANAGE = > v_dp_job_handle,
    NAME = > 'SCHEMA_EXPR ',.
    VALUE = > ' = "' | v_project | " ' ') ;

    DBMS_DATAPUMP. START_JOB (v_dp_job_handle);

    v_percent_done: = 0;
    v_job_state: = "UNDEFINED";

    WHILE (v_job_state! = "COMPLETED") AND (v_job_state! = "STOPPED")
    LOOP
    DBMS_DATAPUMP. GET_STATUS)
    v_dp_job_handle,
    DBMS_DATAPUMP. KU$ _STATUS_JOB_ERROR + DBMS_DATAPUMP. KU$ _STATUS_JOB_STATUS + DBMS_DATAPUMP. KU$ _STATUS_WIP.
    -1,
    v_job_state,
    v_status);

    v_job_status: = v_status. JOB_STATUS;

    IF v_job_status. PERCENT_DONE! = v_percent_done THEN
    DBMS_OUTPUT. Put_line ('* percent of the job done = ' |) To_char (v_job_status. PERCENT_DONE));
    v_percent_done: = v_job_status. PERCENT_DONE;
    END IF;

    IF BITAND (v_status. MASK, DBMS_DATAPUMP. KU$ _STATUS_WIP)! = 0 THEN
    v_message: = v_status. WORK IN PROGRESS;
    ELSIF BITAND (v_status.mask, DBMS_DATAPUMP. KU$ _STATUS_JOB_ERROR)! = 0 THEN
    v_message: = v_status. ERROR;
    ON THE OTHER
    v_message: = NULL;
    END IF;

    IF v_message IS NOT NULL THEN
    v_count: = v_message. FIRST;
    While v_count IS NOT NULL
    LOOP
    DBMS_OUTPUT. Put_line (v_message (v_count). LOGTEXT);
    v_count: = v_message. Next (v_count);
    END LOOP;
    END IF;
    END LOOP;

    DBMS_OUTPUT. Put_line ("' job has completed");
    DBMS_OUTPUT. Put_line (' State of the Final work = ' | v_job_state);

    DBMS_DATAPUMP. Detach (v_dp_job_handle);
    END;

    TO_LOB can be used to insert, create table in select and update the instructions to convert

    So: You simply cannot use it in SELECT..., you can use CREATE TABLE BLAH AS SELECT TO_LOB (LONG_COLUMN) OF DREADED_TABLE_WITH_LONG_COL;

  • How can I specify a different schema when importing using DBMS_DATAPUMP?

    I use the following procedure to import a schema. Is it possible that I can specify the import to import into another schema?

    Basically, what I want to do is take a pattern and copy it into another schema

    DECLARE
    v_dp_job_handle NUMBER;     -The handful of job data pump
    v_count NUMBER;     -Index of the loop
    v_percent_done NUMBER;     -Percentage of job complete
    v_job_state VARCHAR2 (30);     -To keep track of job status
    v_message KU$ _LOGENTRY;     -For error messages and work in PROGRESS
    v_job_status KU$ _JOBSTATUS;     -The State of the work of get_status
    v_status KU$ _STATUS;     -The status returned by get_status object
    v_logfile NUMBER;
    T_DATE VARCHAR2 (13).
    BEGIN
    v_project: = 'TEST ';
    T_DATE: = '03272009_1048 ';

    / * IMPORT * /.
    / * OPEN THE DATAPUMP PROCEDURE * /.
    v_dp_job_handle: = DBMS_DATAPUMP. OPEN)
    OPERATION = > "IMPORT."
    JOB_MODE = > "SCHEMA."
    -REMOTE_LINK = > v_desitination_server_name,
    JOB_NAME = > v_project | ' _IMP_' | T_DATE,
    VERSION = > 'LAST');

    / * ADD THE NAME OF THE DUMP FILE TO THE DATAPUMP PROCEDURE * /.
    DBMS_DATAPUMP. ADD_FILE)
    MANAGE = > v_dp_job_handle,
    FILENAME = > v_project | ' _EXP_' | T_DATE |'. DMP',.
    DIRECTORY = > "DATAPUMP");

    / * ADD THE NAME OF THE LOG IMPORT FILE TO THE DATAPUMP PROCEDURE * /.
    DBMS_DATAPUMP. ADD_FILE)
    MANAGE = > v_dp_job_handle,
    FILENAME = > v_project | ' _IMP_' | T_DATE |'. JOURNAL '.
    DIRECTORY = > 'DATAPUMP. "
    FILETYPE = > DBMS_DATAPUMP. KU$ _FILE_TYPE_LOG_FILE);

    / * START THE IMPORT * /.
    DBMS_DATAPUMP. START_JOB (v_dp_job_handle);

    / * END OF THE DATAPUMP PROCEDURE * /.
    DBMS_DATAPUMP. Detach (v_dp_job_handle);
    END;

    Use metadata_remap with the REMAP_SCHEMA option proc:

    DBMS_DATAPUMP. METADATA_RAMAP (id, 'REMAP_SCHEMA', 'SOURCE_SCHEMA', 'DESTINATION_SCHEMA');

  • Uninstall software update Apple says error in seller contact package package unstaller

    Try to get itunes working to make a backup of my faulty iphone before repair.

    First-itunes does not start says error. I'm trying to fix it, who said success but same error when you try to start it.

    Then uninstall completely worked. Then reinstall that seemed to be over except for a message "an older version of Apple software update already exists" then he went down and install itunes apparently had not been completed.

    Then I try to remove the update from the apple software and executed by an error in the installation program - it says there is an error in the installation and contact the supplier of the installation package. Same error if I run the uninstall command line program.

    Try to repair the Apple Software Update of programs & features Control Panel and then try to update iTunes again.

    For general advice, see troubleshooting problems with iTunes for Windows updates.

    The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.

    Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.

    The more information box has direct links with the current and recent if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit - for older video cards) as a workaround for problems with installation or operation, or compatibility with third-party software.

    Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.

    TT2

  • SUMIF error

    I'm new to apple and get a syntax error when you use SUMIF.  In my table, I just need column F to test the value of column E.  If it is greater than 0, then divide by 20.  Thank you!

    In cell F1

    = E1/if(E1>0, 20, 1)

    fill down as needed

  • An error in this Applescript that I can't understand

    Hi, I searched some forums and found this script below which I modified. It works great except for a single statement:

    runScript If = 1 then number error -128 I want the script to do is, when a USB drive is mounted and is in the ignoredVolumes as "USB Untitled" I want the script to stop. What I can't understand is, runScript is set to 1, "Untitled USB" Monte, runScript is not changed, why don't the script stops with an error "user cancelled"? On the other hand, if a key USB Monte is not in the ignoredVolumes, runScript is set to 2 and copy the file I want it. What hurts? It's probably something that will be very obvious when I see the answer.

    Thanks for any help with this problem,

    Mike.



    property ignoredVolumes: {'10,10 30 1. 5 't', 'files 1. 5 't', "Untitled USB"} - add if necessary

    property videoExtensions: {"avi", "mov", "mpg", "wmv", "mp4" and "mkv"}

    the value newVolume to the alias (POSIX file "/ Volumes/files 1.") ("5T / new")

    the value oldVolume to the alias (POSIX file "/ Volumes/files 1.") ("5T / old")

    game runScript to 1

                   tell application "System events".

    the value rootVolumes to disk (POSIX file ' / Volumes ' in the text)

    the value allVolumes to name of every element of disc of rootVolumes

    the value numofallVolumes to the County of allVolumes

    Repeat with the present book in allVolumes

    say application 'Finder '.

    if (the present book is not in ignoredVolumes and (this book as text) is not '. ') DS_Store') then

    if there are alias (POSIX (' / Volumes / "& the present book) as text file ) then game runScript to 2

    runScript If = 1 then number error -128 - it does not give a 'User cancelled' error when "Untitled USB" is mounted

    runScript If = 2 then

                                                                            try

    duplicate (elements whose name is in the videoExtensions extension) in alias (POSIX file (' / Volumes / "& the present book &" / new ") as text) to newVolume

    on error number errorNumber errorMessage

    _error value of errorMessage

    _errorNum the value to errorNumber

    If errorNumber is -15267 then

    display the dialog box "This file already exists in folder a." buttons {"OK", "No"} default button 1 with the title "Film copy error?" giving upwards after 10

    If the returned button of result is 'No' then

    Error number-128

    on the other

    If the result is 'OK' or back button gave up lead and then of

    eject the present book

    display the dialog box "U S B D r i v e E j e c t e d - K O t o R e m o v e" {"no need to click on this button"} default button 1 button give up after 5

    return

    end if

    end if

    end if

    end try

    Try

    duplicate (elements whose name is in the videoExtensions extension) in alias (POSIX file (' / Volumes / "& the present book &" / old ") as text) to oldVolume

    on error number errorNumber errorMessage

    _error value of errorMessage

    _errorNum the value to errorNumber

    If errorNumber is -15267 then

    display the dialog box "This file already exists in the folder B" buttons {"OK", "No"} default button 1 with the title "Film copy error?" giving upwards after 10

    If the returned button of result is 'No' then

    Error number-128

    on the other

    If the result is 'OK' or back button gave up lead and then of

    eject the present book

    display the dialog box "U S B D r i v e E j e c t e d - K O t o R e m o v e" {"no need to click on this button"} default button 1 button give up after 5

    return

    end if

    end if

    end if

    end try

    display the dialog box "USB key will Auto Eject in 10 seconds or click OK... "buttons button 1 with the title"copy Complete - Eject? "default {'OK', 'No'} which gives after 10

    If the returned button of result is 'No' then

    Error number-128

    on the other

    If the button returned of result is "OK" or gave up a result then ejection of the this book

    display the dialog box "U S B D r i v e E j e c t e d - K O t o R e m o v e" {"no need to click on this button"} default button 1 button give up after 5

    end if

    end if

    end if

    end say

    end Repeat

              end say

    The way in which your external block If is currently based, the script can't do anything when this book is in the ignoredVolumes, it can not yet test the runScript value. Try something like this:

    If the present book is in the ignoredVolumes then

    game runScript to 1

    on the other

    if (the present book as text is not '. ') DS_Store') then

    if there are alias (POSIX (' / Volumes / "& the present book) as text file ) then game runScript to 2

    end if

    end if


    Of course, you need to remove a "end if' the end of the script.



Maybe you are looking for