SQL COPY command Weird outcome!!

Hi,
On Friday I have refreshed two tables from one database to another using SQL COPY command.But today I found something weird that two tables have data which were before refresh.
the command I hadused:
copy from test/xxxx@db3to test/yyyy@db1 insert master_table using select * from master_table;What could be the reason.??

COPY Command is used to COPY database table from one Schema to another Schema.

Similar Messages

  • Sql copy command

    Hello to all,
    I am copying tables from one database to another. both are 9.2.0.4 on solaris 8 o/s. Received this error but the copy was successful. Is this something i should be worried about?
    issued this command from sqlplus logged into the host:
    copy from saturn/xxxx@prod to saturn/xxx@pprd2 create scrrtst_prod using select * from scrrtst;
    received this msg:
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    SQLRCN in cpytbl failed: -1075
    Table SCRRTST_PROD created.
    45 rows selected from saturn@prod.
    45 rows inserted into SCRRTST_PROD.
    45 rows committed into SCRRTST_PROD at saturn@pprd2.
    Any suggestions?
    Thanks!

    You may have run into bug 1504702. As a workaround you will need to use command line, as you've already figured out. I don't think a patch is available for Windows yet, although there is for Solaris (in the 8.1.7.4 patch set).
    Alison

  • Copy Command in Pl/Sql block

    Can I use Copy command in Pl/Sql.For example :-
    Declare
    cursor c1 is select table_name from all_tables
    where owner = 'LSP' and rownum = 1;
    v1 varchar2(2000);
    Begin
    for c2 in c1 loop
    v1:='copy from lsp/lsp123479@dvlaq to scott/[email protected] create '|| c2.table_name ||' using select * from '||c2.table_name;
    execute immediate v1;
    end loop;
    end;
    Its not running properly giving an error as invalid Sql statement .
    Is it bcoz Copy command cannot be used in a Pl/Sql Block.

    Is there any other way to move the Table & data to another Data Base .Database link is the obvious one. And the SQL statement would look something like this (on the target database):
    SQL> create table FOO nologging as select * from FOO@sourcedb;
    However, the first question I always ask if why? What one may think is the solution to a problem is not always the best solution. So one need to identify the problem first, and then see what solutions there are and which one is the best fit.
    Other options are replication (using materialised views for example), Data Pump (available with 10G) - even could be Data Guard, a standby database, or a Real Application Cluster... depending on just what the problem and actual requirements are.
    Also important to note that SQL*Plus has its own set of commands. Do not confuse these commands (like EXEC, COPY, CONNECT, HOST etc) with the SQL and PL/SQL Languages. Not only are they executed by different software products, SQL*Plus commands are executed on the client and SQL (and PL/SQL) runs inside the Oracle database instance.

  • Copy command in SQL

    What is the Copy Command in SQL ?

    COPY Command is used to COPY database table from one Schema to another Schema.

  • SQL*Plus 'Copy' command and LONG datatypes

    Hi. I'm using Oracle 9.2.0.5 and wanna copy LONG to LONG without using an Interface in VB or any other programming language.
    Some of the fields (plain text) are greater than 32 Kb, and I tried the SQL*Plus 'Copy' command, without success.
    (For compatibility reasons I can't convert LONG to CLOB, I need to copy LONG to LONG)
    This is the example I'm working with:
    Table Source_LONG (ID number, DATA long)
    Table Destination_LONG (ID number, DATA long)
    The SQL*Plus command: (connected from test_database@environment)
    set long 100000
    copy from test_database/test_database@environment insert destination_long (id,data)
    I tried using both FROM and TO, but same results.
    The fields are copied into destination_long, but they are
    truncated at 32768 bytes, even with the LONG variable set to 100000. Any ideas ?
    Thanks.

    I'm working with 2 similar tables with this structure:
    SOURCE_LONG (ID number, DATA long)
    DESTINATION_LONG (ID number, DATA long)
    SOURCE_LONG contains two rows:
    ID DATA
    1 hello
    3 ....text bigger than 32kb...
    I tried your solution and it insert 2 rows, but only the ID is filled. The DATA is empty in both cases :-(
    insert into destination_long(id,data) (select id,to_lob(data) from source_long);

  • GPF in SQL*PLUS Copy Command?

    Hello,
    I'm getting a GPF and crash of SQL*Plus when I use the copy command. Seems like I used to be able to make it work if I tried logging on to the source database before the copy, but now even that won't work. I issue the command, it looks out over the modem for the remote database, then the GPF occurs.
    copy from me/[email protected] to me/me@LocalDB -
    insert ARRG_BNDRY_OBJECT -
    using -
    SELECT * FROM ARRG_BNDRY_OBJECT WHERE ARRG_BNDRY_KEY IN -
    (80169);
    Ideas?
    Thanks,
    Dale

    You might also want to try the same command using SQL*Plus command line (DOS version). If you haven't used it before, enter SQLPLUS at the command prompt, eg:
    c:\sqlplus
    Alison

  • COPY command not working SQL Commands editor

    Hi All,
    I want to have a simple 'one-button-solution' for copying few tables from an external DB into the database where my Apex application is running.
    When I issue the following from the sqlplus command line I get the following output:
    SQL> COPY FROM schema/password@tnsnames_sid TO schema/password@tnsnames_sid REPLACE TABLE_TEST USING select * from TABLE_FOREIGN;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    Table TABLE_TEST dropped.
    Table TABLE_TEST created.
    2 rows selected from schema@tnsnames_sid.
    2 rows inserted into TABLE_TEST.
    2 rows committed into TABLE_TEST at schema@tnsnames_sid.
    SQL>
    However, if I try exactly the same command from within the Apex 'SQL Commands' editor, I get the following error message:
    ORA-00900: invalid SQL statement
    NOTE that the reason I use COPY command is to overcome problems with LONG datatype which arise when doing simply CREATE TABLE AS.... with dblink.
    In anycase, how can I make this work from within the 'SQL Commands' editor (and therefore in a button process).
    Regards,
    Pawel.

    Hi Harman,
    yes, this is a known issue.
    It's fixed with NW04 SPS 13.
    Regards Matthias Röbig-Landau

  • SQL PLUS Copy Command

    I'm having problems with the copy command in sql plus
    Here's my command
    COPY FROM tib_oms/tib_oms@odb1 -
    TO gbonk/gbonk@stage -
    INSERT -
    gbonk.products ( id_manufacturer, id_sku, category ) -
    USING -
    select id_mfr, sku, prodcat from tib_oms.pricinghistory
    The error I receive is...
    CPY0007: Select list has fewer columns than destination table
    I'm selecting 3 columns and I'm specifing 3 columns so I don't get what's up.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Greg Bonk ([email protected]):
    Well i gave it a shot. Here's my modified copy command....
    copy from tib_oms/tib_oms@odb1 -
    TO gbonk/gbonk@stage -
    insert -
    gbonk.products ( "ID_MANUFACTURER", "ID_SKU", "CATEGORY" ) -
    using -
    select "ID_MFR", "SKU", "PRODCAT" from tib_oms.pricinghistory;
    But I still recieve the same error. Is there anything else that I could trouble shoot?<HR></BLOCKQUOTE>
    did u check if the destination & target columns have the same structure. maybe one of the is a composite datatype (i.e varray,nested tables etc) ?
    null

  • Copy command for SQL*Plus

    Am trying to use the copy command in SQL*Plus to copy a table
    from an Oracle database to a local table on my machine in
    another format. Keep getting errors. It seems to contact the
    remote machine fine, but can't locate my local machine or figure
    out where to put it. Any suggestions on how to set up my
    Windows 95 machine to get the copy command working would be
    greatly appreciated. Thank you.
    null

    Hi,
    Here is an example :
    SQL> copy from scott/tiger@q4_production_server create ord -
    using select * from ord;Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    Table ORD created.
    21 rows selected from scott@q4_production_server.
    21 rows inserted into ORD.
    21 rows committed into ORD at DEFAULT HOST connection.
    Hope this helps,
    Bala
    Laura Michaels (guest) wrote:
    : Am trying to use the copy command in SQL*Plus to copy a table
    : from an Oracle database to a local table on my machine in
    : another format. Keep getting errors. It seems to contact the
    : remote machine fine, but can't locate my local machine or
    figure
    : out where to put it. Any suggestions on how to set up my
    : Windows 95 machine to get the copy command working would be
    : greatly appreciated. Thank you.
    null

  • SQL*Plus COPY command does not work

    SQL*Plus COPY command does not work in SQL Developer. I am using SQL Developer 1.5.1 on Windows XP.
    copy from <source_db_connection> to <target_db_connection> create <target_tab_name> using select * from <source_tab_name>
    Does it work on different versions of SQL Developer ?
    Anyone had any success in trying COPY command in SQL Developer?
    Thanks in advance.

    While it hasn't been updated for v1.5, this page lists the supported SQL*Plus commands. COPY is explicitly listed as not supported.
    theFurryOne

  • ORA-01401 on execution SQL*Plus Copy command

    I looking solution for strange problem :
    I having two database created with AL32UTF8 character-set ; current application design are that we loading data throw SQL Loader and than transferring loaded data from one database to another using SQL*Plus copy command.
    Now , we having two tables , declared 100% identically , with respect to NLS and CHAR semantics (all varchar fields having CHAR inside length).
    At attempt to transfer data , with SQL*Plus Copy command I'm receiving next output :
    ERROR:
    ORA-01401: inserted value too large for column
    If I'm trying to transfer data via DB link , and this succeeds , or throw exp/imp utilities it also works .
    Database servers are 9.2 (i tryied with 9.2.0.6 or 9.2.0.8) ; client side were 9.2.0.8 , 10.1.0.5 ...
    On client side NLS_LANG variable are set to AMERICAN_AMERICA.AR8MSWIN1256 (we working on project who needs to support arabic language)
    Did anyone encountered same problem ? Any One ?

    it could be that the column of the table that you are trying to insert the data has a small length.

  • COPY command in SQL*Plus 8.1.6 returns ORA-65535

    The COPY command in the windows version of SqlPlus (SQLPLUSW) does not work any more. I get the following error
    << Array fetch/bind size is 5. (arraysize is 5)
    Will commit after every array bind. (copycommit is 1)
    Maximum long size is 80. (long is 80)
    ERROR:
    ORA-65535: Message 65535 not found; product=RDBMS; facility=ORA >>
    Interestingly, I can run the same COPY command successfully if I use SQLPLUS.exe ( the command line version ). No error & it completes the copy.
    I recently changed my Oracle client from 7.3 to v8.1.6.
    I had not encountered this problem with the same command in v7.3.

    You may have run into bug 1504702. As a workaround you will need to use command line, as you've already figured out. I don't think a patch is available for Windows yet, although there is for Solaris (in the 8.1.7.4 patch set).
    Alison

  • In PL-SQL copy a table from one database to another

    I am currently working on a VB app where I need a way to archive tables from the running database to an archive database. I was hoping to do this with a stored procedure. Thanks for any suggestions in advance.

    AFAIAA there is no equivalent of the SQL*Plus copy command, but it is realtively simple to build such a thing in PL/SQL using DBMS_SQL or EXECUTE IMMEDIATE to issue the necesssary INSERT INTO table@archive_db select * from table;It's simple to create the table in the archive db , you just test for it's exist using %SQLFOUND.
    If you want it fancier, eg. changing the tablename dynamically that's also easy.
    rgds, APC

  • Maximum length of SQL*Plus Command?

    I'm typing a long query into SQL*Plus (Linux, version 9.2.0.1... yes, I know it's ancient).
    If I run this query, all works fine:
    select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$')
    else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
    'UPDATEMYAUDITING_TABLESETTEST_DETAILS='''||GRANTEE||'''WHEREMYAUDIT_REFNO=''A.F
    update myauditing_table set test_details='AUDIT_TRAIL is set to: DB' where myaud
    it_refno='A.FE';(In other words, is SQL that generates other SQL: if AUDIT_TRAIL is set to something interesting, tell me who has access to the AUD$ table. And it's working fine... the agg_concat function mentioned is simply Tom Kyte's stragg function under another name, as lifted word-for-word from http://www.sqlsnippets.com/en/topic-11591.html)
    Now this is what happens if I take out the linebreak after the mention of AUD$, so that the command is submitted as one single line of code:
    SQL> select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$') else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
    SP2-0734: unknown command beginning "s set to: ..." - rest of line ignored.The error message indicates that the text has been 'split' at the 'AUDIT_TRAIL is set to...' bit, so that "s set to" is being treated as a new command, which is of course syntactically invalid. There is definitely no other change in text between the two versions, apart from the removal of a carriage return before the "else" statement.
    Possibly a coincidence, but the first "s" in "s set to" appears at position 258 in the entire text... close to a possible 255 or 256 character limit, perhaps?
    The same problem happens whether I run the command as a script (@mysql.sql) or typed in directly into a client SQL*Plus session. Is there some inherent limit to the length of commands that SQL*Plus can process in this version? My code runs fine on 10g and 11g databases/clients, whether it's on one line or two. Anyone know of a bug in 9i regarding this? And if there's a workaround (other than the obvious one of upgrading, of course!)

    As mentioned, it's choking at the 258th character, not the 240th. Also, it's a SELECT statement, not a COPY command (one relates to the database, the other is an internal SQL*Plus feature). And someone else also kindly pointed out that SQL*Plus has a command limit length (i.e., database-related commands) of 2500 characters. So I don't think that's the issue.
    I can be a bit more specific about this one now, though. I've a sequence of Solaris boxes running 9.2.0.1 up, and the results are that 9.2.0.1 is affected; and it's a problem for 9.2.0.7:
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE    9.2.0.1.0       Production
    TNS for Solaris: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 - Production
    SQL> select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$') else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
    SP2-0734: unknown command beginning "s set to: ..." - rest of line ignored.And...
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    PL/SQL Release 9.2.0.7.0 - Production
    CORE    9.2.0.7.0       Production
    TNS for Solaris: Version 9.2.0.7.0 - Production
    NLSRTL Version 9.2.0.7.0 - Production
    SQL> select 'update myauditing_table set test_details='''||grantee||''' where myaudit_refno=''A.FE'';' from (select case when upper(value) in ('DBO','TRUE')  then (select agg_concat(grantee) from dba_tab_privs where table_name='AUD$') else (select 'AUDIT_TRAIL is set to: '||value from dual) end as grantee from v$parameter where upper(name)='AUDIT_TRAIL' order by grantee);
    SP2-0734: unknown command beginning "s set to: ..." - rest of line ignored.But in 10.2.0.1, the problem disappears.
    I am not sure, but it is perhaps related to metalink note 285913.1, since we did get some ORA-00600: internal error code, arguments: [qernsRowP], [1] errors in the alert log with a slightly different version of the above query. Changing the query obviously alters the test, though, so it may be completely unrelated.
    Either way, I think it's definitely a version-specific SQL*Plus bug (though it would be nice if any other 9i owners out there could try it and report back!)
    Anyway, the workaround is simply to submit the command on two separate lines, wherever possible. And of course... to upgrade.

  • Copy Command across dblink

    Hi, i am wanting to copy a few columns from a table in db1 into a new table in db2. I can get this to work using the copy command in sql, but would like to recreate this in pl/sql.
    can the execute immediate create over the dblink?

    it all depends on the amount of data you're trying move across two differen servers.
    when you say data, what's it? is it a table or schema?
    COPY - works fine.But, the data being transferred over network. If you have very good band width, you will be fine.
    SQLLDR - To do this, You have to unload the first and load it into different servers.
    You can even try export(exp) and Import(imp) or datapump export(expdp) and datapump import(impdp)

Maybe you are looking for

  • Safari and Chrome shutting down

    Safari and Chrome shuttingdown what to do?

  • How to fetch message comments using JMA API?

    Hi All, From telnet <host> 143, and tring get comments associated with a message works well as shown below. 2 fetch 8 COMMENT ("/message/vendor/ms/follow-up-flag-status" ("value.shared")) * 8 FETCH (COMMENT ("/message/vendor/ms/follow-up-flag-status"

  • Yahoo/Apple Mail error message

    I am getting the following error message when trying to set up Yahoo mail in Apple Mail program. The server returned the error: The server "imap.yahoo.com" cannot be contacted on port 993. I have tried 995 on the port and still no work! What goes?

  • IPod nano stops reformatting with iPod update!

    Ok, My ipod got the dreaded grey folder screen when I tried to update it's software. I uninstalled everything iPod and reinstalled the stuff with the CD that came with it. It said it needed to be formatted so I click Yes. during the process, it just

  • Access/Segmentation Violation errors

    Here's another one of those "Has anyone seen this" questions. We are currently stress testing one of our applications and get the following 'Access/Segmentation Violation' error on a server partition: Begin Stack Backtrace ===========================