How to create table in another schema of same database

Hi..
I've a database DB1
and has 2 schemas / USers in that..
Usr1 and Usr2...
And i created a TEMP table in Usr1 schema... and created
Then tried the following statement in Usr2 schema...
CREATE TABLE TEMP AS SELECT * FROM Usr1.TEMP;
Then it's giving error that ...
:00942 TABLE OR VIEW DOESN'T EXIST..
What is the reason for that...
Thank you

josh1612 wrote:
What other grants do i need to give so as to replicate the Primary Keys also...????That's not a matter of grants. It's the way the CREATE TABLE AS SELECT statement works. It does not copy over indexes, primary key constraints, unique constraints, foreign key constraints, etc.
If you want to copy all that over, you would probably want to get the DDL from the original table (using the DBMS_METADATA package if you're in a recent version), modify the DDL with the new schema name, create the table, indexes, and constraints, and then do an INSERT ... SELECT to populate the data. Or do an export & import of the table from one schema to another.
Justin

Similar Messages

  • How to view tables in another schema in the database

    I am starting to use the SQl Developer 1.5.
    We can connect to an oracle database successfully, expanding the tables, it shows the list of tables of one schema.
    We have other schema in the database. In the query panel, when we type in the name of the other schema such as tcs. then some table names will popup in the intellisense.
    How can we show the list tables in other schema within the same database.

    In SQL Developer left panel, there's a browse tree. There's a 'Other Users' branch under each database, expand that you will see all the option to check user's objects. Your user need to have check dictionary privilege

  • How to create table from another in pl/sql

    Hi I need to create a table from another in pl/sql
    How can I do this

    The proper way to do this, is not to do it in PL/SQL. But do it in SQL, something like:
    create table tbl
    as
    select *
      from other_tbl;Doing it in PL/SQL is really slow compared to SQL.
    Yes, if you really want to create a table using PL/SQL then you will need to use DBMS_SQL or EXECUTE IMMEDIATE (Native Dynamic SQL) to do this.

  • How to create table for XML schema-based Interface form

    Hi All,
    With tcode SFP to crate  a XML schema-based Interface form, how to create a defined table can be listed in "Data View"?
    Just like APAP Dictonary- Based Interface form, that we can drag  a defined table from data view to the panel.

    Hi,
    Just follow these steps:
    1. Create interactive form UI element in your view.
    2. Now provide Datasource and PDFSOURCE to it in form properties.
    3. Now give a template name prefix with 'Z' or 'Y'.
    4. Double click on it. It will prompt for interface name.
    5. Provide interface name prefixed with 'Z' or 'Y'.
    6. Click on Context button in the Pop up window and provide the node you have selected as DATASOURCE.
    7. Click ok and it will open the form designer.
    8. In this way you can create a XML Schema based Form.
    9. Activate the interface and design the form providing layout type and other details.
    Hope it will help.
    Regards,
    Vaibhav

  • How to create table(s)/indexes on a new database from an existing database

    Hello all - I need some help in finishing a task, quick response is really appreciated
    So, I have a new database that needs creation of tables including indexes and objects for two different tablespaces called CDS1 and CSD2. I have created these tablespaces and datafiles associated with them. I need some help just to create these tables and indexes from an existing database without copying any of its contents. How can I achieve this, these are 2 different servers at different locations. Can somebody give me step by step instruction - would greatly appreciate it !
    Thanks,
    Vikas

    9876543210 wrote:
    Hello all - I need some help in finishing a task, quick response is really appreciated
    So, I have a new database that needs creation of tables including indexes and objects for two different tablespaces called CDS1 and CSD2. I have created these tablespaces and datafiles associated with them. I need some help just to create these tables and indexes from an existing database without copying any of its contents. How can I achieve this, these are 2 different servers at different locations. Can somebody give me step by step instruction - would greatly appreciate it !
    Thanks,
    Vikas
    exp help=yes
    exp username/password rows=no
    How do I ask a question on the forums?
    https://forums.oracle.com/message/9362002#9362002

  • Data Loading from one table to another in the Same Database based on conditions .

    Hi ALL ,
    I have 2 tables Products and Product_info .
    Product_info table Product_id is Primary key but not an identity column so auto increment of number needs to be performed from the Package only .
    Requirement is :
    IF the Product_ID is = 20 and Date lies in the previous month not the current month in the Products table then 
    insert into the Product_info table based on below mentioned information .
    1.If the Name  has tap then ignore it completely don't perform any insert for it.
    2.If the Name has Zork in it then perform 2 inserts in the Product_info table having Product_info_id's 1 and 2 .
    3.If the Name doesn't contains Zork or tap insert it in the Product_info table having Product_info_id 4.
    Very new to SSIS package development it will be helpful if you can provide detailed information .
    Source Table (Products table )
    ID
    NAME
    Product_ID
    Date 
    Area_ID
    1
    P_tap_rus
    20
    13-01-2014
    3
    2
    Enc_sap_top
    10
    15-01-2014
    4
    3
    Yorl
    20
    05-02-2014
    5
    4
    zork
    20
    20-01-2014
    6
    5
    fadbt
    10
    22-01-2014
    6
    6
    xyzzz_oprt
    20
    28-01-2014
    5
    7
    def_type_ru
    20
    06-02-2014
    2
    8
    acd_inc_tup
    10
    07-02-2014
    3
    9
    bnf_dlk_fbg
    20
    03-02-2014
    4
    10
    rtyui_vnmghj_sfdl
    10
    12-01-2014
    5
    11
    wlwf_10103_123
    10
    04-02-2014
    9
    Destination table  (Product_info)
    Porduct_ID
    ID
    Area_ID 
    Product_info_ID
    Column1
    1
    3
    5
    4
    As NameString doesn’t contain Zork or Tap 
    2
    4
    3
    1
    As Id is 4 so 2 inserts one for 1 and other for 2 in the Product_info_id column
    3
    4
    3
    2
    4
    6
    5
    4
    5
    10
    5
    4
    6
    11
    9
    4
    Please let me know if any other information is required .
    Thanks
    Priya

    Hi Priya,
    You mentioned this was coming from two tables right? I believe I would try to perform the transformations with T-SQL in my source (If this is a possibility for you). Below is an example of something you could do.
    WITH CTE
    AS
    SELECT ID, Product_ID, [Date], Area_ID,
    CASE
    WHEN Name like '%Zork%' THEN 1
    ELSE 4
    END AS Product_Info_ID
    FROM [YourTable]
    WHERE Product_ID = 20 and MONTH([DATE]) = MONTH(DATEADD(MM, -1, GETDATE())) AND NAME NOT LIKE '%tap%'
    SELECT *
    FROM CTE
    UNION
    SELECT ID, Product_ID, [Date], Area_ID, '2' AS Product_Info_ID
    FROM CTE WHERE Product_Info_ID = 1
    I hope this helps, Regards.

  • How to create tables and views and procedures in other users as one

    HI to all,
    I am having a user named vijay and i am trying to create the tables in user srini as user vijay
    in user vijay i'm having tables
    1. company
    2. department
    i wrote one procedure
    create or replace procedure sp_createobjects{short_name in varchar2}
    {my openbracket key is not working so that i put open braces here}
    as
    cursor table_name is select object_name from dba_tables where object_type = 'TABLE';
    var_table_name varchar2{1000};
    begin
    open table_name;
    loop
    fetch table_name into var_table_name;
    execute immediate 'create table ' || short_name || '.' || var_table_name || ' as select * from '||var_table_name;
    end loop;
    end;
    the procedure is created sucessfully. but when i am trying to execute the procedure it is throwing the error as insufficient privileges.
    my 2nd question is how to create the procedures into the other user?
    Thanks in advance

    First of all, your query "from dba_tables where object_type = 'TABLE'" returns all tables, not just the tables of the user vijay.
    So there are two possibilities, you may be getting the error because you cannot select from another user's table or you may be getting the error because you cannot create a table under the user srini. To create tables in another schema you need the "create any table" privilege.

  • How to create table from one to another schema?

    Hi,
    There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
    thanks in advance
    Thanks,

    user2017273 wrote:
    Hi,
    There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
    thanks in advance
    Thanks,When you give CREATE ANY TABLE TO A then user A will create table on any schema.But you can create stored PROCEDURE on schema B for creating table and give GRANT EXECUTE <PROC NAME> to A.

  • How to share data in "User_*" tables with another schema

    I would like to share the data in the USER_SEGMENTS table with another schema. If I create a view and grant select on the view, when the other schema queries the view the data is identical to themselves querying the SYS.user_segments table directly.
    create view sys_user_segments as select * from sys.user_segments;
    grant select on sys_user_segments to A;My guess is that the SYS.user_segments table is a view based on the current user.
    Is there a way to share this data without creating a copy of the table?
    Oracle: 10g
    Thanks

    Hi,
    All the data dictionary "tables" whose names start with user_ (or all_ or dba_) are actually views, and what results they bring back depend on what schema you logged in to. I don't think there's any way to allow user A to directly see what's in user B's version of user_segments.
    Why do you need this? Can you use the all_ views instead, by giving A some privileges on B's objects?
    Failing that, you can replicate the data into a regular table. Inside a AUTHID DEFINER stored procedure, the data dictionary views (such as user_segments) are the versions of the procedure owner, so B can write a stored procedure (let's call it populate_my_segments) that populates a regular table (let's call it my_segements), and then grant EXECUTE privilges on populat_my_segments and SELECT privileges on my_segements to user A. A can then refresh the table and look at it whenever he wants to.
    If A only needs to see a little information, e.g. the total number of bytes, from B's user_segments, then B can write a function just to return that information.

  • Create table by another table query wid contraints

    how can we create table by another table but wid all the constraints of that table means
    create table emp_test as select * from emp
    it will create the replica of emp table but not constraints so how can i creat table along wid constraints

    Mushy wrote:
    i cant do this i have more than 200 tables to create wid the create table statement so any simple method to create table including constrains of that table otherwise i have to make a lot of changes in this codee etcc etcc
    thanks a lot for ur replyYou can automate it. Something to start with:
    SET SERVEROUTPUT ON FORMAT WORD_WRAPPED
    DECLARE
        v_new_def CLOB;
    BEGIN
        FOR v_rec IN (select table_name,dbms_metadata.get_ddl('TABLE',table_name) def from user_tables where table_name in ('EMP','DEPT')) LOOP
          v_new_def := v_rec.def;
          FOR v_list IN (select table_name from user_tables where table_name in ('EMP','DEPT')) LOOP
            v_new_def := replace(
                                 v_new_def,
                                 '"' || USER || '"."' || v_list.table_name || '"',
                                 '"' || USER || '"."' || v_list.table_name || '_TEST"'
          END LOOP;
          v_new_def := replace(
                               v_new_def,
                               '"PK_' || v_rec.table_name || '"',
                               '"PK_' || v_rec.table_name || '_TEST"'
          dbms_output.put_line(v_new_def);
        END LOOP;
    END;
      CREATE TABLE "SCOTT"."DEPT_TEST"
       (    "DEPTNO" NUMBER(2,0),
            "DNAME" VARCHAR2(14),
            "LOC" VARCHAR2(13),
             CONSTRAINT
    "PK_DEPT_TEST" PRIMARY KEY ("DEPTNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536
    NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE
    "USERS"  ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576
    MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
      CREATE TABLE "SCOTT"."EMP_TEST"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP_TEST" PRIMARY KEY
    ("EMPNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
    MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT
    "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT_TEST" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1
    MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    PL/SQL procedure successfully completed.
    SQL>  SY.

  • Connect role allows user to update/delete row of a table of another schema

    I am using oracle 9i r2, I created a user and only give him CONNECT role. Then I opened the sqlplus and found that he could query table of another schema which doesn't belong to the new user, but the thing which scares me most is that when I tried to update/delete a row from a table of another schema, it succeeded. Also, I created a new role with system priviledges CREATE_SESSION and SELECT_ANY_TABLE then granted to new user and revoked the CONNECT role but the same thing happened like before. What I am doing wrong? By the way, I am trying to create a read only user. Any help is greatly appreciated.

    Thanks guys for the tips. I have forgotten to mention that this situation happened only in a new created schema which has only a table and the table was exported from another oracle db( I pre-created the user with connect role and assign the tablespace etc), the import worked fine. Then I used a read only user(in different schema) to update/delete row to the imported table.The read only user can't update/delete other schemas besides from the new one. Is that I missed something when importing the table or pre-create user, tablespace, etc? Thanks in advance.

  • ....how to create table maintanence generator for a z table and how to use

    Hi...
    3....how to create table maintanence generator for a z table and how to use that for transfering a selected records to one server to another server.
    thanks and regards,
    k.swaminath reddy

    Hi,
    Table maintanance Generator is used to manually
    input values using transaction sm30.The Table Maintenance Generator is used to create table maintenance program to add, modify or delete records in the database table. This can be accessed using transaction SE54 or in SE11 using the menu Utilities->Table Maintenance Generator
    <b>
    Follow below steps</b>
    go to se11 check table maintanance check box under
    attributes tab
    utilities-table maintanance Generator->
    create function group and assign it under
    function group input box.
    also assign authorization group default &NC& .
    select standard recording routine radio in table
    table mainitainence generator to move table
    contents to quality and production by assigning
    it to request.
    select maintaience type as single step.
    maintainence screen as system generated numbers
    this dialog box appears when you click on create
    button
    save and activate table
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    One step, two step in Table Maintenance Generator
    Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
    Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
    please check the link for getting information about table maintenance generator !
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=use%20of%20table%20maintenance%20generator&cat=sdn_all
    http://www.sapdevelopment.co.uk/tips/tips_tabmaint_tcode.htm
    http://www.sap-img.com/abap/create-a-table-maintance-program-for-a-z-table.htm
    Regards,
    Priyanka.

  • How to create table in java

    i need help on this topic
    how to create table in java

    lucky786 wrote:
    help urgentlyI am too late?

  • How to create table in bisystem

    hi,
    how to create table in bi system.
    My requirement is such like that i want to store data which is used in the routine.
    i want to maintain the data dynamically so that i want to create the table.

    Hi.........
    Same as ABAP only...........using SE11........
    Steps for creating table:.
    There are two approach in creating a table.
    1. Bottom-up approach
    2. Top-down approach. 
    Both are valid and you can choose which approach is suitable for you.  I always use the bottom-up approach. Here are the steps to create the tables with this approach.
    1. SE11 will take you to the DDIC and enter the name of the new table to be created. Let us say Zname. Click create.
    2. Enter the short discription of the table and enter the field of the table.  If it is primary key and you have to check the box. 
    3. Enter the data element  and double click it, you will be asked to save and will take you to data element discription page.  Enter the short discription of the data element and enter the information of domain like the length of field and type of field.
    4. If you wanted to use the existing domain then its fine, or else, you have to create one.  Enter the domain name in the data element page and double click it.  Page will ask to save and jump to domain creation page.
    5. In the domain page, you have to save the information which you have already given in the data elements page and check it.  Before going to data element page, you have to activate the domain.
    6. Go to data element page and save, check and activate.
    7. Go to main table page and save, check, and activate.  
    8. Also, you have to save the technical settings of the table.
    The table is now ready for operation. You can use it in your program or you can use it to enter information.
    Check table:  It is the table which will have all the information about the Foreign keys which are the primary keys in the check table.
    It can be created by creating the foreign key from the main table.  Click foreign key in the main table and it will take you to a page which will ask for table name and field to which foreign key relation has to be associated. Enter the information and you can create the check table automatically.
    SM30 is used for maintenance of the table, that is to realease the errors occured during the creation of the table.  
    Hope this helps......
    Regards,
    Debjani..........

  • How to create table in interactive form via Java Web Dynpro

    Hi,
    How to create table in interactive form via Java Web Dynpro ?
    Any online tutorial / example ?
    Thank you.
    Regards,
    Eric

    Hi Eric,
    Just choose the UI element Table from Form Library and drag and drop it on the form. now choose the no. of rows and columns and other settings you want about table from the wizard initiated through this process. This all is what you have to do to create the table. Now to bind it to the fields of the data source bind the individual colums to individual attributes of the node in the datasource.
    Hope it will solve your query.
    Regards,
    Vaibhav Tiwari.

Maybe you are looking for

  • Edge Animate 2014.1 upgraded files makes keyframes unable to be deleted

    My Edge Animate files which were upgraded for the new 2014.1 version consistently have a bug where keyframes are not able to be deleted. Existing keyframes can be moved, properties can be readjusted, and new keyframes can be created. But if I try to

  • Applications are constantly quitting on lainch

    All of a sudden, various applictions have started to quit immediately after I've launched them. At first, I thought it was just iPhoto, which quit after asking if I wanted to import pictures, but now I have found various applications vanishing as soo

  • Problems with Premiere Pro 2.0:  sound lost after clip pasting

    To integrate small projects to one bigger Project, it used to work well with Premiere Pro 1.5 in the following way: import small projects into the main sequence of the new project and, in parallel, copy the clips from the timeline of the small projec

  • Question about layering text over an image

    Hi -- I am trying to place a layer of text over a ghosted image that I've imported into ID from Photoshop.  By "ghosted" I mean that the image has a layer of white fill over it that has been set at 50% opacity.  ID won't let text be layered on top of

  • Safari crashes on just abotu every page - with Javascript

    OK, I know this sounds similar to half a dozen or more other posts, but I've read those, and none of the solutions work. If I have javascript enabled, almost any site I visit will cause Safari to crash. I've filed countless crash reports, but never h