Bonjour,
Y at'il une possibilité de créer un répertoire avec un package ou une méthode sous Oracle?
Merci d'avance
Version imprimable
Bonjour,
Y at'il une possibilité de créer un répertoire avec un package ou une méthode sous Oracle?
Merci d'avance
Bonjour,
Oui c'est possible
1. créér le réperteoire au niveau OS
2. creation dans Oracle
avec execute immediate
...
Code:
1
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 mkdir -p /app/oracle/SCOTT_DIR 9> CREATE OR REPLACE PROCEDURE CREATE_DIR (V_NAME varchar2,V_PATH varchar2 ) AS 2 BEGIN 3 EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY ' || V_NAME ||' AS ''' || V_PATH || '''' ; 4 5 6 7 -- Grants on directory 8 EXECUTE IMMEDIATE 'GRANT READ ON DIRECTORY ' || V_NAME ||' TO SCOTT'; 9 10 EXECUTE IMMEDIATE 'GRANT WRITE ON DIRECTORY ' || V_NAME ||' to SCOTT'; 11 12 13 END; 14 / Procedure created. >exec CREATE_DIR ('DIR_SCOTT','/app/oracle/SCOTT_DIR'); PL/SQL procedure successfully completed. expdp scott/tiger tables=EMP,DEPT directory=DIR_SCOTT dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log Export: Release 11.1.0.7.0 - 64bit Production on Tuesday, 28 July, 2009 11:18:58 Copyright (c) 2003, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Release 11.1.0.7.0 - 64bit Production Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** tables=EMP,DEPT directory=DIR_SCOTT dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 128 KB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "SCOTT"."DEPT" 5.937 KB 4 rows . . exported "SCOTT"."EMP" 8.570 KB 14 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: /app/oracle/SCOTT_DIR/EMP_DEPT.dmp Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 11:19:13
Il reste une partie du problème : la création physique du répertoire, on n'est peut pas le faire avec une procédure oracle (qui remplace mkdir -p /app/oracle/SCOTT_DIR)
Merci d'avance
bonjour
NON !!!