Transfering tables between databases

I have some tables in an Oracle database that I have to copy (for tests) to another Oracle database resident on another computer without compromising the first database in any way.
How can I do this? Is there a friendly (and straightforward process) ?

Hi,
Apart from the three methods what Mr.Lijesh Kalavara has stated, i feel COPY command can be another option.
It copies data from a query to a table in a local or remote database location.
Set arraysize and set copycommit controls the transactions commit batch mechanism.
sql> SET ARRAYSIZE <Number Of Records in each batch>
set arraysize 1000 determine the 1000 records of the total records will be retrieved in each batch.
sql> SET COPYCOMMIT <Number of batches should be commited at one time>
set copycommit 1 indicates one batch should be commited at a time.
So if we are inserting 100,000 records then data will commit after inserting 1000 records every time.
If you have a small rollback segment , set arraysize to less number of records and copycommit to 1.
Syntax :-
usage: COPY FROM <db> TO <db> <opt> <table> { (<cols>) } USING <sel>
<db> : database string, e.g., scott/tiger@d:chicago-mktg
<opt> : ONE of the keywords: APPEND, CREATE, INSERT or REPLACE
<table>: name of the destination table
<cols> : a comma-separated list of destination column aliases
<sel> : any valid SQL SELECT statement
Append : - Create table in the destination if it does not exist and ignore if it exist and insert rows
Create :- Create table in the destination and insert rows
Insert :- insert the rows only . Error occurs if the table does not exist.
Replace :- Drop the existing destination table and creates new table with data.
e.g.
set copycommit 100 arraysize 1000 buffer 100000
COPY FROM schema1/password@Db1 TO schema2/password@db2
insert table_in_db2 (column1, column2) USING SELECT * FROM table_in_db1;
COPY supports the following datatypes:
CHAR
DATE
LONG
NUMBER
VARCHAR2
By using copy command you can reduce the burden on a rollback segment by dividing the entire inserting data into pieces or batches which commit individually and thus avoid of using large rollback segment.

Similar Messages

  • Transferring Data between Databases with Character Sets UTF08 and US7ASCII

    Hi,
    I am trying to transfer data from Oracle 10g (character set :UTF08) to Oracle 8i ( character set: US7ASCII). I have tried the transfer using the DBLinks and found that there is no way the data could be transferred from 10g to Oracle 8i.
    The last option available is to use staging database for transfer. The staging database would be Oracle 10g only but the character set would be US7ASCII. I am expecting that since the character set is US7ASCII, this would be able to get compatible with Oracle 8i (US7ASCII). Secondly, Transfer from 10g to staging 10g should also work, since staging 10g would support UTF08 character set.
    Kindly tell me if this option would work or if there is any other way around.
    Thanks
    Nitin
    Message was edited by:
    Nits
    Message was edited by:
    Nits
    Message was edited by:
    Nits

    You possibly have a fundamental problem,which is more important than any technical issues. If your UTF8 (Unicode) database stores non-english characters you will lose these characters when transferring.
    Werner

  • Linking Table Between Database

    How can I link my table to 1 view in other database?
    I know, we can estalish the connection but I don't know how to do that.
    Please help,
    Thank You,

    What do you mean "link"? You can create a database link
    CREATE [PUBLIC] DATABASE LINK database_link_name
      CONNECT TO username_on_remote_machine
      IDENTIFIED BY password_on_remote_machine
      USING 'tns_alias_to_remote_database'and query tables across the database link. You cannot, however, define foreign key constraints across instances, which is a good thing considering the performance implications of doing so.
    Justin

  • Trigger in a join table between two database

    Hi an Happy new year
    I have two database, one is dedicated to security and the second for my multitenancy application
    In this two databases one have tables USER, USER_JOIN_USER_ROLE and USER_ROLE
    the second, USER (where fields are differents), USER_JOIN_USER_ROLE and USER_ROLE
    the two join table must be the same and USER_ROLE are the same in the two databases.
    I plan to use a trigger to replicate from the  application database to the security one, I already use triggers to Replicate USER and set the differents fields.
    I'm new in triggers using.
    My user replication trigger seems like that
    CREATE TRIGGER [dbo].[USER_REPLICATION]
    ON [dbo].[DM_USER]
    AFTER INSERT
    AS
    BEGIN
    DECLARE @EmployeeId int = (SELECT FKEmployee FROM inserted)
    DECLARE @Login nvarchar(50) = (SELECT LoginUser FROM Inserted)
    DECLARE @Password nvarchar(50) = (SELECT PasswordUser FROM Inserted)
    DECLARE @Tenant int = (SELECT IdCompany FROM TEST_MULTI.dbo.DM_COMPANY WHERE IsTenant = ''Y'')
    DECLARE @CompanyId int = (SELECT ExtIdCompany FROM TEST_MULTI.dbo.DM_COMPANY WHERE IsTenant = ''Y'')
    DECLARE @LegalEntityId int = (SELECT FKLegalEntity FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
    DECLARE @LastName nvarchar(255) = (SELECT LastNameEmployee FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
    DECLARE @FirstName nvarchar(255) = (SELECT FirstNameEmployee FROM TEST_MULTI.dbo.DM_EMPLOYEE WHERE IdEmployee = @EmployeeId)
    DECLARE @EMail nvarchar(255) = (SELECT EMail FROM inserted)
    SET NOCOUNT ON;
    INSERT INTO DM_SECURITY_MASTER.dbo.DM_USER(LoginUser, PasswordUser, FKCompany, TenantId, LegalEntityId, LastName, FirstName, Email)
    VALUES (@Login, @Password, @CompanyId, @Tenant, @LegalEntityId, @LastName, @FirstName, @EMail)
    UPDATE [TEST_MULTI].[dbo].[DM_USER] SET ExtIdUser = (SELECT IdUser FROM [DM_SECURITY_MASTER].[dbo].[DM_USER]
    WHERE LoginUser = @Login
    AND PasswordUser = @Password
    AND FKCompany = @CompanyId
    AND TenantId = @Tenant
    AND LegalEntityId = @LegalEntityId
    AND LastName = @LastName
    AND FirstName = @FirstName
    AND EMail = @EMail)
    WHERE IdUser = (SELECT IdUser FROM Inserted)
    END
    but I cannot figure how to use a trigger to update a collection and not find anything on it, any help welcome
    I use Windows Identity Foundation in my code and update or insert can set multiple rows

    Hello and thanks for help.
    The trigger i give as example already works fine but Fanny Liu is for sure better than mine and I will try it. Users insertions are not multiple, only one user can be inserted at the same time
    My question was most on using triggers to update a collection via a Join table between my user and users roles
    I wrote it Yesterday for INSERT
    USE [TEST_MULTI]
    GO
    /****** Object: Trigger [dbo].[USER_ROLE_INSERT_REPLICATION] Script Date: 01/03/2014 10:56:36 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:
    -- Create date: 2014/02/01
    -- Description: Replication INSERT on MASTER DATABASE
    -- =============================================
    ALTER TRIGGER [dbo].[USER_ROLE_INSERT_REPLICATION]
    ON [TEST_MULTI].[dbo].[DM_USER_JOIN_USER_ROLE]
    AFTER INSERT
    AS
    DECLARE InsertCursor CURSOR FOR (SELECT FKUser, FKUserRole FROM inserted)
    DECLARE @UserId int, @UserRoleId int
    OPEN InsertCursor
    FETCH NEXT FROM InsertCursor INTO @UserId, @UserRoleId
    WHILE @@FETCH_STATUS = 0
    BEGIN
    DECLARE @UserMasterId int = (SELECT ExtIdUser FROM TEST_MULTI.dbo.DM_USER WHERE IdUser = @UserId)
    IF NOT EXISTS(SELECT * FROM DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE WHERE FKUser = @UserMasterId
    AND FKUserRole = @UserRoleId)
    INSERT INTO DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE (FKUser, FKUserRole) VALUES (@UserMasterId, @UserRoleId)
    FETCH NEXT FROM InsertCursor INTO @UserId, @UserRoleId
    END
    CLOSE InsertCursor;
    DEALLOCATE InsertCursor;
    And for DELETE
    USE [TEST_MULTI]
    GO
    /****** Object: Trigger [dbo].[USER_ROLE_DELETE_REPLICATION] Script Date: 01/03/2014 10:57:58 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    -- =============================================
    -- Author:
    -- Create date: 2014/02/01
    -- Description: Replicate DELETE on MASTER DATABASE
    -- =============================================
    ALTER TRIGGER [dbo].[USER_ROLE_DELETE_REPLICATION]
    ON [TEST_MULTI].[dbo].[DM_USER_JOIN_USER_ROLE]
    AFTER DELETE
    AS
    DECLARE DeleteCursor CURSOR FOR (SELECT FKUser, FKUserRole FROM deleted)
    DECLARE @UserId int, @UserRoleId int
    OPEN DeleteCursor
    FETCH NEXT FROM DeleteCursor INTO @UserId, @UserRoleId
    WHILE @@FETCH_STATUS = 0
    BEGIN
    DECLARE @UserMasterId int = (SELECT ExtIdUser FROM TEST_MULTI.dbo.DM_USER WHERE IdUser = @UserId)
    DELETE FROM DM_SECURITY_MASTER.dbo.DM_USER_JOIN_USER_ROLE WHERE FKUser = @UserMasterId AND FKUserRole = @UserRoleId
    FETCH NEXT FROM DeleteCursor INTO @UserId, @UserRoleId
    END
    CLOSE DeleteCursor;
    DEALLOCATE DeleteCursor;
    It works fine
    Thanks for help, I will mark it as answered

  • How to find relationship between database tables

    Hi Mate,s.
    Iam new to SAPBW , PLZ tell me , How to find releationship between database table(Transperent tables).
    Regards.
    harry

    hi harry,
    from your previous postings, i guess you are asking relationship between tables in r/3, following links may help :
    http://www.sapgenie.com/abap/tables.htm
    http://www.sapgenie.com/abap/tables_sd.htm
    http://www.sapgenie.com/abap/tables_mm.htm
    http://www.sapgenie.com/abap/tables_fi.htm
    http://www.sapgenie.com/abap/tables_ps.htm

  • Difference between Database view and Table

    Hi there,
    Can anyone tell me the difference between Database view and Table.
    Will the Database view query be more faster than a database table?

    Tables and database views can be defined in the ABAP Dictionary.
    These objects are created in the underlying database with this definition. Changes in the definition of a table or database view are also automatically made in the database.
    Data from several tables can be combined in a meaningful way using a view (join).
    You can also hide information that is of no interest to you (projection) or only display
    those data records that satisfy certain conditions (selection).
    Database views implement an inner join. You only get those records which have an
    entry in all the tables included in the view.
    in views db modifications are not possible
    views only contain data at run time
    when they consult the database
    in case of views the join definitions are already sstored in the database itself
    whereas join as open sql is a query to oracle  database as similar select statements
    Views are optimized by SAP and stored in the repository while Joins
    are in reports that needs to be compiled at every execution
    Reward if helps
    Regards,
    Senthil
    Message was edited by: senthil kumar

  • Transfer whole schema between databases

    Hi,
    I have a question on how to move an entire schema between two databases which are of the same version and patchset.
    I identified the possible methods as follows:
    1) Using exp/imp or expdp/impdp, but that's quite slow on larger schemas and the transported data might not be physically the same as on the source database (indexes are rebuilt, tables get loaded with data again....).
    2) Using transportable tablespaces. This is fast, the physical data layout is the same as on the source database, but unfortunately only the objects in the transported tablespace get transferred. Schema objects like PL/SQL packages, private synonyms, functions.... and grants aren't transferred since they are stored in the SYSTEM tablespace.
    Is there any other way to move a schema between databases? Maybe some combination of expdp/impdp (transfer of user object definitions stored in the SYSTEM tablespace like PL/SQL code, view definitions, etc.) and transportable tablespaces (transfer data segments like tables, indexes....)
    From what I know RMAN can't do that since the smallest "logical object" it can restore/recover is the whole tablespace with tablespace point in time recovery.
    Thanks in advance for any answer.
    Regards,
    Jure

    user633661 wrote:
    Hi,
    I have a question on how to move an entire schema between two databases which are of the same version and patchset.
    I identified the possible methods as follows:
    1) Using exp/imp or expdp/impdp, but that's quite slow on larger schemas and the transported data might not be physically the same as on the source database (indexes are rebuilt, tables get loaded with data again....).
    2) Using transportable tablespaces. This is fast, the physical data layout is the same as on the source database, but unfortunately only the objects in the transported tablespace get transferred. Schema objects like PL/SQL packages, private synonyms, functions.... and grants aren't transferred since they are stored in the SYSTEM tablespace.
    Is there any other way to move a schema between databases? Maybe some combination of expdp/impdp (transfer of user object definitions stored in the SYSTEM tablespace like PL/SQL code, view definitions, etc.) and transportable tablespaces (transfer data segments like tables, indexes....)
    From what I know RMAN can't do that since the smallest "logical object" it can restore/recover is the whole tablespace with tablespace point in time recovery.
    Thanks in advance for any answer.
    Regards,
    JureIf you have only one business schema, then you may go with duplication of database.
    Otherwise, you can go with Schema Based Replication with Streams or as you said combination of expdp/impdp and transport.

  • Parent-Child Join on tables in Database Adapter

    Hi,
    We are doing a join on two tables(T1 and T2) in Database adapter for an Insert operation. There is no Reference Integrity between these two tables in Database, but join is done through bpel database adapter.
    Here is a scenario - when we try to insert a record(parent-child), into these two tables, If there is any data issue in any of the child record, Adapter inserts parent-record, also inserts few child-records it processed before it encountered this data issue and terminates.
    Issue here is , We want this to be transactional, it means, If any of the child record fails adapter should rollback the entire insert operation both from parent and child tables and exit with an error. Instead BPEL inserting half records into child table.
    Is there any parameter I need to set or am I missing anything? Someone please suggest.
    Thanks,
    Phani

    There are a few options I guess.
    1. Add the referential key constraint.
    2. Add custom logic in your BPEL project to compensate for any errors you encounter in your BPEL processes.

  • How can I get the difference of  tables between two oracle server?

    We team have 2 oracle servers in the same version.
    one is develop server and the other is priduct server.
    I want to know what is difference in tables define between the two oracle servers.
    give me a method or a step or a sql script or a tool to compare these two set of tables.
    Edited by: Oracle-Sunmeng on Aug 1, 2012 6:36 PM

    Hi Sunmeng,
    Does Database Link exists between Databases ??
    If I am Clear, Are you looking Something like this.
    To Identify the tables difference, you can query the USER_TAB_COLUMNS view.
    SELECT DISTINCT table_name, 'User1' AS user_table
               FROM user_tab_columns
    UNION ALL
    SELECT DISTINCT table_name, 'User2' AS user_table
               FROM user_tab_columns@dblink
           ORDER BY 1;Which gets us all the Tables available in Both User. where you can filter based on what
    you require.
    Similary, you for column difference
    SELECT   table_name, column_name, 'User1' AS user_table
        FROM user_tab_columns
    UNION ALL
    SELECT   table_name, column_name, 'User2' AS user_table
        FROM user_tab_columns@dblink
    ORDER BY 1;If you need to count the no of columns in both Tables of different databases. Then try this,
    SELECT table_name, 'User1' user_name,
           (SELECT MAX (column_id)
              FROM user_tab_columns a
             WHERE a.table_name = b.table_name) colno
      FROM user_tables b
    UNION ALL
    SELECT table_name, 'User2' user_name,
           (SELECT MAX (column_id)
              FROM user_tab_columns@dblink a
             WHERE a.table_name = b.table_name) colno
      FROM user_tables@dblink b;And, what the Columns in both tables may be same but, if datatype and length of column differs ?????
    Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 1, 2012 10:47 PM
    Edited by: Shankar Viji on Aug 1, 2012 10:49 PM

  • Dimension table in database [H1]

    Hi Expert,
    Can Yours share some info with me about dimension table in database.
    Example for my dimension Entity I have 3 parent in this dimension ,
    then in database I will have table :
    mbrEntity
    dim_Entity
    dim_EntityH1
    dim_EntityH2
    dim_EntityH3
    The more parent I create in my dimension will generate more table.
    I just want to know what is different between this 5 table.
    Because some time I query for MDX I will need something like  [Entity].[H1]
    I just no idea what for need to put this.... [H1]
    and some dimension just dunt need [H1]..
    Thanks..

    actually I want to know how come entity dimension have so many table like :
    mbrEntity
    dim_Entity
    dim_EntityH1
    dim_EntityH2
    dim_EntityH3
    meanwhile my dim category is only 2 table
    mbrCategory
    dim_Categorry
    thanks.

  • Automation of transaferring Excel data to table in Database

    Hi,
           I am new to SSIS. I need to do automation process to transfer data from excel to table in database. I will get the report daily. So how to make the automation process without manually placing the excel table into excel source everyday?
    1. The excel names changes everyday.
    2. Everyday the excel must be load into same table.
    3. while loading the excel I need to get rid of some rows in excel. Is it is possible in automation process?
    4. Will automation process can form a column with current date as a new column while transferring the data? 
    Thanks in advance....
    BALUSUSRIHARSHA

    Hi BALUSUSRIHARSHA,
    After testing the issue in my environment, we can refer to the following steps to achieve your requirement:
    Create two variables, VarFolderPath stores the folder path in which our files exist, VarFileName stores the date value in the file name like below:
    (DT_STR, 4, 1252) DATEPART("yy" , GETDATE())+ "-" + RIGHT("0" + (DT_STR, 2, 1252) DATEPART("mm" , GETDATE()), 2) + "-" + RIGHT("0" + (DT_STR, 2, 1252) DATEPART("dd"
    , GETDATE()), 2)
    In the Data Flow Task, drag an Excel Source with the as Excel Connection Manager.
    Add the property below the Excel Connection Manger expression:
    Property: ExcelFilePath      Expression: @[User::VarFolderPath] + @[User::VarFileName]
    Drag a Conditional Split Transformation that connect to the Excel Source, then add some conditions to filter some rows.
    Drag a Derived Column Transformation that connect to the Conditional Split Transformation, then add a Derived Column Name with <add a new column> option and use GETDATE() as Expression.
    Drag an OLE DB Destination that connect to the Derived Column Transformation, then configure a table to store the data.
    The following screenshot are for your references:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Joining tables across databases in OBIEE Physical Layer

    I was facing this problem of joining tables across databases in Physical layer of OBIEE admin tool.
    I had a requirement to combine two tables from 2 different databases A and B respectively. I had created one database object (OBIEE Object) in the physical layer and I had created two connection pools under that pointing to the required databases. I was able to view the data (right click on the table object --> popup menu option "View Data" ) though I had to go through the "Select connection Pool" window and select the required connection pool. I was able to join the tables and was able to complete the star schema in BMM and bring them up to the presentation layer. Conistency check was also successful. Everything went fine so far.
    But when I started building the report, I started getting error whenever I chose the table which was supposed to be queried by using the second connection pool. The error message was something like "table or view does not exist at OCI call OCIStmtExecute". I assume that this was happening because the systm was not able to understand which connection pool to choose (because there were two pools defined under one database object) and by default the server was choosing the first one. If anybody is having a different opinion or definite information about this, kindly update with your reply.
    I could resolve this problem after creating a separate database object with a separate connection pool defined under it, which points to the second database. Imported the required table under this database object. (Infact it was reverse. When I re-imported the table, OBIEE Admin tool, by default created its own database object and the connection pool separately for the imported table).
    Once this was done then I went ahead as usual by joining the tables across these two different database objects and modelling was already done (ofcourse with a little more tweaking since the mapping had to be redone between BMM and Physical layers). Now I could build the report in the reporting layer without encountering any error.
    Appreciate and welcome any further additions/updations/corrections regarding this issue(?).
    -MMishra.
    Edited by: user13483341 on Nov 29, 2011 8:20 AM
    Edited by: user13483341 on Nov 29, 2011 8:20 AM
    Edited by: user13483341 on Nov 29, 2011 8:24 AM

    Hi Deepak, Thanks for your reply.
    Appreciate if you can help me with another thread "possibility of multi-currency in OBIA 7.9.6.2 financial anlytics".
    - MMishra.

  • Comparing Table between two dbs DBMS_RECTIFIER_DIFF.DIFFERENCES

    We have streams replication between two databases db1 & db2 (table level streams replication).
    We would like to compare tables between these databases.
    we can use DBMS_RECTIFIER_DIFF.DIFFERENCES to find out differences. However what is value to be passed for REFERENCE_SITE & COMPARISON_SITE parameters?
    Is it DBLINK or TNSNAMES entry ?

    Its the DBLINK.

  • Sharing tables between relational models

    Can I share (not copy) table between two relational models in SQL Developer Data Modeler? Something like sharing tables between application systems in Oracle Designer. I have one database schema for reusable kernel of many applications and I want to have one relational model for it. And I need to use tables from kertnel in other applications (database schemas). I need for example to make FK between application and kernel table. How can I do it?

    Hi,
    you can use drag&drop from browser to diagram of target model in order to do that. Table becomes read-only in target model. You can use "Synchronize remote objects" to get actual status of such "remote" table
    Philip

  • Move Data Between Databases

    Dear All,
    I have 2 databases one of them in Egypt and the other in USA.
    I want to transfer data of one schema between the 2 databases.
    I currently use export and import utility to do this action but the size of data is very large so I want an automatic way to do this action.
    what can I use to solve this problem?
    can I use advanced replication or dataguard or what.
    if I use advanced replication data will be transferred through a database link over the internet which will be a very slow operation.
    what can I do,please help.

    Hello Airtifa,
    The main reasons to use a VPN would be
    a) dedicated connection, so more reliable
    b) no or little need to encrypt data, as data doesn't travel across the public Internet
    It should have a positive effect on performance, though you may be suffering from high latency in the network.
    What I'm trying to say is:
    there is not much to tune in a sqlnet connection of whatever type (database links are just ordinary connections), apart from the Session Data Unit, which should be a multiple of the MTU of the network card (so the card doesn't have to fragment packets).
    You are really at the mercy of the (bandwith of the) connection.
    If the connection is slow, the link will be slow.
    If the connection is fast, the link shouldn't pose extra problems.
    Database links aren't slow. Networks can be.
    Also not using the array interface in an efficient way can be a killer.
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for

  • Saving to smb Folder Share

    With major help from Jacques Rioux, I created this script to map a Windows 2008 folder share for our students using our new MacBooks: display dialog "Please enter your school user name" default answer "" set the user_name to the text returned of the

  • Regarding Packaged function...!

    Hi, i have a packaged function which i am trying to use in my report query.... i am passing 2 params for this function..... one is report parameter and the other one is a col in the select query.... so i need to get rows returned based on the condito

  • Chain identifier

    Hello All. Is there any table where I can find an identifier for a process chain run? Ok, let me explain myself. I have a process chain with three datapackage loads. In the first datapackage I store some data in a custom table (Z table). Know the sec

  • Error while copy the plant from 0001 ref available.

    Dear All, when i am copy the plant from 0001 ref plant i am getting the following warning message. can you please tell me how can i avoid this warning & whats the impact. and tell me if any other setting i has to do for plant creation through 0001 pl

  • I get the message: an internal facetime error occurred? close face time and try again?

    i get the above message when i  try to log into facetime? i am using a macpro. does any know how to fix this?