Database Link  thru PRocedure

I need to create a database link thorugh Procedure.But it's not allowing Create statement in a procedure,so i did in following way
CREATE OR REPLACE PROCEDURE create_db_link IS
SQLSTR VARCHAR2(300);
BEGIN
SQLSTR:='CREATE DATABASE LINK'|| 'TEST'||'CONNECT TO userid IDENTIFIED BY pwd USING host
DBMS_OUTPUT.PUT_LINE(SQLSTR);
EXECUTE IMMEDIATE SQLSTR;
END create_db_link;
while executing i got this error
ORA-02165: invalid option for CREATE DATABASE
Immediate help wud be appericiated

Sorry, I missed a few quotes myself there:
SQLSTR:='CREATE DATABASE LINK TEST CONNECT TO userid IDENTIFIED BY pwd USING ''host''';

Similar Messages

  • DBLINK thru Procedure

    I need to create a database link thorugh Procedure.But it's not allowing Create statement in a procedure,so i did in following way
    CREATE OR REPLACE PROCEDURE create_db_link IS
    SQLSTR VARCHAR2(300);
    BEGIN
    SQLSTR:='CREATE DATABASE LINK'|| 'TEST'||'CONNECT TO userid IDENTIFIED BY pwd USING host
    DBMS_OUTPUT.PUT_LINE(SQLSTR);
    EXECUTE IMMEDIATE SQLSTR;
    END create_db_link;
    while executing i got this error
    ORA-02165: invalid option for CREATE DATABASE
    Immediate help wud be appericiated

    Ok,I done it Using AUTHID clause,
    SQL> CREATE OR REPLACE PROCEDURE create_db_link AUTHID CURRENT_USER IS
    2 sqlstr VARCHAR2(300);
    3 strhost VARCHAR2(50):='''host''' ;
    4 BEGIN
    5 sqlstr:='CREATE DATABASE LINK '|| 'TEST '||'CONNECT TO userid IDENTIFIED BY pwd
    USING' || strhost;
    6 DBMS_OUTPUT.PUT_LINE(sqlstr);
    7 EXECUTE IMMEDIATE sqlstr;
    8 END create_db_link;
    9 /
    Procedure created.
    SQL> EXEC CREATE_DB_LINK
    PL/SQL procedure successfully completed.

  • Execute procedure over database link

    Hi,
    I''m working on a package where you can select the required database, paste some query and with clicking on a button it will execute and create an explain plan for this query.
    Therefore i've create a procedure on each database that put's the explain plan in the PLAN_TABLE.
    To do this i need to execute this prodecure from the package. I use the following code:
    DBA_OWNER.DB_PCD_EXPLAIN_PLAN@DBA_LINK_533.WORLD(p_query);
    This is working fine as this database link allready exists to the required database. But i want to make the database link name variable. I've allready created the dynamic database link:
    l_link varchar2(20) := 'DBA_LINK';
    l_link_nr number(4) := dbms_random.value(0,1000);
    l_db varchar2(20) := l_link||'_'||l_link_nr;
    l_statement varchar2(4000);
    begin
    l_statement := 'create database link '||l_db||' connect to **** identified by ***** using '''||p_database||'.WORLD''';
    execute immediate l_statement ;
    So now i have the dynamic databaselink that is created each time i call the package.
    now i want to use this databaselink to call the procedure. this is where it goes wrong.
    The code i'm using:
    DBA_OWNER.DB_PCD_EXPLAIN_PLAN@l_db(p_query);
    is not acceoted when i build the package.
    The follwoing error message is showed.
    PACKAGE BODY DBA_OWNER.PCK_EXPLAIN_PLAN
    On line: 66
    PLS-00352: Unable to access another database 'L_DB'
    Does someone know how to use this variable to execute the procedure on the remote db?

    Any procedures you call have to be accessible at compile time, so the database link must also exist at compile time.
    You can get around this by putting your procedure call to DB_PCD_EXPLAIN_PLAN inside dynamic SQL, the same as you are doing to create the database link. Dynamic SQL is not checked until runtime.
    Think about the risk if this procedure is exploited. You are creating a way for someone to run arbitrary code in an any database in your environment, with presumably a highly-privileged ID, if it can run an explain plan against any schema in any target database.
    This is exposing some significant security issues. Read up on SQL injection, and have someone else review the code for security issues before deploying this.

  • How to Execute a Remote Procedure in Portal using Database Link

    Hi,
    I followed the instructions to create a Portal form for a remote procedure. But I am encountering the following error. Can someone advise what may be the cause?
    Failed to execute - Missing string(create_package_body) language(us) domain (wwv) sub_domain (wwv_builder) (WWV-04300)
    ORA-04020: deadlock detected while trying to lock object PUBLIC.PORTLET_SCHEMA (WWV-11230)
    Failed to parse as PORTAL - (WWV-08300)
    PURPOSE
    How to execute a remote procedure in Portal using Database Link.
    DESCRIPTION
    This procedure assumes that you have two databases, one of which is remote, and Portal is configured in the other.
    Remote Database A:
    ==================
    1) Create a procedure as follows: Create or Replace PROCEDURE SCOTT.ADD_TWO_VALUES ( v_one IN NUMBER, v_two IN NUMBER, v_result OUT NUMBER) as begin v_result :=v_one+v_two; end; 2) Grant execute privileges to PUBLIC on the procedure.
    Database B (where Portal is configured): ========================================
    1) Create a public database link and choose to connect as a specific user (say SYSTEM). By default, in an Oracle 8i database, the "global_names" parameter in initSID.ora (or init.ora) file is set to "true". This Global Naming parameter enforces that a dblink has the same name as the database it connects to. Therefore, if the remote global database (A) name is "ora8.acme.com" then the database link should also be named as "ora8.acme.com".
    2) Create a synonym for the procedure in Database A. Make sure you fully qualify the procedure name in the remote database (like SCOTT.ADD_TWO_VALUES).
    3) Create a dynamic page to execute the procedure. The ORACLE tags in the dynamic page will look similar to the following: <ORACLE> DECLARE v_total NUMBER; BEGIN ADD_TWO_VALUES(:v_one,:v_two, v_total); htp.p('The total is => '); htp.p('<input type="TEXT" VALUE='||v_total||'>'); htp.para; htp.anchor('http://<machine.domain:port#>/pls/portal30/SCOTT.DYN_ADD_TWO_VALUES.show_parms', 'Re-Execute Procedure'); END; </ORACLE>
    4) Portal does not have an option to create a form based on a synonym. Therefore, if you want to create a form instead of a dynamic page, create a wrapper procedure and then create a form based on this procedure. For example: Create or Replace PROCEDURE PORTAL30.ADD_TWO_VALUES_PR ( v_one IN NUMBER, v_two IN NUMBER, v_total OUT NUMBER) as begin add_two_values(v_one, v_two, v_total); end;
    5) Grant execute privileges to PUBLIC on the procedure.

    hello...
    any input will welcomed... Thanks..

  • Passing plsql parm to a sql statement in the procedure  database link name

    Would like to pass a parm that is the database link name to a stored procedure.  I defined this as below. var1 is the name of the db link that I would like to pass
    create or replace procedure   proc1  (var1 in varchar2) as
    cursor c1 is
    select num,name,city from emp@var1;
    However, this is getting a plsql error in the above code   as bad bind variable, db link name expected.
    Is there a method to pass a variable within a stored proc into a SQL statement that has a cursor ..
    thanks

    Hi,
    Database links have to be hard-coded.  If you really need to specify the database link at run-time, then you need Dyanmic SQL.
    Why do you need to do this?   How many databases are involved?  Do you have new database links all the time?  The more you can say about your business requirements, the more helpful we can be.
    Are there only a couple of possible database links?  If so,  you might consider hard-coding each of them, and branching to the appropriate one in your code.
    is the real variable here the environment (Development, Test, Production) that you're in?  For example, do you need to use one database link in Development, a different one in Test, and a third in Production, but you don't want to change the code when you move from one environment to another?  If so, you can try conditional comilation.

  • Using generic format for database links in ODI Procedures

    Hi,
    As in procedure we use
    create table <%=odiRef.getSchemaName("Target Schema","D")%>.TABLE2 as
    select * from <%=odiRef.getSchemaName("Staging Schema","D")%>.TABLE1
    where Staging Database and Target Database are logical schemas which will associate to respective physical schema while execution so the above statement will become as
    create table Target_Schema.TABLE2 as
    select * from staging_Schema.TABLE1
    I just wanted to know if there is any way by which i can apply samethings for Database Links also.
    Like if i have statements
    create table TABLE2@Target_Database as
    select * from TABLE1@staging_Database
    can i replace DB links like Target_Database and Staging_Database?
    Help would be appreciated. :)
    Thanks,
    Mahesh

    I am not entirely sure about the exact requirement.
    Any way ..
    1.
    create 2 variable .
    v_get_src_schema : select '<%=odiRef.getSchemaName("<your_src_logical_schema>","D")%>' from dual
    v_get_tgt_schema : select '<%=odiRef.getSchemaName("<your_tgt_logical_schema>","D")%>' from dual
    2.
    2 more variable to get the required DBLink
    v_SRC_DB_LINK: select DB_LINK from all_db_links where owner='#PRJ_CODE.v_get_src_schema'
    v_TGT_DB_LINK: select DB_LINK from all_db_links where owner='#PRJ_CODE.v_get_tgt_schema'
    3.
    create a procedure :
    prc_create_table :
    create table <%=odiRef.getSchemaName("Target Schema","D")%>.TABLE2@'#PRJ_CODE.v_TGT_DB_LINK' as
    select * from <%=odiRef.getSchemaName("Staging Schema","D")%>.TABLE1@'#PRJ_CODE.v_SRC_DB_LINK'
    4.
    Create a package :
    Connect all the steps in serial with OK line.
    Execute and let us know what is the out come .
    Thanks,
    Sutirtha

  • Problem when call store procedure over a database link

    Hi all,
    I've create a database link in server "EAST" similar like:
    CREATE DATABASE LINK db_link CONNECT TO tiger IDENTIFIED BY scott USING 'abc';
    and from server "EAST" i ran the procedure located in server "WEST" somethin like:
    exec testing_procedure@db_link('test');
    testing_procedure is look like:
    Create or Replace procedure testing_procedure (p_testing in varchar2)
    as
    cursor check_space is
    select sum(bytes)/1024/1204 tb_size
    from dba_data_files;
    my_check_space%ROWTYPE;
    begin
    open check_space;
    loop
    fetch check_space into my_check_space;
    exit when check_space%NOTFOUND;
    insert into test_tf@db_link (test, tb_value) values
    (p_testing, my_check_space.tb_size);
    end loop;;
    close check_space;
    end;
    and my problem is when i'm run procedure from "EAST" server, the values in test_tf table is the same as when you run that procedure from "WEST" server. I've check the size for both server "EAST", and "WEST" by select sum(bytes)/1024/1204 command. And the value is completely different. And i guest somehow it reuse the value of "WEST" server no matter when you run that procedure in "EAST" server. Any suggesttion, please give me some advices.
    Thanks,
    Kevin

    If this procedure is in WEST server then even if you call it from some another planet using db link, the cursor inside the procedure will fetch the data from that server only means WEST server. So "select sum(bytes)/1024/1204 tb_size
    from dba_data_files;" statement in your procedure always fetch the size of the datafiles belongs to the WEST database.
    If you want to store the data of two different databases then you have to create the similar procedure in EAST database also.
    BTW, you said the you created a database link "db_link" in EAST database to point to WEST database and on WEST database you have that procedure BUT I don't understand why r u using "db_link" in your procdure code in WEST server in this insert statement:
    insert into test_tf@db_link (test, tb_value) values
    (p_testing, my_check_space.tb_size);Is there a database link on that box also?? Where it is pointing to?? And if not then this code should not be compiled.
    Daljit Singh

  • Stored procedure with database link with "from table(...)"

    Hi guys,
    I've been told I can't create views on a database by the design team and so have to use this stored procedure to obtain the values.
    select HAN_ID, HAN_DS, GLOBAL_IN, LOCAL_IN
    from table(cast(ODADMIN.ODP00002_QUERY.Execute001@DBLINK(11312,'EN') as
    ODADMIN.ODP00002_001_Array@DBLINK)) WHERE LOCAL_IN = 'Y';I've been told that it works when you remove the database links (so on the actual database) when you remove the cast part. I've tried it with my link and with/without the cast part but it doesn't work. With the example above I get the error: ORA-00907: missing right parenthesis.
    When I remove the CAST-AS and the additional parenthesis it brings i get the error: ORA-00904: "ODADMIN"."ODP00002_QUERY"."EXECUTE001": invalid identifier
    When I do table( *"* ODADMIN.ODP00002_QUERY.Execute001@MWW_DEV(11312,'EN') *"* )... -- wrapping the call in speech marks I get: ORA-00972: identifier is too long
    Anyone see what's wrong? Thanks for any help.
    Mike

    Hi Ben,
    Asking now. By a view I mean one local to the database; I could create one on APEX but then I use the database link twice instead of just 1.
    His reasoning Ben:
    Firstly, Maintenance. We will have to maintain additional views (at additional code). Secondly, if the view has a JOIN, then you can't update through it (without complexities). If we have to get the View to pass the data to a Procedure (that's a pain). Also, standards..
    All update occur via either a Procedure, or a Base view, across over 1000 tables
    That's the standard, and doing things differently is costly long term
    People will not know how it works, it will have to be explained, maintained..etc.
    If the Application has the Business Rules, then updates via Base Views, that's a more standard way of developing. Also, if you update via this view, you'll update multiple rows in one call, which is in-effficient if only ONE row needs to change. Therefore, single row updates from the Application is more efficient
    The procedure is as follows:
    --SET SERVEROUTPUT ON
    DECLARE
    nPBusLoc       NUMBER(5):=11312;
    sPHanId        VARCHAR2(3):='SB1';
    sPLngId        VARCHAR2(2):='EN';
    sPDesc         VARCHAR2(30);
    sPAllowAlloc   VARCHAR2(1);
    sPShowEnq      VARCHAR2(1);
    sPAllowDel     VARCHAR2(1);
    sPShowScan     VARCHAR2(1);
    sPGlobalLocal  VARCHAR2(1);
    sPReturnCd     VARCHAR2(2);
    sPReturnTx     VARCHAR2(100);                  
    BEGIN
    ODADMIN.ODP00001.getHandlingCodes
                           (nPBusLoc    --  IN   NUMBER
                          ,sPHanId      -- IN   VARCHAR2
                          ,sPLngId      -- IN   VARCHAR2
                          ,sPDesc       -- OUT  VARCHAR2
                          ,sPAllowAlloc -- OUT  VARCHAR2
                          ,sPShowEnq    -- OUT  VARCHAR2
                          ,sPAllowDel   -- OUT  VARCHAR2
                          ,sPShowScan   -- OUT  VARCHAR2
                          ,sPGlobalLocal-- OUT  VARCHAR2
                          ,sPReturnCd   -- OUT  VARCHAR2
                          ,sPReturnTx   -- OUT  VARCHAR2                                    
    DBMS_OUTPUT.PUT_LINE('nPBusLoc                 = '||nPBusLoc              );
    DBMS_OUTPUT.PUT_LINE('sPHanId                  = '||sPHanId               );
    DBMS_OUTPUT.PUT_LINE('sPLngId                  = '||sPLngId               );
    DBMS_OUTPUT.PUT_LINE('sPDesc                   = '||sPDesc                );
    DBMS_OUTPUT.PUT_LINE('sPAllowAlloc             = '||sPAllowAlloc          );
    DBMS_OUTPUT.PUT_LINE('sPShowEnq                = '||sPShowEnq             );
    DBMS_OUTPUT.PUT_LINE('sPAllowDel               = '||sPAllowDel            );
    DBMS_OUTPUT.PUT_LINE('sPShowScan               = '||sPShowScan            );
    DBMS_OUTPUT.PUT_LINE('sPGlobalLocal            = '||sPGlobalLocal         );
    DBMS_OUTPUT.PUT_LINE('sPReturnCd               = '||sPReturnCd            );
    DBMS_OUTPUT.PUT_LINE('sPReturnTx               = '||sPReturnTx            );
    END;
    /Mike
    Edited by: Dird on 27-Aug-2009 01:50

  • Database link in stored procedure

    -- see if sequence is remote
    begin
    execute immediate 'alter session set global_names = FALSE';
    execute immediate 'select count(1) from dba_sequences@'||v_dblink||' where sequence_name = '||''''||a_seq.sequence_name||'''' into v_cnt;
    dbms_output.put_line ('v_dblink: '||v_dblink||' Count is '||v_cnt||' on '||a_seq.sequence_name);
    if v_cnt > 0 then
    -- call update_sequence over dblink
    v_dblink := '@'||v_dblink;
    dbms_output.put_line ('link is '||v_dblink);
    statement := 'begin update_sequence'||v_dblink||'(:1, :2, :3, :4); end;';
    dbms_output.put_line (statement);
    execute immediate statement using in v_prefix, in v_sequence, in v_column, in v_maxvalue;
    else     dbms_output.put_line ('remote sequence does not exist');
    end if;
    end;
    SQL> exec adf.update_sequence;
    v_dblink: SEQ_SERV Count is 1 on CM_PHASE1_SEQ
    link is @SEQ_SERV
    begin update_sequence@SEQ_SERV(:1, :2, :3, :4); end;
    BEGIN adf.update_sequence; END;
    ERROR at line 1:
    ORA-02019: connection description for remote database not found
    ORA-06512: at "ADF.UPDATE_SEQUENCE", line 69
    ORA-06512: at line 1
    ORA-06512: at "ADF.UPDATE_SEQUENCE", line 77
    ORA-06512: at line 1
    Line 69 is
    execute immediate 'select count(1) from dba_sequences@'||v_dblink||' where sequence_name = '||''''||a_seq.sequence_name||'''' into v_cnt;
    I am not sure why this error occured.
    from the output it doesn't have a problem finding that record over the link.
    It is a public database link and I can run sql with no error. but just not inside the procedure.

    This worked for me:
    IF v_cnt > 0 then
    -- call update_sequence over dblink
         v_dblink := '@'||v_dblink;
         statement := 'begin adf.update_sequence'||v_dblink||'(:1, :2, :3); end;';
         dbms_output.put_line (statement);
         execute immediate statement using in v_prefix, in v_sequence, in v_column;     else               
         v_seq := TRUE;
         dbms_output.put_line (' update local sequence');
    end if;
    database link was created as a user using "connect to" and "identified by clause."

  • Calling remote procedure through database link

    Hi,
    I have a procedure in a package with a type I delcared as follows:
    Database1 :
    create or replace package p1
    is
    TYPE dependents_rec IS RECORD (
    name VARCHAR2 (80),
    dob date);
    TYPE dependents IS TABLE OF dependents_rec
    INDEX BY BINARY_INTEGER;
    procedure proc1 (p_id in number,
    p_dependents out dependents );
    end;
    On another database database2 i want to call the above procedure from within a procedure in a package that works as a wrapper package with similar structure.
    I recieve the error "Wrong number or types of parameters" error because type dependents is not the same as within the package in database 1.
    How can I call the procedure p1.proc1 over a database link ?
    Thank you

    Hi,
    On database1:
    CREATE OR REPLACE PACKAGE types_pkg is
    TYPE dependents_rec IS RECORD (
    NAME VARCHAR2 (80),
    sex NUMBER (1),
    birth_date DATE,
    birth_place NUMBER (3),
    status NUMBER (1),
    unique_id VARCHAR2 (15)
    TYPE dependents IS TABLE OF dependents_rec
    INDEX BY BINARY_INTEGER;
    end;
    CREATE OR REPLACE PACKAGE wrapper_pkg_demo
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg.dependents
    END;
    CREATE OR REPLACE PACKAGE BODY wrapper_pkg_demo
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg.dependents
    IS
    BEGIN
    person_pkg.read_person_no (p_person_id, p_dependent_info);
    END;
    END;
    On database 2:
    CREATE OR REPLACE PACKAGE person_pkg
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg.dependents@database1
    END;
    CREATE OR REPLACE PACKAGE body person_pkg
    AS
    PROCEDURE read_person_no (
    p_person_id NUMBER,
    p_dependent_info OUT types_pkg..dependents@database1
    IS
    BEGIN
    null;
    END;
    END;
    When compiling the package body on database 1
    ORA-04052: error occurred when looking up remote object TYPES@MOI
    ORA-00604: error occurred at recursive SQL level 1
    ORA-02019: connection description for remote database not found
    Noting that the database link are working properly and when compiling the package on database 2, it compile successfully
    Thank you

  • Procedure containg select from Database link

    Hi,
    I have one database link xxx which is getting some data from one table from Sqlserver database.
    Now I am writing one procedure which contain
    if(c=1) --get from databaselink
    select name,num from table1@xxx;
    else --get from the Oracle table;
    Now iam calling that procedure from .net application which is giving the following error :ORA-01002: fetch out of sequence
    ORA-02063: preceding line from FSPDEV_TO_AVERY_ORGRPT
    it is giving the above error if c=1 otherwise the else part is working fine.
    What i need to do?
    Thanks

    Hi,
    Thanks for your response.
    my procedure is like this:
    Cur_Out sysrefcursor
    if(c=1) --get from databaselink
    Open Cur_out for
    select name,num from table1@xxx;
    else --get from the Oracle table;
    Open Cur_out for Select from Oracle table;
    I will try to execute the procedure from SQLPLUS.
    thanks

  • Execute stored procedures + database link

    Hi,
    I have a stored procedure named "proc1" in the "user1" schema in the "db1" database.
    I have another database "db2".
    I have a public database link named "db2_to_db1", which connects from the "db2" database to "db1" database connecting with the user "user1" from "db1". I tested the database link.... is OK.
    I have a public synonym for "user1"."proc1"@"db1" named "p_proc1"
    So, I want to execute the stored procedure "proc1" from "db2".
    I tried this from Forms and SQLPLUS...
    (1)
    DECLARE
    BEGIN
    p_proc1(...,...,...);
    END;
    (2)
    DECLARE
    BEGIN
    user1.p_proc1(...,...,...)@db2_to_db1;
    END;
    (2)
    DECLARE
    BEGIN
    p_proc1(...,...,...)@db2_to_db1;
    END;
    .........but no one of those codes are right, I got an error like this:
    ORA-06550: line 12, column 3:
    PLS-00201: identifier 'SDI_CON_TRAFO_SID' must be declared
    Please I need some help....
    What can I do in order to execute a stored rpocedure of other database with a databse link??????
    I almost forget.... I already checked the "execute" privilegies over the stored procedure.... and is OK.

    What is the identifier 'SDI_CON_TRAFO_SID'? It sounds like you have a problem with dependencies rather than with how to call it.

  • Remote procedures created on Private Database Links

    How to grant access to role on the private synonym created in a schema for the remote procedure with private Database links.
    We have converted the public database links to private. Plz suggest me how to access the remote procedures and
    grant access to role.
    Thanks a Lot in advance.
    Its Urgent

    I asked in general since my task was stopped because of this.
    Secondly i have asked the users not specifically you. If you dont want to answer just dont answer.
    Coming to the problem, There was no problem when the public database links were used. The public synonyms were created and we were able to grant access with the role.
    But why not with private dblinks.

  • Return ref cursor from database link/stored proc? do-able?

    Is it possible to return a REF CURSOR from a stored procedure that is being called from a remote database via a database link???
    We are trying from Pro*Cobol on MVS (which has db link pointing to AIX thru db link) and get a 00993 error, which seems to say this is not possible.
    Before I give up, thought I would check with the experts....
    Thanks in advance.

    You can't return Java objects as stored procedure or query results.
    Douglas

  • Using database link via dbms_scheduler

    Hello out there,
    I have a problem calling a stored procedure via dbms_scheduler that pulls some rows over a public database link.
    The setup is the following:
    create public database link mediabase using 'mediabase';
    create or replace procedure hole_kurse as
    mdatum date;
    begin
       select max(datum) into mdatum
       from dt_wechselkurs;
       insert into dt_wechselkurs l
          (waehrung,
           datum,
           wechselkurs)
       (select
           r.waehrung,
           r.datum,
           r.wechselkurs
        from
           dt_wechselkurs@mediabase r
        where
           datum>mdatum);
        commit;
    end hole_kurse;
    begin
       dbms_scheduler.create_job(job_name          =>  'wechselkurse',
                                 job_type          =>  'STORED_PROCEDURE',
                                 job_action        =>  'hole_kurse',
                                 start_date        =>  sysdate,
                                 repeat_interval   =>  'FREQ=DAILY; BYHOUR=7; BYMINUTE=0; BYSECOND=0');
       dbms_scheduler.enable(name => 'wechselkurse');
       commit;
    end;
    /I can access the database link in SQL and I can call the procedure hole_kurse from SQL without any errors. But the job fails writing "ORA-01017: invalid username/password; logon denied" into alert.log. I also tried using dbms_job which used to work with Oracle 10g but now fails with the same error.
    My Oracle version is 11.2.0.2 64bit on Window Server 2008R2.
    So what do I have to change that my job will run?
    Many thanks in advance,
    dhalek

    I'm not completely sure, but here is a possibility:
    The [url http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_5005.htm#i2061505]docs have this to say:
    >
    If you specify CONNECT TO user IDENTIFIED BY password, then the database link connects with the specified user and password.
    If you specify CONNECT TO CURRENT_USER, then the database link connects with the user in effect based on the scope in which the link is used.
    If you omit both of those clauses, then the database link connects to the remote database as the locally connected user.
    >
    Your dblink is like this:
    create public database link mediabase using 'mediabase';That is the third case described, so the link connects as "the locally connected user", which in the scheduler session is probably not your user.
    You may try it with the second case described in the docs:
    create public database link mediabase CONNECT TO CURRENT_USER using 'mediabase';If I understand the docs correct, then within the procedure the dblink will use the schema that the procedure is owned by (unless the procedure is using invoker-rights, then it will be the invoking user.)
    It is just a guess, but you can try it and see ;-)

Maybe you are looking for

  • How to get video from DVD into FCE?

    Hi, I have a DVD which I got from a childhood friend. The DVD contains a compilation of old film clips (her family had old super 8 movies transferred to DVD). I'm trying to import the clip (it's one long video clip, 30 mins long) into FCE for editing

  • Sort by To / From in Mail is not working correctly

    As an example: I move the mails from the Sent - Gmail folder to a folder I created  On My Mac In this folder the sorting was by TO but the system did not execute this Instead it sorted by From and the To was not shown at all ! This is just one exampl

  • Can't remove battery on Macbook Black

    Hey. Today I decided it was time to clean my MacBook Black [refurbished], so I powered it down and went to take out the battery. I used a coin to unlock the battery, which didn't seem to pop up. For the life of me, I can't prise the battery out. I do

  • UOM in EDI PO

    HI Guru's I am sending PO through EDI.I am entering the order unit as FT3 (Cubic Feet) but in the idoc it is displaying as FTQ for the Segment E1EDP01 for the field  MENEE.Can somebody explain me how this unit is getting converted. Thanks in advance

  • Moving pictures in the iphoto library when move them in events

    I don't like iPhoto keeps actual pictures in the old album even if I move them to another event (or album) For example - you move pictures from 2007 Boston to 2009 London event or album in iPhoto app BUT iPhoto keeps them in the 2007 Boston folder an