LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-13-2011, 12:04 PM   #1
smritisingh03
Member
 
Registered: Nov 2010
Posts: 43

Rep: Reputation: 0
Creating link between two database


Hi

I need to copy tables from abc5/abc5@pqrXYZ1 to
jk8/jk8@pqrXYZ1.

For this I am trying to create a link between the 2 databases but not wkng.I am pasting here what I ve tried.Please let me know why isnt this wkng.


sqlplus jk8/jk8@pqrXYZ1

CREATE DATABASE LINK DB1.WORLD CONNECT TO abc5 IDENTIFIED BY abc5 USING 'DB1.WORLD';


please help!!!
 
Old 04-13-2011, 12:22 PM   #2
jcalzare
Member
 
Registered: Aug 2009
Location: Chicago
Distribution: CentOS
Posts: 114

Rep: Reputation: 34
Why don't you just use mysqldump if you just want to copy the tables?

mysqldump abc5 > abc5.sql
mysql jk8 < abc5.sql

You can just get certain tables if you don't want them all, just look at the documentation for mysqldump.
 
Old 04-13-2011, 01:38 PM   #3
smritisingh03
Member
 
Registered: Nov 2010
Posts: 43

Original Poster
Rep: Reputation: 0
but i need to first link the two databases and then do a COPY.

is mysqldump possible in oracle?
 
Old 04-13-2011, 03:33 PM   #4
jcalzare
Member
 
Registered: Aug 2009
Location: Chicago
Distribution: CentOS
Posts: 114

Rep: Reputation: 34
Oh, I didn't realize this was for Oracle. I'm afraid I'll be of no help then.
 
Old 04-13-2011, 05:07 PM   #5
smritisingh03
Member
 
Registered: Nov 2010
Posts: 43

Original Poster
Rep: Reputation: 0
i found the solution ans itz working.I ve posted the full script for others like me!!!



#!/bin/ksh



#echo "Please enter the userID: \c"

#read $1 #stores the uid

#echo "Please enter the password: \c"

#read $2 #stores the pwd

#echo "Please enter the database instance: \c"

#read $3 # stores the instance


#sqlplus -s $1/$2@$3 #connecting to the environment where the tables need to be copied

#set heading off feedback off pagesize 0 linesize 30000 trimout on;
#whenever sqlerror exit 1;
#whenever oserror exit 1;



sqlplus 1/2@3 <<EOF #id and pwd and istance of DB where u need to copy


create database link smriti connect to id IDENTIFIED BY pwd using 'instance'; #id and pwd and instance of DB1 from which u need to pick the tables



CREATE TABLE new_a AS SELECT * FROM DB1instance.a@smriti;
CREATE TABLE new_b AS SELECT * FROM DB1instance.b@smriti;
CREATE TABLE new_c AS SELECT * FROM DB1instance.c@smriti;



EOF
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating LLDAP database? jnojr Linux - Server 7 08-05-2009 08:04 PM
creating database in mysql kc3377 Linux - Software 7 05-05-2008 11:18 AM
About creating database satimis Linux - Server 2 06-14-2007 02:12 PM
creating database using awk RajaRC Linux - General 11 07-30-2004 06:33 AM
Creating an RPM database Null Linux - Software 6 03-20-2003 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration