Question on DBLink for 2 databases oracleHow to create a DB link between two oracle instancesHow does database indexing work?How to select the nth row in a SQL database table?MyISAM versus InnoDBHow to list the tables in a SQLite database file that was opened with ATTACH?How do I restore a dump file from mysqldump?Get list of all tables in Oracle?Best way to store password in databaseWhat are the options for storing hierarchical data in a relational database?Import SQL dump into PostgreSQL databaseReset identity seed after deleting records in SQL Server

Can derivatives be defined as anti-integrals?

Olympic game scoring

Can Feather bring back a spell with Jump-Start?

How to give my students a straightedge instead of a ruler

What officially disallows US presidents from driving?

Does a succubus' Charm end when it dies?

Is there any reason to concentrate on the Thunderous Smite spell after using its effects?

How to control the output voltage of a solid state relay

Why is the Digital 0 not 0V in computer systems?

How do certain apps show new notifications when internet access is restricted to them?

A Mainer Expression

Make 1998 using the least possible digits 8

How to publish superseding results without creating enemies

Why don't Wizards use wrist straps to protect against disarming charms?

Python web-scraper to download table of transistor counts from Wikipedia

Examples of proofs by making reduction to a finite set

Why don't airports use arresting gears to recover energy from landing passenger planes?

Can a character with good/neutral alignment attune to a sentient object with evil alignment?

Why is my fire extinguisher emptied after one use?

Consonance v. Dissonance

What is the mathematical notation for rounding a given number to the nearest integer?

Why the car dealer is insisting on loan instead of cash

How are aircraft depainted?

What are these things that surround museum exhibits called?



Question on DBLink for 2 databases oracle


How to create a DB link between two oracle instancesHow does database indexing work?How to select the nth row in a SQL database table?MyISAM versus InnoDBHow to list the tables in a SQLite database file that was opened with ATTACH?How do I restore a dump file from mysqldump?Get list of all tables in Oracle?Best way to store password in databaseWhat are the options for storing hierarchical data in a relational database?Import SQL dump into PostgreSQL databaseReset identity seed after deleting records in SQL Server






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a server with 2 databases: dbtest and checkdb.
I need that user user_b of dbtest can made a select on a table of other database.
How i have to set the dblink?










share|improve this question
























  • stackoverflow.com/questions/13267218/…

    – saman tr
    Mar 28 at 11:39

















0















I have a server with 2 databases: dbtest and checkdb.
I need that user user_b of dbtest can made a select on a table of other database.
How i have to set the dblink?










share|improve this question
























  • stackoverflow.com/questions/13267218/…

    – saman tr
    Mar 28 at 11:39













0












0








0








I have a server with 2 databases: dbtest and checkdb.
I need that user user_b of dbtest can made a select on a table of other database.
How i have to set the dblink?










share|improve this question














I have a server with 2 databases: dbtest and checkdb.
I need that user user_b of dbtest can made a select on a table of other database.
How i have to set the dblink?







database oracle dblink






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 11:33









Valerio DonatiValerio Donati

12 bronze badges




12 bronze badges















  • stackoverflow.com/questions/13267218/…

    – saman tr
    Mar 28 at 11:39

















  • stackoverflow.com/questions/13267218/…

    – saman tr
    Mar 28 at 11:39
















stackoverflow.com/questions/13267218/…

– saman tr
Mar 28 at 11:39





stackoverflow.com/questions/13267218/…

– saman tr
Mar 28 at 11:39












2 Answers
2






active

oldest

votes


















0
















On the top of your script run



alter session set global_names=false;


then whenever you need to fetch data from checkdb you add the link as a suffix. don't know exactly how your dbs are defined but something like



user_b is on dbtest



select * from table_name@dblink 
#might be that dblink is not the exact name.


hope it helps.






share|improve this answer
































    0
















    Connected as user in one of those databases, create a database link to another database following the syntax (https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-DATABASE-LINK.html#GUID-D966642A-B19E-449D-9968-1121AF06D793). It hasn't changed for ages, I suppose.



    For example:



    SQL> create database link dbl_scott -- database link name
    2 connect to scott -- you're connecting to this user (scott) ...
    3 identified by tiger -- ... which is identified by this password (tiger)
    4 using 'db11g:1521/orcl'; -- using clause has a database server (db11g):port (1521)/service name (orcl)

    Database link created.

    SQL> -- Testing; it has to return a row
    SQL> select * From dual@dbl_scott;

    D
    -
    X

    SQL>


    The USING clause could be shortened by putting target database alias (the one written in TNSNAMES.ORA file on your database server). If you don't have access to that file (as you aren't a DBA), then the above option works OK.



    Note that - even if you use invalid settings - database link might be created, but it won't work. For example:



    SQL> drop database link dbl_scott;

    Database link dropped.

    SQL> create database link dbl_scott
    2 connect to xyzalksfjlaskfj
    3 identified by abc
    4 using '9809803242';

    Database link created.

    SQL> select * from dual@dbl_scott;
    select * from dual@dbl_scott
    *
    ERROR at line 1:
    ORA-12154: TNS:could not resolve the connect identifier specified


    SQL>


    Therefore, be careful.






    share|improve this answer



























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );














      draft saved

      draft discarded
















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55396571%2fquestion-on-dblink-for-2-databases-oracle%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0
















      On the top of your script run



      alter session set global_names=false;


      then whenever you need to fetch data from checkdb you add the link as a suffix. don't know exactly how your dbs are defined but something like



      user_b is on dbtest



      select * from table_name@dblink 
      #might be that dblink is not the exact name.


      hope it helps.






      share|improve this answer





























        0
















        On the top of your script run



        alter session set global_names=false;


        then whenever you need to fetch data from checkdb you add the link as a suffix. don't know exactly how your dbs are defined but something like



        user_b is on dbtest



        select * from table_name@dblink 
        #might be that dblink is not the exact name.


        hope it helps.






        share|improve this answer



























          0














          0










          0









          On the top of your script run



          alter session set global_names=false;


          then whenever you need to fetch data from checkdb you add the link as a suffix. don't know exactly how your dbs are defined but something like



          user_b is on dbtest



          select * from table_name@dblink 
          #might be that dblink is not the exact name.


          hope it helps.






          share|improve this answer













          On the top of your script run



          alter session set global_names=false;


          then whenever you need to fetch data from checkdb you add the link as a suffix. don't know exactly how your dbs are defined but something like



          user_b is on dbtest



          select * from table_name@dblink 
          #might be that dblink is not the exact name.


          hope it helps.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 11:41









          dapazdapaz

          3985 silver badges15 bronze badges




          3985 silver badges15 bronze badges


























              0
















              Connected as user in one of those databases, create a database link to another database following the syntax (https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-DATABASE-LINK.html#GUID-D966642A-B19E-449D-9968-1121AF06D793). It hasn't changed for ages, I suppose.



              For example:



              SQL> create database link dbl_scott -- database link name
              2 connect to scott -- you're connecting to this user (scott) ...
              3 identified by tiger -- ... which is identified by this password (tiger)
              4 using 'db11g:1521/orcl'; -- using clause has a database server (db11g):port (1521)/service name (orcl)

              Database link created.

              SQL> -- Testing; it has to return a row
              SQL> select * From dual@dbl_scott;

              D
              -
              X

              SQL>


              The USING clause could be shortened by putting target database alias (the one written in TNSNAMES.ORA file on your database server). If you don't have access to that file (as you aren't a DBA), then the above option works OK.



              Note that - even if you use invalid settings - database link might be created, but it won't work. For example:



              SQL> drop database link dbl_scott;

              Database link dropped.

              SQL> create database link dbl_scott
              2 connect to xyzalksfjlaskfj
              3 identified by abc
              4 using '9809803242';

              Database link created.

              SQL> select * from dual@dbl_scott;
              select * from dual@dbl_scott
              *
              ERROR at line 1:
              ORA-12154: TNS:could not resolve the connect identifier specified


              SQL>


              Therefore, be careful.






              share|improve this answer





























                0
















                Connected as user in one of those databases, create a database link to another database following the syntax (https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-DATABASE-LINK.html#GUID-D966642A-B19E-449D-9968-1121AF06D793). It hasn't changed for ages, I suppose.



                For example:



                SQL> create database link dbl_scott -- database link name
                2 connect to scott -- you're connecting to this user (scott) ...
                3 identified by tiger -- ... which is identified by this password (tiger)
                4 using 'db11g:1521/orcl'; -- using clause has a database server (db11g):port (1521)/service name (orcl)

                Database link created.

                SQL> -- Testing; it has to return a row
                SQL> select * From dual@dbl_scott;

                D
                -
                X

                SQL>


                The USING clause could be shortened by putting target database alias (the one written in TNSNAMES.ORA file on your database server). If you don't have access to that file (as you aren't a DBA), then the above option works OK.



                Note that - even if you use invalid settings - database link might be created, but it won't work. For example:



                SQL> drop database link dbl_scott;

                Database link dropped.

                SQL> create database link dbl_scott
                2 connect to xyzalksfjlaskfj
                3 identified by abc
                4 using '9809803242';

                Database link created.

                SQL> select * from dual@dbl_scott;
                select * from dual@dbl_scott
                *
                ERROR at line 1:
                ORA-12154: TNS:could not resolve the connect identifier specified


                SQL>


                Therefore, be careful.






                share|improve this answer



























                  0














                  0










                  0









                  Connected as user in one of those databases, create a database link to another database following the syntax (https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-DATABASE-LINK.html#GUID-D966642A-B19E-449D-9968-1121AF06D793). It hasn't changed for ages, I suppose.



                  For example:



                  SQL> create database link dbl_scott -- database link name
                  2 connect to scott -- you're connecting to this user (scott) ...
                  3 identified by tiger -- ... which is identified by this password (tiger)
                  4 using 'db11g:1521/orcl'; -- using clause has a database server (db11g):port (1521)/service name (orcl)

                  Database link created.

                  SQL> -- Testing; it has to return a row
                  SQL> select * From dual@dbl_scott;

                  D
                  -
                  X

                  SQL>


                  The USING clause could be shortened by putting target database alias (the one written in TNSNAMES.ORA file on your database server). If you don't have access to that file (as you aren't a DBA), then the above option works OK.



                  Note that - even if you use invalid settings - database link might be created, but it won't work. For example:



                  SQL> drop database link dbl_scott;

                  Database link dropped.

                  SQL> create database link dbl_scott
                  2 connect to xyzalksfjlaskfj
                  3 identified by abc
                  4 using '9809803242';

                  Database link created.

                  SQL> select * from dual@dbl_scott;
                  select * from dual@dbl_scott
                  *
                  ERROR at line 1:
                  ORA-12154: TNS:could not resolve the connect identifier specified


                  SQL>


                  Therefore, be careful.






                  share|improve this answer













                  Connected as user in one of those databases, create a database link to another database following the syntax (https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/CREATE-DATABASE-LINK.html#GUID-D966642A-B19E-449D-9968-1121AF06D793). It hasn't changed for ages, I suppose.



                  For example:



                  SQL> create database link dbl_scott -- database link name
                  2 connect to scott -- you're connecting to this user (scott) ...
                  3 identified by tiger -- ... which is identified by this password (tiger)
                  4 using 'db11g:1521/orcl'; -- using clause has a database server (db11g):port (1521)/service name (orcl)

                  Database link created.

                  SQL> -- Testing; it has to return a row
                  SQL> select * From dual@dbl_scott;

                  D
                  -
                  X

                  SQL>


                  The USING clause could be shortened by putting target database alias (the one written in TNSNAMES.ORA file on your database server). If you don't have access to that file (as you aren't a DBA), then the above option works OK.



                  Note that - even if you use invalid settings - database link might be created, but it won't work. For example:



                  SQL> drop database link dbl_scott;

                  Database link dropped.

                  SQL> create database link dbl_scott
                  2 connect to xyzalksfjlaskfj
                  3 identified by abc
                  4 using '9809803242';

                  Database link created.

                  SQL> select * from dual@dbl_scott;
                  select * from dual@dbl_scott
                  *
                  ERROR at line 1:
                  ORA-12154: TNS:could not resolve the connect identifier specified


                  SQL>


                  Therefore, be careful.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 28 at 11:46









                  LittlefootLittlefoot

                  33.6k7 gold badges17 silver badges36 bronze badges




                  33.6k7 gold badges17 silver badges36 bronze badges































                      draft saved

                      draft discarded















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55396571%2fquestion-on-dblink-for-2-databases-oracle%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                      은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현