Rename the table with sys 11 g

Hi all

Prior to Oracle 11 g and Oracle 10 g (I think) we can rename a table like this:

(with the user sys):

alter table SCOTT. Rename ancien_nom NewName;

I mean the user SYS might rename a table from another schema (for example, SCOTT)

Now, (oracle 11g) when I try to rename a table with the user SYS to another schema, it shows me:

SQL> conn sys as sysdba
Enter password:
Connected.
SQL> rename table plantest.PEMVX_AFEPRE_ESP to PEMVX_AFEPRE_ESP_old;
rename table plantest.PEMVX_AFEPRE_ESP to PEMVX_AFEPRE_ESP_old
       *
ERROR at line 1:
ORA-00903: invalid table name




SQL> alter table plantest.PEMVX_AFEPRE_ESP to PEMVX_AFEPRE_ESP_old;
alter table plantest.PEMVX_AFEPRE_ESP to PEMVX_AFEPRE_ESP_old
                                      *
ERROR at line 1:
ORA-01735: invalid ALTER TABLE option




SQL>

I read the documentation and the only way (as much, I know) rename table is that the user PLANTEST be connected to the database and rename the table. I mean, only the table owner can rename?

Please, how can I rename ANY table of my database with the user SYS or SYSTEM?

Thank you

chijar,

Please user query,

Use the ALTER TABLE RENAME command:

 SQL> ALTER TABLE . RENAME TO ; 

This is the keyword to rename mising is why you receive error below.

  1. SQL > alter table plantest. PEMVX_AFEPRE_ESP to PEMVX_AFEPRE_ESP_old;
  2. ALTER table plantest. PEMVX_AFEPRE_ESP to PEMVX_AFEPRE_ESP_old
  3. *
  4. ERROR on line 1:
  5. ORA-01735: invalid option of ALTER TABLE
  6. SQL >

Naming conventions:
-------------------

1 names must be between 1 and 30 characters long.
2. the names must begin with a letter.
3. it must contain only A - Z, a - z, 0-9, _, $, and the #. You are strongly
not recommended to use $ and #.
4. the names are not case sensitive, unless they are created by double-quotes.

Tags: Database

Similar Questions

  • How to rename the table or synonym?

    Hi all

    11.2.0.1

    I want to rename the table or synonym owned by HR as a SYS user.

    SQL > rename hr.emp in hr.emp_old;

    *

    ERROR on line 1:

    ORA-01765: specifying the name of the owner of the table is not allowed

    Thank you very much

    zxy

    Hello

    You can do something like that as a user of the SYSTEM:

    1 alter session set current_schema = "HR".

    2. Rename emp emp_old

    Thank you &

    Best regards

  • RENAMECOLLECTIONTABLE - questions by renaming the table from the collection.

    Hi all

    I use the version of database Oracle 10.2.0.2, OS - Solaris

    I am enrolled in the scheme after successfully.

    <? XML version = "1.0" encoding = "UTF-8"? >
    < xs: schema xmlns: XS = "http://www.w3.org/2001/XMLSchema".
    xmlns:xdb = "http://xmlns.oracle.com/xdb".
    elementFormDefault = "qualified" attributeFormDefault = "unqualified" >

    < xs: element name = "employee" type = "employeeType" xdb:defaultTable = "EMPLOYEEXMLTYPE_TABLE" / >

    < name XS: complexType "employeeType" = >
    < xs: SEQUENCE >
    < xs: element name = "name" type = "xs: String" / >
    < xs: element name = "departments" type = "departmentsType" nillable = "true" minOccurs = "0" / >
    < xs: element name = "name" type = "xs: String" / >
    < / xs: SEQUENCE >
    < name XS: attribute = "id" type = "Integer" use = "required" / >
    < / xs: complexType >

    < name XS: complexType = "departmentsType" >
    < xs: SEQUENCE >
    < xs: element name = "Department" type = "DepartementType" maxOccurs = "unbounded" / >
    < / xs: SEQUENCE >
    < / xs: complexType >

    < name XS: complexType = "DepartementType" >
    < xs: SEQUENCE >
    < xs: element name = "name" type = "xs: String" / >
    < xs: element name = "departmentWings" type = "departmentWingsType" / >
    < / xs: SEQUENCE >
    < / xs: complexType >

    < name XS: complexType = "departmentWingsType" >
    < xs: SEQUENCE >
    < xs: element name = "departmentWing" type = "departmentWingType" maxOccurs = "unbounded" / >
    < / xs: SEQUENCE >
    < / xs: complexType >

    < name XS: complexType = "departmentWingType" >
    < xs: SEQUENCE >
    < xs: element name = "name" type = "xs: String" / >
    < xs: element name = "target" type = "xs: String" / >
    < / xs: SEQUENCE >
    < / xs: complexType >

    < / xs: Schema >

    My goal is to create indexes on/employee/departments/department/departmentWings/departmentWing/name.

    I followed the steps mentioned in Create index for an XMLType column.

    One of the measures mentioned in the link above is to rename the table in the collection (in my case departmentwing) using the DBMS_XMLSTORAGE_MANAGE procedure. RENAMECOLLECTIONTABLE.

    So I tried the following:
    SQL > START
    DBMS_XMLSTORAGE_MANAGE 2. () RENAMECOLLECTIONTABLE
    OWNER_NAME 3 = > "XDB_TEST"
    Table_name 4 = > "EMPLOYEEXMLTYPE_TABLE"
    5 COL_NAME = > NULL,
    XPATH 6 = > ' / employee/departments/Department/departmentWings/departmentWing/name. "
    7 COLLECTION_TABLE_NAME = > 'DEPTWING_TABLE '.
    (8);
    9 END;
    10.

    PL/SQL procedure successfully completed.

    If the procedure has said that it has completed successfully, I couldn't see the created DEPTWING_TABLE.

    SQL > DEPTWING_TABLE DESC;
    ERROR:
    ORA-04043: object DEPTWING_TABLE does not exist

    I am left helpless. Can someone please?

    Kind regards
    Simo.

    Published by: user5805018 on October 12, 2011 04:40

    Hello

    First of all, are you sure that the nested tables generated during the registration of the scheme?

    You must annotate the schema with xdb:storeVarrayAsTable = 'true' and use the option genTables-online true for registration.
    Then you should see something like this:

    SQL> select table_name, table_type_name, parent_table_name, parent_table_column
      2  from user_nested_tables
      3  ;
    
    TABLE_NAME                     TABLE_TYPE_NAME                PARENT_TABLE_NAME              PARENT_TABLE_COLUMN
    ------------------------------ ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    SYS_NTy8fd9LOzSmun4whyTbJC4g== department384_COLL             EMPLOYEEXMLTYPE_TABLE          "XMLDATA"."departments"."department"
    SYS_NTeAiIyOu0Q9G3nvWMtcM6mQ== departmentWing381_COLL         SYS_NTy8fd9LOzSmun4whyTbJC4g== "departmentWings"."departmentWing"
     
    

    In addition, according to the manual (xdb_easeofuse_tools.pdf):

    For Oracle Database 11g Release 2 (11.2) and above, this function accepts only, XPath
    the rating as a dotted notation. If the XPath notation is used, a setting of namespaces
    may also be necessary.

    So, on your version, you must use the notation 'dot ':

    SQL> call XDB.DBMS_XMLSTORAGE_MANAGE.renameCollectionTable(
      2    USER
      3  , 'EMPLOYEEXMLTYPE_TABLE'
      4  , NULL
      5  , '"XMLDATA"."departments"."department"'
      6  , 'DEPT_TABLE'
      7  );
    
    Method called
    
    SQL> call XDB.DBMS_XMLSTORAGE_MANAGE.renameCollectionTable(
      2    USER
      3  , 'DEPT_TABLE'
      4  , NULL
      5  , '"departmentWings"."departmentWing"'
      6  , 'DEPTWING_TABLE'
      7  );
    
    Method called
    
    SQL> select table_name, table_type_name, parent_table_name, parent_table_column
      2  from user_nested_tables;
    
    TABLE_NAME                     TABLE_TYPE_NAME                PARENT_TABLE_NAME              PARENT_TABLE_COLUMN
    ------------------------------ ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    DEPT_TABLE                     department384_COLL             EMPLOYEEXMLTYPE_TABLE          "XMLDATA"."departments"."department"
    DEPTWING_TABLE                 departmentWing381_COLL         DEPT_TABLE                     "departmentWings"."departmentWing"
     
    

    Hope that helps.

  • 'For' loop with a different number of iterations. Second, the auto-indexation of the tables with different sizes is done. It can affect the performance of the Vi?

    Hello

    I have a loop 'for' which can take different number of iterations according to the number of measures that the user wants to do.

    Inside this loop, I'm auto-indexation four different 1 d arrays. This means that the size of the tables will be different in the different phases of the execution of the program (the size will equal the number of measures).

    My question is: the auto-indexation of the tables with different sizes will affect the performance of the program? I think it slows down my Vi...

    Thank you very much.

    My first thought is that the compiler to the LabVIEW actually removes the Matlab node because the outputs are not used.  Once you son upward, LabVIEW must then call Matlab and wait for it to run.  I know from experience, the call of Matlab to run the script is SLOW.  I also recommend to do the math in native LabVIEW.

  • implementation of the table with the scroll bar. (data scrolling)

    Hello

    I want to show the web service data in the table with scroll bar using java script or html or css .actuall I want only a part of the screen is not whole screen scrollable. can you suggest how it is possible.any suggestion? I used phone gap technology. I used iscroll but it does not work in blackberry data are not displayed in the Simulator... Help, please

    Thank you

    ravi1989 wrote:

    Hello

    I want to show the web service data in the table with scroll bar using java script or html or css .actuall I want only a part of the screen is not whole screen scrollable. can you suggest how it is possible.any suggestion? I used phone gap technology. I used iscroll but it does not work in blackberry data are not displayed in the Simulator... Help, please

    According to devices/operating systems that you want to support, you could give bbUI.js a change. It works really well in most of the cases, and I think there are a lot of things you don't need to worry more because bbUI.js is just for you.

    Look more at the scrollPanel example that does exactly what it takes, a part only of the entire screen of scrolling you can configure a height in the HTML source code directly.

  • Can fill us transitional attribute in the table with no serial like 1,2,3, etc.? And how?

    Mr President.

    Can fill us transitional attribute in the table with no serial like 1,2,3, etc.? And how?

    Concerning

    You want to show serial No. on the page for all the lines?

    Check once-

    Blog of Ashish Awasthi (Jdev/ADF): Add the serial number to the table of the ADF, column to auto-increment in the table to the ADF

    Actually transitional attribute loses its value when page refreshes or viewObject is not appropriate in this case if your use case is different, so please tell us

    Ashish

  • I currently store my pictures on and an external hard drive.  Lightroom 6 was not able to find the picture momentarily files.  I inserted an external Flash DRIVE after removing the hard drive and the computer renamed the stick with the same drive letter t

    Redesign existing external hard disks and still 6 Lightroom able to find existing photos.

    I currently store my pictures on and an external hard drive.  Lightroom 6 was not able to find the picture momentarily files.  I inserted an external Flash DRIVE after removing the hard drive and the computer renamed the stick with the same drive letter that has been designated by Lightroom to store my photos.  I could go into my Windows 10 and reset the player to the letter that Lightroom has given at the beginning of the external hard drive.   However, I know this can happen again, if I connect any stick USD or another device, while the external hard drive is not connected to my laptop.   I found the information that I can do the new designation of the final drive by choosing a letter it is 1/2 way or higher in the alphabet.   I would like to turn an external hard drive on a strong letter, warns we hope this previous problem.   My question is, if I already have a lot of pictures on this external hardrive with the designation of the current drive, how it becomes a higher letter and have 6 Lightroom recognizes files, now under the new designation of drive letter without having to go to each photo individually and manually force Lightroom 6 find each photo.  It would take more time than I'd like to lose.  Is there a way to get just 6 Lightroom to recognize the new disk designation has changed and is able to find all of the existing files?

    I have read the ADOBE LightRoom 6 manual and seem not to be able to find anything on how to do it.

    Any help would be welcome.

    Thank you!

    So in Windows, you can select a drive like q letter (or any other letter you want only towards the end of the alphabet)

    Then in Lightroom, you can reconnect to the photos on q: the following instructions (see specifically 4 Figure and related text)

    Adobe Lightroom - find moved or missing folders and files

  • I want to change the table with the expression of dangerousness of the virtual columns with her, need advice

    Hi all

    Here is the structure of the table with two expression of virtual columns associated highlighted, now I want to delete these expressions with virtual columns (but must keep my VIRTUAL columns as it is).

    Is it possible the alter or I need to raise the table, make a new structure and copy content back to newly structured table... Pleae help!

    CREATE TABLE TEST_COL)

    SAGE_TRADE_TYPE VARCHAR2 (50 BYTE),

    LOCAL_TZ VARCHAR2 (20 BYTE),

    ACE GMT_CONV_ENTERED_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, ENTERED_DT_TS)) VIRTUAL,.

    ACE GMT_CONV_EXECUTION_DT_TS (SAGEDBO. FN_CONVERT_TIMEZONE (LOCAL_TZ, UPSTREAM_EXECUTION_TS)) VIRTUAL,.

    EOD_IND VARCHAR2 (10 BYTE)

    );

    Thank you very much

    Arpit

    Try this

    ALTER table test_col change gmt_conv_entered_dt_ts (0) virtual;

    ALTER table test_col change gmt_conv_execution_dt_ts (1) virtual;

  • How to export data from the table with the colouring of cells according to value.

    Hi all

    I use jdeveloper 11.1.1.6

    I want to export data from the table with a lot of formatting. as for color cells based on value and so much. How to do this?

    You can find us apache POI-http://poi.apache.org/

    See this http://www.techartifact.com/blogs/2013/08/generate-excel-file-in-oracle-adf-using-apache-poi.html

  • Rename the table

    How to rename the table using export and import utility?


    Thanks 10

    883532 wrote:
    How to rename the table using export and import utility?

    Thanks 10

    What is the version?

    It is not possible to rename the table using import and export, why not use SQL in 9i? its very simple
    SQL > create table emp_new in select * from emp;

    If his 10g.then above

    System $expdp / * tables = scott.emp dumpfile = emp.dmp = directory = data_pump_dir emp.log logfile
    System $impdp / * dumpfile = emp.dmp logfile = emp_imp.log remap_table = rΘpertoire emp:emp_new = data_pump_dir

    HTH.

    883532 profile
    883532
    Newbie
         
    Handle: 883532
    Status level: Beginner
    Registration date: Sep 6, 2011
    Messages total: 28
    Total Questions: 18 (12 pending)

    Keep the forum clean as much as possible by markers as replied.

    Published by: CKPT on February 20, 2012 22:00

  • How the values to insert into the table with the command insertion

    Dear all
    can someone tell me how the values to insert into the table with the command insert, I want to say I always use command insert behind my forms on what shutter release button press the button of my save, but today I had a form of 6i, where controls (textbox, combo, etc.) are delineated with directly the table with I guess than the Properties Windows , I created 3 columns in tand 3 text on forms fields, now kindly tell me how to do this fields to fill and do not insert command, I mean directly defined with table column



    Please help me its urgent

    Hello

    If the block is based on your database table, just committed the shape, then changes will be applied to the database.

    François

  • Creating the table with time stamp

    I need to create the table with the data inside buffer

    Can you help me pls

    If it works today,

    create the table test_04NOV2010 in select * from product where product_code = '101'

    If executed tmrw,

    create the table test_05NOV2010 in select * from product where product_code = '101'
    declare
    
    v_date varchar2(25);
    v_sql  varchar2(20);
    
    begin
    
    select to_char(sysdate,'DDMONYYYY') into v_date from dual;
    
     v_sql := ' create table ' ||TEST||'_'||'v_date'|| 
                 ' as '
                 ' select * from Product where product_code = '101'
              
     EXECUTE IMMEDIATE v_sql;
    
    end;
    can is it you pls let me know how to use it in PL SQL

    Can you help me pls

    Thank you very much
    declare
    
    v_date varchar2(25);
    v_sql  varchar2(2000); --Noted this. this was also small.
    
    begin
    
    select to_char(sysdate,'DDMONYYYY') into v_date from dual;
    
     v_sql := ' create table TEST_'||v_date||
                 ' as select * from Product where product_code = ''101''';
    
     EXECUTE IMMEDIATE v_sql;
    
    end;
    

    You can use the Q operator also.

    DECLARE
    
    v_date varchar2(25);
    v_sql  varchar2(2000);
    
    BEGIN
    
    select to_char(sysdate,'DDMONYYYY') into v_date from dual;
    
     v_sql := ' create table TEST_'||v_date||
                Q'[ as select * from Product where product_code = '101']';
    
     EXECUTE IMMEDIATE v_sql;
    
    END;
    

    Published by: mohamed on November 4, 2010 05:32

  • Identify the tables with data or not

    Hello

    I want to find the tables with data and containing not data without checking each table. Is there a possible way?

    Like this?

    select
      table_name,
        to_number(
          extractvalue(
            xmltype(
     dbms_xmlgen.getxml('select count(*) c from '||table_name))
            ,'/ROWSET/ROW/C')) count
      from user_tables;
    

    Or may be

    select
      table_name,
       CASE WHEN
           to_number(
              extractvalue(
                xmltype(
         dbms_xmlgen.getxml('select count(*) c from '||table_name))
                ,'/ROWSET/ROW/C'))>0 THEN 'Table Has Data'
        ELSE 'Table is Empty'
        END
      from user_tables;
    
  • Fill the table with random values

    Another thing I've come across is this:
    the table name is LOR, who has 3 fields NUMBER, DATA, TEXT with number, date and varchar2 data type.
    On a page, I have a text field where if I write 3, then it would add 3 lines to the table with predefined values ("number, something like 2222, for 12 January 09, and for text, something like" Lorem ipsum dolor sit amet, 195kgs adipisicing elit"). So basically, with the number that I give, it populates the table with lines... How can I do this? Thanks for helping me
    INSERT INTO LOR
    SELECT 222
    , sysdate
    , 'you string'
    FROM dual
    CONNECT BY level <= :Pxx_
    
  • Rename the table sys

    Hi all

    11.2.0.1

    How to rename scott.emp in as SYS scott.emp2?

    SQL > connect / as sysdba

    Connected.

    SQL > rename scott.emp in scott.emp2;

    *

    ERROR on line 1:

    ORA-01765: specifying the name of the owner of the table is not allowed

    Thank you all,

    pK

    Hello

    You can try-

    ALTER table scott.emp rename emp2;

    Anand

Maybe you are looking for