Showing posts with label Copy. Show all posts
Showing posts with label Copy. Show all posts

Friday, June 6, 2008

PL\SQL : Copy tables between databases

As you noticed, my posts run around my daily problems, and this isn't an exception. Past week I needed to copy large amount of data between production and development database to perform some tests. After some research I've found SQL*Plus COPY command, that fits like a glove in my needs.
So here's the syntax:


COPY FROM database TO database action
destination_table (column_name, column_name...) USING query

where action stands for:

  • create - if destination table doesn't exist yet;
  • replace - if destination table exists and we wish to drop and create it again;
  • append - Inserts data if table exist, otherwise it will be created;
  • insert - Insert data into an existing table.

An example could be :

SQL>copy from user/pass@DB1 
to user2/pass2@DB2
append new_emp
using select * from emp;
Enjoy!

Friday, November 2, 2007

How to deploy files in a remote server?

It's easy you say, just share your drives when you connect through rdp. Ok, let's talk about worse case scenario, you can't share drives and you can even share a drive from your remote server.
So you can use a very usefull tool named WordPad. Surprised ?
It's even easier than sharing you drives, watch it :

  1. Zip all your files into a single file;
  2. Open a wordpad in your local machine;
  3. Copy zip file into wordpad (WordPad would serialize your file);
  4. Copy object that appears inside Wordpad;
  5. Open wordpad in your remote machine and paste your object into it;
  6. Finally copy your recent pasted object into remote server.

Enjoy.