Mark Rittman's Oracle Weblog
This is the weblog for Mark Rittman, a developer working on Oracle Data Warehousing technology based in Brighton, England. You can contact me at mark@rittman.net.
        

20 August 2003

SQL Plus has a useful command called COPY that until now I had no idea about. It's an alternative to the IMP and EXP commands that lets you copy data between two SQL*Net connected databases.

Using the syntax

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

You can quickly copy data from one database instance to another using an SQL query, that lets you CREATE a new table, REPLACE an existing table, INSERT values to an existing table or APPEND values to an existing table.

A typical example of the COPY command in use would be;

SQL> copy from scott/tiger @ORCL92 -
to scott/tiger @ORCL92-
create new_emp –
using select * from emp;

which would create a new table called NEW_EMP on the same database, copying across all the data from the EMP table. It could equally be to a different database, and you could limit down the data copied using a WHERE clause. You can SET three SQL*Plus parameters, ARRAYSIZE, COPYCOMMIT and LONG, which determine the number of rows that SQL*Plus will retrieve at one time, the number of retrieves that will take place before a COMMIT is issued, and the number of characters copied when a column is a LONG datatype.

If you're moving data from one remote server to another, it's best to run the command directly from either of the servers, as if you run it at your client machine, the data passes through your PC on route between the two servers.

You can also run this command using the iSQL*Plus web-based version of SQL*Plus, which would make it easier to avoid inadvertandly moving the data through your client machine, as you'll be able to directly log on to the remote server rather than running the command locally. Also, there's rumours that SQL*Plus will either be desupported, or even not shipped, with Oracle 10G, so it's probably worth getting used to running it on the web-based version from the outset.

This tip on the COPY command came to light when looking through a new paper called "Oracle Untapped Utilities" by Dave Moore. It's got sections on the COPY command, plus many other such as DBMS_XPLAIN, and it's well worth taking a look.


7:16:03 PM    

Update on the 9i OLAP Spreadsheet Addin that was mentioned in a previous post.

Aneel Shenker has announced on OTN that a 9i OLAP Spreadsheet Addin will indeed be produced, and it's due for release in beta form in October 2003. Functionality will be similar to the Express Excel Addin (i.e. it'll feature a selector) but in the first release it will be read-only. This suggests that it's based on the BI Beans technology, which is also read-only at the moment, and has a ready-made selector in the form of the Query Bean.


1:20:11 PM    

© Copyright 2003 Mark Rittman.
 
August 2003
Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Jul   Sep






Click here to visit the Radio UserLand website.

Subscribe to "Mark Rittman's Oracle Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.