I have two databases, orcl & orc0 respectively. I made two services for above databases, and I want to access some...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
data from one databse to another database, but I could not access the data.
Example: 1) SQL> create table xyx as select * from establish.estt_dept_master@fndn; ERROR at line 1: ORA-02019: connection description for remote database not found 2) create table ankush_engg.xyz@domain as select * from establish.estt_dept_master@fndn; ERROR at line 1: ORA-02021: DDL operations are not allowed on a remote database
First, you'll need to fire up the Net8 Assistant and create a Service entry for each of your databases. Or, you can do this manually, by modifying your TNSNAMES.ORA file found in %ORACLE_HOME%\network\admin to include an entry like the following:
ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.com)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )
Make two service entries, one for ORCL and one for ORC0.
The next step is to create a database link from one database to another. For instance, sign on to the ORC0 instance. Then create a database link to the ORCL instance with the following command:
CREATE DATABASE LINK orcl_db CONNECT TO myuser IDENTIFIED BY mypassword USING 'orcl';
Your database link is now created. I always test my database link by issuing the following:
SELECT SYSDATE FROM DUAL@orcl_db;
Now that the database link is set up, it is time to copy a table to this local database, from the remote database. This can be done simply as follows:
CREATE TABLE local_table AS SELECT * FROM remote_table@orcl_db;
For More Information
- Dozens more answers to tough Oracle questions from Brian Peasland are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Dig Deeper on Oracle database design and architecture
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.