DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Primary Keys Issue on Remote Tables

  1. #1
    Join Date
    Mar 2006
    Posts
    5

    Primary Keys Issue on Remote Tables

    have this query where i can check what are the primary keys on remote table.

    select column_name from all_cons_columns where table_name='EMPLOYEES' and owner='BRENDAN';
    COLUMNS_NAME
    *************************
    EMPLOYEE_ID


    Now Question is

    1. When we do copy tables does that also copy Primary keys because when i run the same query after copying tables it does not show any rows e,g,

    select column_name from all_cons_columns where table_name='EMPLOYEES_COPY' and owner='TEST'

    2. When we do copy does that also copy constraints?

    Any help will be really appreciated.

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    It woulddepend how you "copy". Export/Import will be default, though it has options not to. So how did you do the copy?
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Mar 2006
    Posts
    5
    By doing
    Create Table as select * from
    [where 1 = 2 -- optional]
    Now need to copy constraints but i cannot edit remote tables or i cannot apply Triggers or views on those tables. So any other way around

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    You can create a table, but you can't create triggers or constraints on it, or create views?
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  5. #5
    Join Date
    Mar 2006
    Posts
    5
    Sorry look like u took me wrong...
    I can only view the contents of that schema and can make copies of his schema structure thats all.

  6. #6
    Join Date
    Jun 2005
    Location
    London, UK
    Posts
    159
    Quote Originally Posted by shsh_shah
    Now Question is

    1. When we do copy tables does that also copy Primary keys
    2. When we do copy does that also copy constraints?
    No, and no.

  7. #7
    Join Date
    Mar 2006
    Posts
    5
    hmmm....William you just said no and no...But can you give me idea how to do it..Help from any bosy will be really appreciated

  8. #8
    Join Date
    Jun 2005
    Location
    London, UK
    Posts
    159
    Try

    DBMS_METADATA.GET_DDL@remotedb(objecttype, name);

    e.g.

    DBMS_METADATA.GET_DDL@remotedb('TABLE','EMPLOYEES');

    This is a function that you can use in either a plain SQL query or in PL/SQL. It will return the SQL to create the table, including constraints.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width