Dacă dorim să ștergem un database link aparținând unui alt utilizator decât cel cu care suntem logați, nu vom reuși:

SQL> select db_link,owner from dba_db_links;
DB_LINK                                    OWNER
--------------------------------------------------------------------------------
TEST_LNK                                AUREL

SQL> show user
USER is "SYS"
SQL> drop database link aurel.TEST_LNK;
drop database link aurel.TEST_LNK
                   *
ERROR at line 1:
ORA-02024: database link not found

SQL> drop database link TEST_LNK;
drop database link TEST_LNK
                   *
ERROR at line 1:
ORA-02024: database link not found
SQL> ALTER SESSION SET CURRENT_SCHEMA = aurel;

Session altered.

SQL> drop database link TEST_LNK;
drop database link TEST_LNK
                   *
ERROR at line 1:
ORA-01031: insufficient privileges

Soluția este sa creăm și să executăm o procedură în schema utilizatorului aurel care va șterge database link-ul:

SQL> show user;
USER is "SYS"
SQL> CREATE PROCEDURE aurel.drop_db_link as
  2  begin
  3  execute immediate 'drop database link TEST_LNK';
  4  end drop_db_link;
  5  /

Procedure created.

SQL> exec aurel.drop_db_link;

PL/SQL procedure successfully completed.
SQL> select db_link,owner from dba_db_links;

no rows selected

Lasă un răspuns

Completează mai jos detaliile tale sau dă clic pe un icon pentru a te autentifica:

Logo WordPress.com

Comentezi folosind contul tău WordPress.com. Dezautentificare /  Schimbă )

Fotografie Google

Comentezi folosind contul tău Google. Dezautentificare /  Schimbă )

Poză Twitter

Comentezi folosind contul tău Twitter. Dezautentificare /  Schimbă )

Fotografie Facebook

Comentezi folosind contul tău Facebook. Dezautentificare /  Schimbă )

Conectare la %s

Learning is not a spectator sport

Connor McDonald on SQL and the Oracle Database

Enmotech Blog

Specialized in Oracle Cloud Database ( DBaaS )

oradbaro

Focusing On Oracle Database Administration

Another Oracle blog

Another blog about Oracle

Mathijs Bruggink

Tips Tricks and Blogs on Oracle

Oracle Romania

Simplify IT

Programat in Romania

Blogul industriei de software din Romania. Comunitate dezvoltatori

Dan Bârsan

The miracle is not that we do this work, but that we are happy to do it. I'm writing in Romanian and English

Romanian Oracle User Group

Focusing On Oracle Database Administration

Big Lazy SysAdmin

Adapt. Enjoy. Survive.

Inovat in Romania

Blogul industriei software din Romania

Talip Hakan Ozturk's ORACLE BLOG

The secret of success is at your fingertips!...

Uwe Hesse

about Database Technology

Learning is not a spectator sport

Connor McDonald on SQL and the Oracle Database

Enmotech Blog

Specialized in Oracle Cloud Database ( DBaaS )

oradbaro

Focusing On Oracle Database Administration

Another Oracle blog

Another blog about Oracle

Mathijs Bruggink

Tips Tricks and Blogs on Oracle

Oracle Romania

Simplify IT

Programat in Romania

Blogul industriei de software din Romania. Comunitate dezvoltatori

Dan Bârsan

The miracle is not that we do this work, but that we are happy to do it. I'm writing in Romanian and English

Romanian Oracle User Group

Focusing On Oracle Database Administration

Big Lazy SysAdmin

Adapt. Enjoy. Survive.

Inovat in Romania

Blogul industriei software din Romania

Talip Hakan Ozturk's ORACLE BLOG

The secret of success is at your fingertips!...

Uwe Hesse

about Database Technology

%d blogeri au apreciat asta: