Database link question

I read that it is possible to create a private database link and set up a public synonym to the private database link. But when I try it doesn't work. Is there another way to do this?

My goal is to have the private database link and private synonyms exist in a single schema and have only certain users have access to. Is there another way to solve this problem without setting a private database synonyms and additional link in several patterns?

Thank you
Violet

Violet says:
I understand that this error occurs because the database connection is private. This suggests that this scenario is not possible after all?

Views + grants:

SQL> connect scott@orcl
Enter password: *****
Connected.
SQL> create database link sol10_private connect to scott identified by tiger using 'sol10';

Database link created.

SQL> create public synonym sol10_private for v$database@sol10_private;

Synonym created.

SQL> create user u1 identified by u1;

User created.

SQL> grant create session to u1;

Grant succeeded.

SQL> select name from v$database;

NAME
---------
ORCL

SQL> select name from v$database@sol10_private;

NAME
---------
SOL10

SQL> select name from sol10_private;

NAME
---------
SOL10

SQL> connect u1@orcl
Enter password: **
Connected.
SQL> select name from sol10_private;
select name from sol10_private
                 *
ERROR at line 1:
ORA-02019: connection description for remote database not found

SQL> connect scott@orcl
Enter password: *****
Connected.
SQL> drop public synonym sol10_private;

Synonym dropped.

SQL> create or replace
  2    view sol10_private_vw
  3      as
  4        select  *
  5          from  v$database@sol10_private;

View created.

SQL> grant select on sol10_private_vw to u1
  2  /

Grant succeeded.

SQL> create public synonym sol10_private for sol10_private_vw;

Synonym created.

SQL> select name from sol10_private;

NAME
---------
SOL10

SQL> connect u1@orcl
Enter password: **
Connected.
SQL> select name from sol10_private;

NAME
---------
SOL10

SQL> 

SY.

Tags: Database

Similar Questions

  • A question about the CREATE DATABASE LINK PUBLIC and ORA-12154 error

    Hi all


    I have a problem on the public database link creation and I would be grateful if you could kindly give me a helping hand. I have the following connection settings in my
    tnsnames.ora file:
    ...
    DGPAPROD.WORLD = 
         (DESCRIPTION = 
           (ADDRESS_LIST = 
            (ADDRESS = (COMMUNITY=tcp.world)
              (PROTOCOL=TCP)(HOST=ORASR001)(PORT=1521)
             ) 
           )
           (CONNECT_DATA = (SID = DGPAPROD))
        )
    ...
    Having the above mentioned parameters, I can connect to this remote database directly in a SQL * more shell:
    $ sqlplus username/[email protected]
    It works pretty well and the connection is established without any problem.

    Now, what I want to do is to create a public database of this remote database link to avoid the user/connection of switch for the visualization of the
    the content of this database. I proceeded in line with the syntax indicated in the Oracle online documentation:

    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_5005.htm#SQLRF01205

    This is why I run the following to create a public database link
    CREATE PUBLIC DATABASE LINK SR001_dblink CONNECT TO user IDENTIFIED BY password USING 'DGPAPROD.WORLD';
    Apparently there is no error and the link is created successfully. However, it cannot resolve the remote host and every time I run this query
    (myenterprise is the name of a table in the remote database)
    SELECT *
    FROM myenterprise@SR001_dblink
    
    ERROR at line 1:
    ORA-12154: TNS:could not resolve the connect identifier specified
    What causes this problem?

    Thanks in advance,


    Kind regards
    Dariyoosh

    You must have defined DGPAPROD. WORLD in tnsnames.oar on the server where DB is runnig.

  • How s/n know when and what account perform a function using the database link?

    Dear,

    My application of the CIM team asked DBA to create new function and run it. Function must use the database link for remote database data. So I need to create a new database to their licensing link. Cause we guess we'll experience the performance issue after the user performs this function, or another question and errors may occur. So we want to know when and who use this feature that connects to a remote database through the new database connection in advance. And I also need to know when and which connect to the remote database using this new database link. We have no idea to get this information?  Can anyone recommend how do? Thank you very much.

    Best reqards, Otis.

    Check what business purpose, it will solve.  If the function is so safe, why everyone will use. Only admin people should access.

    All of these additional controls of this kind must be avoided as much as possible to improve the overall performance of the application.

    Still if you need, see the database audit mechanism, specifically designed for this type of activity.

    Kind regards

    Harman

  • Database Link Performance

    Hey Geeks,

    My project needs to extract information from a remote database with huge data through the local database (for the most part having given fixed). I've implemented it with the following approach:

    1 > create the local user account

    2 > created views for all tables with fixed data in the remote database using the links in the database.

    for example, CREATE or REPLACE of VIEWS REMOTE_TABLE_NAME AS SELECT * FROM REMOTE_TABLE_NAME@DATABASELINK;

    3 > this way, I am able to implement abstraction, the developer will not be able to know if the Remote_table_name object is a view of local user account or the table in the remote database. Application behaves as if all the data are present locally. Here, all good.

    The real problem begins when performance comes in the picture. During the execution of data mining that uses tables on the remote db (now through with dblink views in the local data base), I found that some of the jobs take 4 to 5 times as long to perform the same task when the same test is run directly on the remote database.

    I tried several things like:

    1 > use indicators of performance in creating views for the: for example remote tables in the local account for example

    CREATE the "REMOTE_TABLE_NAME" AS SOME VIEW / * + DRIVING_SITE (REMOTE_TABLE_NAME) * / * FROM REMOTE_TABLE_NAME@DBLINK;

    2 > performance using tips that querying the tables of remote database through views in the local account for example

    / * + DRIVING_SITE (REMOTE_TABLE_NAME) SELECT * / * FROM REMOTE_TABLE_NAME; "REMOTE_TABLE_NAME" is HERE the local view in the database account

    3 > performance using tips that questioning the tables of remote database by dblink hadcoding with the namee.g of the table.

    / * + DRIVING_SITE (REMOTE_TABLE_NAME) SELECT * / * FROM REMOTE_TABLE_NAME@DBLINK; "REMOTE_TABLE_NAME" is the name of the table in the remote account

    I tried many other things, but could not see improved performance.

    Any suggestions?

    Thank you

    Amrit Pandey

    In the original script when the remote table has been in the different database I tried with several possible optimization techniques but could not seen a substantial improvement in performance. Later as an experience (as I mentioned in my previous post) I tried to recover a local table to the other schema using the link of database to cut the network aspects and focus on the effect of the database link.

    To be precise, above queries are just to observe the charge of link database as part of an experiement in real time scenario, the tables will be at the remote database when the network latency will also play its part to hit performance.

  • ONLY INSERT OR DELETE THE PRIVILEGE TO THE DATABASE LINK

    Hi all

    Version of DB 11.2.0.1

    RedHat 5.5 operating system

    I created a link to private database by following the path

    create database link test_link

    connect to Scott identified by tiger

    using

    '(DESCRIPTION =)

    (ADDRESS = (PROTOCOL = TCP) (HOST = 10.194.180.45)(PORT = 1521))

    (CONNECT_DATA =

    (SERVER = DEDICATED)

    (SERVICE_NAME = prod)

    )

    )'

    The link is created successfully and I am able to perform all the DML operations on it.

    The Question is there a way by which we can give only insert or delete or privilege is not to remove from the table at this link.

    For operations select only, I know that by creating a view I can restrict the remote user, but is there a way by which I can give only insert or remove remove link of database.

    You can not grant any privilege to a link. Can you and your team identify a location in the documentation, if required?

    By default, a remote session will get the same privilege as the user to which it connects.

    BTW:

    • do not use a database link tnsnames.ora makes your hard to maintain link
    • using addresses IP hard in a database link makes your link even more difficult to maintain
    • by specifying a hardcoded password in a database link is a breach of security.

    -------------

    Sybrand Bakker

    Senior Oracle DBA

  • Public connected user database link creation

    Hello, DBA

    I tried to create the user database link connected audience.
    I have two databases (orcl, orcltest)

    Orcltest database, I created dblink

    SQL > grant create public database to u1 link;
    Grant succeeded.

    SQL > conn u1
    Enter the password:
    Connected.

    SQL > create sequoia link of public database using "orcl".
    Database link created.


    In orcl, I tried to access

    SQL > select * from u1.tab1@redwood;
    Select * from u1.tab1@redwood
    *
    ERROR on line 1:
    ORA-02019: description of the connection to the remote database not found

    QUESTION: what is the error?
    Note: tns, earphone works very well. No problems.
    Prod: 1 0.2.0.4.0
    OS: rhel 5.1

    Thanks in adnvance...

    Hello

    Orcltest database, I created dblink

    SQL > grant create public database to u1 link;
    Grant succeeded.

    SQL > conn u1
    Enter the password:
    Connected.

    SQL > create sequoia link of public database using "orcl".
    Database link created.

    Here, you create a DBLINK on the ORCLTEST to the ORCL database, sort of source database is ORCLTEST and target is ORCL.

    In orcl, I tried to access

    SQL > select * from u1.tab1@redwood;
    Select * from u1.tab1@redwood
    *
    ERROR on line 1:
    ORA-02019: description of the connection to the remote database not found

    It will not work because you created the dblink on the source database, which is ORCLTEST.

    DBLINKS give you a way to access resources (tables, indexes, packages, etc.) in a remote database.

    What you do is:

    1. create a dblink on ORCLTEST. This dblink will provide access to ORCL via the ORCLTEST.

    2 instead of this, you you connect directly to ORCL. That won't work, your DBLINK is not here, you can create another one here pointing to the ORCLTEST.

    DBLINKS act as a bridge, a connection between two databases. They are only available in the source database to create a link to a database remotely (target).

  • Error creating database link!

    Dear all,

    I'm in a strange problem to connect to the database between the RAC and single Instance database. The two databases are 11 GR 2 and on Linux platform.

    On a database that is CARS, my settings are as follows:

    view the global_names parameter.
    Value = TRUE

    Select Rename global_name;
    RACDB. DOMAIN.COM

    Although I ran the race:
    ALTER DATABASE RENAME GLOBAL_NAME to RACDB and bounce the database after this command, but still it shows RACDB. DOMAIN.COM

    When I see the db_domain parameter
    Value = (NULL)

    tnsnames.ora is

    GGBKP =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.182)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = GGBKP))
    )


    On the other server, my settings are as follows:

    view the global_names parameter.
    Value = TRUE

    Select Rename global_name;
    GGBKP

    When I see the db_domain parameter
    Value = (NULL)

    tnsnames.ora is
    RACDB =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.20.29)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = RACDB))
    )


    OK, now when I create the link DB from one server to another by using the command:

    Server a

    create database GGBKP link to connect to streamadmin identified by streamadmin using 'GGBKP ';

    and run this query

    Select sysdate dual@GGBKP it gives an error:
    ORA-02085: database link GGBKP. DOMAIN.COM will connect to GGBKP


    the second server

    SQL > create database RACDB link to connect to streamadmin identified by streamadmin
    2 using "RACDB;

    Database link created.

    SQL > select sysdate dual@RACDB;
    Select sysdate from dual@RACDB
    *
    ERROR on line 1:
    ORA-02085: database RACDB link connects to the RACDB. DOMAIN.COM

    Where is the problem in the settings and how to get rid of this problem. I have to keep the overall name of TRUE because replication streams.

    Kind regards
    Imran

    Probably that does not help.
    The problem is on the server 1, Server 2 is OK and works as expected.
    For some strange reason, server 1 still picks up "domain.com".

    At this point, I would probably question sys.props$ (where it is stored) or consult the global_names view definition.
    I would not immediately update sys.props$ with the correct value.

    I would also like to run lsnrctl services: if properly configured global_name and service_name in lsnrctl match.

    ------
    Sybrand Bakker
    Senior Oracle DBA

  • To access large partitioned tables over a database link - traps?

    Hello

    We are in the middle of a business acquisition, and I have a question on the use of links to database access efficiently to large tables. There are two distinct geographical database instances, both on Oracle 10.2.0.5 sitting on Linux boxes.

    The main forum (PSHR) contains a PeopleSoft HR system and pays and is sitting in our data center.

    The secondary instance (HGPAY) runs a payroll application home grown and is in a different datacenter to PSHR.

    The requirement is to allow PeopleSoft (PSHR) to display data of payroll (one employee at a time) targeted to the secondary instance.

    For example in HGPAY

    CREATE TABLE MY_PAY_DATA AS
    SELECT TO_CHAR (A.RN, ' 00000000') 'EMP' - it is a figure 8 leading 0 unique identifier
    '20110' | TO_CHAR (B.RN) "PAY_PRD" - it is a format of exercise more than fifteen days in the year (01-27)
    C.SOME_KEY - it is the element of remuneration being considered - effectively randomly
    , 'XXXXXXXXXXXXXXXXX' "FILLER1.
    , 'XXXXXXXXXXXXXXXXX' "FILLER2".
    , 'XXXXXXXXXXXXXXXXX' "FILLER3".
    FROM (SELECT ROWNUM 'RN' FROM DUAL CONNECT BY LEVEL < = 300) has
    , (SELECT ROWNUM 'RN' FROM DUAL CONNECT BY LEVEL < = 3) B
    (SELECT TRUNC (ABS (DBMS_RANDOM. (Random())) 'SOME_KEY' FROM DUAL CONNECT BY LEVEL < = 300) C
    ORDER OF PAY_PRD, EMP

    HGPAY. MY_PAY_DATA is the range partitioned on EMP (approximately 300 employees by partition) and the list below partitioned on PAY_PRD (3 pay periods a secondary partition). I limited the above create statement to represent a sub-partition of data.
    Every employee generates an average of 300 lines in this table each pay period. The table has about 180 million lines and all fifteen days more.

    In PSHR

    CREATE VIEW PS_HG_PAY_DATA (MEP, PAY_PRD SOME_KEY FILLER1, FILLER2, FILLER3)
    AS SELECT EMP, PAY_PRD SOME_KEY FILLER1, FILLER2, MY_PAY_DATA@HGPAY FILLER3

    PeopleSoft would then generate SQL along the lines of

    SELECT * FROM PS_HG_PAY_DATA WHERE EMP = '00002561' AND PAY_PRD = '201025'

    The link between data centers where PSHR and HGPAY sit isn't the best in the world, but I expect dozens of hits per day rather than thousands, so I think that the link must have sufficient bandwidth to meet the requirements.

    I tried a quick test on two instances of size production test and it works because it presents the data, when I look at the plan of the explain command that I can see that the remote database is only presenting the relevant secondary partition on PSHR rather than the entire table. Until I get in the back with a "job well done" - y at - it a witch hunt that I am absent using dblink to access the partitioned tables of big?

    Yes, it's just. A lot of it depends on exactly what happens in different "oops" scenarios - you are, for example, just burn some CPU extra until someone comes to the DBA and says "my query is slow" or saturating the network has an impact on critical applications or long random queries prevent some maintenance operations of partition.

    In my mind, the simplest possible solution (assuming you are using a username that is fixed in the database link) would be to create a profile on HGPAY for user defined for the link of database that set a value LOGICAL_READS_PER_CALL which was large enough to handle any request '' reasonable '' and low enough to quickly kill any session that has tried to do something 'stupid '. Obviously, you have to define 'stupid' in your particular environment where the scope of a 'simple reconciliation report' is not defined. If there is no political problem and you can adjust the values of profile to the wire when you encounter new reports that slowly increase what is considered '' reasonable '' is probably the most straightforward approach. If you have to put in a change request to change the parameter which must be reviewed by the Control Board change at its next quarterly meeting with the outsourced DBA seller, on the other hand, you could turn a report by 30 minutes in 30 hours over 30 days. However, in an ideal world, this is where I would start.

    Becomes more complex, you can use the resource manager to kill applications running too long on the wall clock. Since the network will almost certainly the bottleneck, it is probably unlikely that the limitation of the CPU will do much good - probably you can saturate the network with a very small amount of CPU. Limitation in my mind of the network is an additional step in complexity according to the specifics of your situation and what you are competing with.

    Justin

  • Use the 9i on a database 8i database links?

    Just a really quick question... I can't easily find an answer...

    If I connect to a database to 8i a link of a 9i database database, can I then use syntax on the 8i database 9i, or am I still hold to the 8i syntax?

    NO.
    The database link passes the SQL to the remote database, which will deal with SQL.
    The remote 8i database will not be able to interpret the syntax 9i.
    Also, you can not use regular expressions in your 9i database by sending them through a database link. The SQL sent to the remote database will not scan in the remote database.

    But, by all means, try it. If in doubt, try it.

  • try to reduce the database links

    Hello. Thank you for helping.


    I think my basic question is this:


    I can connect and create database links that can be used by all other users (and tablespaces?) on the server?


    I have a bad understanding of how the areas of storage, dblinks and users go together, so I'll briefly describe my setup process so you can see how I have things that can be part of the cause of my confusion, possibly in a subtle way.


    For this example, I have 2 servers with Oracle 11 g Enterprise.


    After you create a database, I then create tablespaces, users and links like this:


    On server 1:


    create storage my_app1
    create the user my_app1
    create storage my_app2
    create the user my_app2


    and so on for all areas of storage and users on the server.


    Then log in as my_app1 and create a link of database on server2:


    link_to_s2 fixed my_app3 user


    Then log in as my_app2 and create a link of database on server2:


    link_to_s2 fixed my_app3 user


    Same process on server2:


    create storage my_app3
    create the user my_app3
    create storage my_app4
    create the user my_app4


    and so on to server2.


    Then log in as my_app3 and create a database link to server1:


    link_to_s1 fixed my_app1 user


    Then log in as my_app4 and create a database link to server1:


    link_to_s1 fixed my_app1 user


    It operates well for me, except that I have to create four dblinks.


    Is everything I see how this can be simplified to create dblinks less?


    Any suggestions are greatly appreciated.

    Hello..

    Why not create a public database link.

    Documents: -.

    Specify the PUBLIC to create a public database link available to all users. If you omit this clause, the database link is private and is only available to you.
    [http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#sthref6315]

    Anand

  • Dynamic database links

    Hello

    I am building an application that uses a link to database for reference since the heart of the system data.

    I want to be able to do

    Select x
    of y@:DBLink

    where DBLink is an element of application defined according to the details of users

    The DBLink must be dynamic as according to which users are connected, they will access their own database.
    We have the same system running on separate databases in several countries.

    Y at - it an easy way to do it or I have to look somehow using SQL dynamic for all queries? :(

    Only other thing I could think is maybe use database authentication and have a synonym private for each user that connects the correct database link... so all of the synonyms would be called DBLink? But I don't know if you can create a synonym for a dblink?

    Yes. Simply create a new DADDY without a user name and password and you'll be ready to go. I found this one aspect really confusing to the Apex and is kind of a boring when you need to connect to remote databases that are security and audit line level triggers. You want DADDY to your apex authentication so that your user will not be invited twice. If you have any other questions let me know.

  • Deployment of mapping a error: duplicate database link exists

    Hello world

    If all goes well, it is a simple question. I have worked with OWB 10 g 2 for some time now without any problems. My project finished and I went to a different environment of OWB, always 10 gr 2 and now my mapping deployments are errors during deployment. Whenever I try to deploy the mapping, OWB also tries to create the database link, regardless because it already exists. It does not deploy the database link, but mapping deploys successfully, however. If I drop the database connection, and then to deploy a map there is no error but then if I deploy a second mapping back again (no surprise here).

    I tried to deploy the connector by assigning 'replace' and click on deploy. Which was fine, but according to, OWB, even though I just replaced the existing link DB, it has not yet see it was created. OWB always considered this connector as 'new '.

    Anyone know what I need to do for OWB to stop trying to deploy the DB link with each mapping? How can I tell him that the DB connection exists and that it is correct?

    Thank you!

    -Joe

    Hello

    I had the same question a few days ago... I'll tell you how I solved it.
    I think the real problem is that the link never gets marked as deployed => therefore, it is deployed with each mapping is to use it!
    You can even try to deploy it on its own and deploy process completes without error, but it is not marked as deployed...
    Why the link can't be marked as deployed? Whence the db_link?
    The link points to a location where you dragged a table (or any object) on your map.
    In my case, the location was first created and saved by another user before starting the development of a project (with a new user).
    I recorded the location with the original user and he scored again with my user that I could deploy and get marked accordingly.
    It is never apperead in my mapping deployments.

    Hope, I've been pretty clear... and useful!

    Joan.

  • Import the database link

    I try to import tables from one database to another via a database link. But faced with a weird error. Help, please.

    Operating system:  Server Linux Oracle release 6.4

    Database of the source: Oracle 12.1.0.2

    Target databases: Oracle 12.1.0.2


    Measures

    1. Created a TNS entry for the source on the target server database.
    2. Create a link from public database to the schema of the source by using the tns name.
    3. Created a database in the target database directory and the permissions granted to the user target.

    Run the command below

    Impdp directory with name of user and password = dirname tables = network_link = linkname schema.tablename

    Get the below output

    Import: Release 12.1.0.2.0 - Production on Fri 9 Oct 14:51:32 2015

    Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

    Connected to: Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production database

    With the options of partitioning, OLAP, advanced analytics and Real Application Testing

    ORA-39004: invalid state

    ORA-39091: unable to determine the State of standby and logical flow

    ORA-06550: line 1, column 47:

    PLS-00103: encountered the symbol "IN" when the expected in the following way:

    < an ID > < a between double quote delimited identifiers of >


    Hello

    Run the command below

    Impdp directory with name of user and password = dirname tables = network_link = linkname schema.tablename

    can you show real impdp statement executed...

    I guss here is the problem network_link 'name '.

    Rajesh

  • Database links

    Hi all

    I have much dblinks on my database, how can I determine what private dblinks and what audience?

    views dba_db_links and all_db_links is have any information about this.

    A quick Google search gave the following link,.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28310/ds_admin005.htm#ADMIN12173

    He, citing

    OWNER All exceptUSER_* The user who created the database link. If the link is public, the user is listed as PUBLIC .

    HTH

    Aman...

  • Cannot connect through the ORA-01017 Invalid Username/Password database link

    Hello

    I have two virtual machines with Oracle 11 g 2 and one with Oracle 12 c installed on RHEL 6

    I wanted to install a dblink between the 2, but after you have created the dblink I get error: ORA - 01017 Invalid username/password

    Now, I know, the error is clear enough but when I try to connect using netmgr it works

    So just to summarize, Oracle 12 c, I'm trying to connect to Oracle 11 g using a DBLINK but I get ORA-01017

    Since Oracle 12 c, I created a new service so that I have the remote db alias in tnsname.ora and at the end of the process, when they ask for test connection, I can connect successfully to remote db

    Then I created a dblink according to the following:

    SQL > CREATE PUBLIC DBLINK LINK DATABASE to CONNECT to

    "hr""" IDENTIFIED BY ' password ' with the HELP of 'REMOTEDB ';

    If I then select * from employees@dblink, I get the error

    What I've noticed, it is that in the 11g (the target machine) I can not connect with OS authentication, don't know if its related

    If i: sqlplus / as sysdba I get ORA-01031 insufficient become

    I have to connect to the Linux box as user 'oracle', who is a member of the groups oinstall dba

    Am I missing something?

    Thank you!

    CHRI$ says:

    SQL > CREATE PUBLIC DATABASE LINK DBLINK TO CONNECT TO

    'hr' IDENTIFIED BY 'password' with the HELP of "REMOTEDB";

    You will probably have to create the link without containing the user name and the word in double quotes.

Maybe you are looking for