Moving/Renaming a table between schemas
Hi
I have a populated table under one user and would like to move/rename it to a different user.
How do I do that
Thanks
use the following command:
create table newtablename as
select * from username.originaltablename .
Hope it will hepl u
Similar Messages
-
Copying tables between schema owners
In Timesten, can you copy tables across schemas/owners?
i.e. OWNER_A.TABLE_Y to OWNER_B.TABLE_Y
Where TABLE_Y has the same definition? Basically, I'd like to be able to backup one datastore and restore it in another datastore that has the same table definitions, but may have a different owner name.
Thanks,
LarryI'm not completely clear on exactly what you are looking to do. On one hand you ask about copying tables between schemas. This is easily done:
CREATE TABLE OWNER_B.TABLE_Y AS SELECT * FROM OWNER_A.TABLE_Y;
This only works for TimesTen tables that are not part of a cache group; specifically the source table can be part of a cache group but the target table cannot. if the target table is part of a cache group then you need to:
1. Create the cache group containing the target (cached) table.
2. INSERT INTO OWNER_B.TABLE_Y SELECT * FROM OWNER_A.TABLE_Y;
But then you mention backup and restore. Since TimesTen backup/retore (ttBackup/ttRestore) works at a physical level you cannot rename/copy tables as part of that. You might be able to use ttMigrate with the -rename oldOwner:newOwner option but there are some constraints around this (one being that PL/SQL cannot be enabled in the database).
Chris -
Renaming Oracle Tables in Production
If you need to rename Oracle tables in Production, then which process is most effective:
A.
LOCK TABLE xxx IN EXCLUSIVE MODE
RENAME xxxTO new_name;
Table renamed.
B. dbms_redefinition
C. other ...
THANK YOU !!All we can say is that dmbs_redefinition is an option to consider. Only the OP knows his environment, what kind of window the work will have to be done in, and the timing issues between the renames and moving in new code. Such as in the case where you need the new object names in place to perform java compiles to move in new classes.
At my current job we would take a window and shut the database down, bring it up in restricted mode, perform the renames of the tables (and associated indexes for standard purposes), move the code into place, and then test. Full testing might require unrestricting the system or we might be able to just grant restricted session to a few users. Once we are satisified we would fire up our daemon processes and then release the batch schedule.
IMHO -- Mark D Powell -- -
Error in renaming the table from SYS user
Hi
I am in Schema by name jc
and I have a table by name tab1
now i logged as sys user
then I give a command
rename jc.tab1 to tab2 ;
getting the following error
rename jc.tab1 to tab2
ERROR at line 1:
ORA-01765: specifying table's owner name is not allowed
Query is
Is it notpossible to rename a table of other schema by logging as sys user ?
is there any other alternate method of doing so??
Thanks and Regards
JCSorry Guido,
I have not stolen anything from anywhere :)
All are mine ...I have created some normal users and some users with DBA privileges....
I use this schemas for testing purpose....
Also if I give command like from SYS user
Alter table jc.tab1 rename to tab2 ;
It will create tab2 in jc schema only and not in SYS schema.
So there is no question of poluting the SYS schema.
Also whatever I ask in this forum is a part of my application related,
I never give the entire program, which may be useless for others and time taking in understanding.
I just simulate whatever I require in as simplae format as I can
The person who is very perfect in this forumn can find such queries rubbish. But in learning process no question is rubbish, but there can be a rubbish answer to every intelligent question too... :)
Regards
JC -
Rename of table column messed up field in Edit Screen
I renamed a table column. I have a report page with an edit form page tied to it based on this table. I changed the SQL statement in the Region Source on the report. The appropriate column value is displayed in the report. I changed the Page Item name on the Edit Form page. I changed the Source Value to match the new field name.
The problem I am running into is when I run the Edit Form page and change the value in the item of the renamed column, the field in the database table is blanked out. Even if I change the value to be the same value, the column is blanked out.
What did I miss in renaming the table column?I've had a similar problem. I added a couple of new columns to a table and attempted to manually add the fields to an existing form. However, as described above, whatever value was entered on the screen, a NULL was stored on the database.
I created a new form using the Form Wizard and copied the columns between pages and got them working. In the process, I tracked the problem down to the variable name.
For example: for the column PRC_SCHEDULABLE, a item named P5_SCHEDULABLE works but any other item name produces the NULL problem. -
Renaming View from another schema
Hi,
I've 2 schemas namely department , hr
Now department schema is having one table EMP . And a view is created on that table with the name R_EMP
Schema Name : department
Table Name : EMP
View Name : R_EMP
GRANT SELECT ON R_EMP TO HR ;
In HR schema a synonym has been created on view R_EMP with the name R_EMP .
CREATE OR REPLACE SYNONYM hr.R_EMP for department.R_EMP
Schema Name : hr
Synonym Name: R_EMP
Now I want to rename the view name R_EMP to V_EMP from HR schema only
So, I tried the folloiwng syntax in HR schema (All the operations should be done from this schema only )
[code]
RENAME department.R_EMP to department.V_EMP ;
Error:
ORA-01765: specifying table's owner name is not allowed
[/code]
How to change the syntax to make the statement work from HR schema .
Thank You .Smile,
The questions is pretty much answered now. You might want to have a look at this as well.
How to rename a table in another user's schema
You can alter the session to set your current schema to the name of the schema where you want to rename the view and then do a direct rename.
Thanks,
Ishan -
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 -
Re: DIfference between Schemas, PCRS' FUnctions and Operations
Dear SAPExperts,
Can anybody pls tell me what is difference between Schemas, PCRS' Functions and Operations.
Thanx in advance
Regards
AniruddhaHi Aniruddha
When the payroll driver is executed (for ex: PC00_M40_CALC for INDIA is executed) the schema IN00 (standard schema) is executed and it calls certain functions (functions may use Rules. Rules contain Operation) and also subschemas.
Functions could be of four types
1. Performing some payroll computations (E.g. INEPF function calculates the PF amount of an employee during payroll run)
2. Calling rules (E.g. P0045 function calls a rule INLN to compute the loan details of a personnel number).
3. Getting data from Infotypes (E.g. P0581 will get the data from Infotype-581 for payroll processing).
4. For some decisions. (E.g. IF & ENDIF function is used to execute as per the true and false decisions) etc.
When the PY is executed SAP uses lot of Internal Tables to store data and also provides data to other internal tables.
The read and change access to Internal Tables is enabled using functions that are executed in a personnel calculation schema and using operations that are executed in personnel calculation rules.
The following is just an attempt to provide some info on how Functions are processed during the PY Run. For ex: (functionality of subschema XIN0 and INBD)
1. INITIALIZATION OF PAYROLL: When the Payroll is executed first the subschema XIN0 is called, This subschema comprises the following main steps:
I. Specify program type (payroll or evaluation)
II. Set switch for database updates (YES/NO) all database updates are controlled via this switch (otherwise simulation)
III. Only infotypes from the HR master record which apply to the selected personnel number are read.
IV. All Time Management infotypes are imported.
V. Specify check against control record PA03 (test or live).
2. READ BASIC DATA: Once the Initialization of Payroll is successful, the subschema INBD is called. This subschema reads the Basic data of an employee who is there in the Payroll execution. Basic Data includes, determining Employee Name, Reading Work Center/Basic Pay Data, Setting Financial Year Dates and Allowance Grouping Tables, Reading Previous Employment Tax Details, Reading Housing (HRA/CLA/COA), Reading Exemptions, Reading Income from Other Sources, Reading Section 80 Deductions, Reading Investment Details (Sec 88), Reading Provident Fund Contributions, Reading Other Statutory Deductions, Reading Car and Conveyance, Reading Long Term Reimbursements, Read ID Details. Function GON checks whether all the master data has been imported, no further processing of schema will occur unless certain data is present.
The Subschema INBD calls the following functions in order to read the Basic Data:
ENAME :
Function ENAME reads the last valid name of the employee in the payroll period. The formatting used for the country in question is used when displaying this name.
WPBP
If an employee receives a pay increase within a payroll period, the Basic Pay infotype (0008) is changed and delimited as of a specific date. Two data records exist for one payroll period.
During payroll, the system writes the Basic Pay wage type to the results table with two different indicators. These split indicators are a link to the WPBP table that contains the relevant values. The system takes into consideration both data records for the corresponding partial periods when calculating remuneration.
ININI
P0580
P0581
P0582
P0584
P0585
P0586
P0587
P0588
P0583
P0590
P185I
GON :
Function GON checks whether all the master data has been imported. No further processing of the schema will occur unless certain data is present. Checking procedures vary from country to country. There must always, however, be a work center (P007).
[Def. of Functions, Rules and Operations (copied from Raju's answer)
Schema is a collection of functions
A Rule is a collection of operations.
An operation is a very basic piece of logic that is used, mostly, to manipulate wage types
Best Regards
Reddy -
Moving Composite Partition table
Hi,
i am using 11.2.0.3.0 version of oracle. I am planning to move a composite partition(range-hash) table into a different tablespace. And i was under assumption by moving the table/index subpartition , it will move the wholw table. Below is the scenario.
Now i have moved all the table/Index subpartition into the new tablespace, using below command.
Alter table t1 move subpartition t1_sub1 tablespace new_tablespace;
Alter index id1 rebuild subpartition id1_sub1 tablespace new_ind1_tablespace;
but when i query dba_tab_subpartition i can see the new tablespace against the subpartition name but when i query the data dictionary dba_tab_partitions i am seeing the name of old tablespace against the partition name. And i execute below statement for moving the partition
Alter table t1 move partition t1_p1 tablespace new_tablespace;
It gives error saying : ORA-14257: cannot move partition other than a range,list,system or hash partition.933257 wrote:
Hi,
i am using 11.2.0.3.0 version of oracle. I am planning to move a composite partition(range-hash) table into a different tablespace. And i was under assumption by moving the table/index subpartition , it will move the wholw table. Below is the scenario.
Now i have moved all the table/Index subpartition into the new tablespace, using below command.
Alter table t1 move subpartition t1_sub1 tablespace new_tablespace;
Alter index id1 rebuild subpartition id1_sub1 tablespace new_ind1_tablespace;
but when i query dba_tab_subpartition i can see the new tablespace against the subpartition name but when i query the data dictionary dba_tab_partitions i am seeing the name of old tablespace against the partition name. And i execute below statement for moving the partition
Alter table t1 move partition t1_p1 tablespace new_tablespace;
It gives error saying : ORA-14257: cannot move partition other than a range,list,system or hash partition.
Notice that PARTITION & SUBPARTITION are separate object; which need to be moved independently
06:46:11 SQL> SELECT OBJECT_TYPE, COUNT(*) FROM DBA_OBJECTS GROUP BY OBJECT_TYPE ORDER BY 1;
OBJECT_TYPE COUNT(*)
CLUSTER 10
CONSUMER GROUP 25
CONTEXT 7
DESTINATION 2
DIMENSION 5
DIRECTORY 9
EDITION 2
EVALUATION CONTEXT 14
FUNCTION 309
INDEX 4502
INDEX PARTITION 406
OBJECT_TYPE COUNT(*)
INDEXTYPE 9
JAVA CLASS 22945
JAVA DATA 303
JAVA RESOURCE 840
JAVA SOURCE 6
JOB 18
JOB CLASS 14
LIBRARY 185
LOB 1367
LOB PARTITION 1
MATERIALIZED VIEW 3
OBJECT_TYPE COUNT(*)
OPERATOR 55
PACKAGE 1445
PACKAGE BODY 1385
PROCEDURE 176
PROGRAM 19
QUEUE 45
RESOURCE PLAN 10
RULE 1
RULE SET 23
SCHEDULE 3
SCHEDULER GROUP 4
OBJECT_TYPE COUNT(*)
SEQUENCE 264
SYNONYM 28070
TABLE 3144
TABLE PARTITION 246
TABLE SUBPARTITION 32
TRIGGER 731
TYPE 2891
TYPE BODY 237
UNDEFINED 11
VIEW 5261
WINDOW 9
OBJECT_TYPE COUNT(*)
XML SCHEMA 58
45 rows selected.
06:46:49 SQL> -
Rename Collection Tables????????
Hi all,
I have tried to using xdb_utilities.renameCollectionTable to rename the tables created through a registration schema where maintainOrder is true in some collection elements.
Is it possible???? I wanted to rebuild the index from this tables???.
I maked correctly with maintainOrder = false, but I think, in this moment the tables were NESTED TABLES and now not.
Any idea????
Thanks in advance,
David.Hi mgralike,
apologize for me short answer.
The ORSWE is the user utilized to create all infrastructure and to register the schemas aldo. At this moment he have been granted with all permisions, all roles (DBA, XDBADMIN, XDBWEBSERVICES and so on) and all systems privelegess to avoid problems with others Oracle functionalities.
I have just registered other schemas with the same form and I could change the tables with yours package XDB_Utilities form the Oracle XML Basic Demo.
In the new schema 'PlantillaProyecto, XSD' I only have changed two attributes in order to achieve a xml ordered. maintnainDOM and maintnainOrder, and in some cases only maintnainOrder has been declared. Now, I can not see tables in ALL_NESTED_TABLES.
The first schema has not declared any previous attributes and I could change the tables names but the xml downloaded from the repository it is not ordered.
I think, it is a problem with my use of attributes.
I executed the following code describe PLANTILLAPROYECTO with the result:
Nombre ┐Nulo? Tipo
TABLE of SYS.XMLTYPE(XMLSchema "http://www.orswegimoarmada.es/ORSWE/XSD/Plantill
aProyecto/PlantillaProyecto.xsd" Element "PlantillaProyecto") STORAGE Object-rel
ational TYPE "PlantillaProyecto955_T"
Thanks,
David. -
Difference between schema and DTD
Difference between schema and DTD
<author>
<firstname></firstname>
<lastname></lastname>
</author>
How will u write dtd and schema for above XML ?DTD:
<!ELEMENT author(firstname, lastname)>
<!ELEMENT firstname(#PCDATA)>
<!ELEMENT lastname(#PCDATA)>
Schema:
<xs:element name="author">
<xs:complexType>
<xs:sequence>
<xs:element name="firstname" type="xs:string"/>
<xs:element name="lastname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element> -
Problem while renaming a table
Hi,
I am running oracle 10.2.0.4.0 on AIX 5.3.
While i issue a table rename statement it just hangs.
the table contains 1500 million rows.
Please suggest what should i check before running a table rename statement.select * from dba_dml_locks is giving following output
SESSION_ID OWNER NAME MODE_HELD MODE_REQUESTED LAST_CONVERT BLOCKING_OTHERS
532 TBAADM CUM_TRAN_DETAIL_TABLE Exclusive None 26888 Not Blocking
533 SYS WRH$_SQL_BIND_METADATA Row-X (SX) None 21701 Not Blocking
533 SYS WRH$_SQL_PLAN Row-X (SX) None 21701 Not Blocking
i am renaming cum_tran_detail_table to hist_tran_detail_table
select * from dba_ddl_locks where owner = 'TBAADM'
SESSION_ID OWNER NAME TYPE MODE_HELD MODE_REQUESTED
534 TBAADM CUM_TRAN_DETAIL_TABLE Table/Procedure/Type None Exclusive
528 TBAADM CUM_TRAN_DETAIL_TABLE Table/Procedure/Type None Share
527 TBAADM CUM_TRAN_DETAIL_TABLE Table/Procedure/Type None Exclusive
532 TBAADM TBAADM 18 Null None
534 TBAADM TBAADM 18 Null None
527 TBAADM TBAADM 18 Null None
525 TBAADM TBAADM 18 Null None
532 TBAADM NABIL_CTD_SHORTFALL_TRIG Trigger Exclusive None
532 TBAADM HIST_TRAN_DTL_TABLE Table/Procedure/Type Exclusive None
should i disable/drop any trigger before trying to rename the table? and then again enable/recreate the same after renaming? -
What are the restrictions &pitfalls of renaming a table vs select * into...
Hello all,
I've got a situation coming up possibly, that I'm looking at where I may need to rename a table that has about 3 TB of data in it.
I'd looked at doing the oracle RENAME command, and it mentions that some restrictions that would error out would be:
views, synonyms, and stored procedures and functions that reference the table.
I'd been looking around on different sites researching more, and found some saying that tables with foreign keys, check constraints would also error out on this....but in the Oracle docs I see it saying:
"Oracle Database automatically transfers integrity constraints, indexes, and grants on the old object to the new object."
Were the other non-Oracle site references maybe to older versions? I'm using 11Gr2.
The other part of this is that the app designers really want to recreate the original table. Essentially this is doing
TABLENAME1 -> TABLENAME1_OLD
Then recreating TABLENAME1 anew empty for new use.
My original thoughts were to do select * from TABLENAME1 into TABLENAME1_OLD, and then truncate TABLENAME1....but with the size of the data (and this will eventually be done in PROD), I"m trying to say that doing the RENAME and recreating the empty table would be less resource intensive.
Would the rename and recreate table be the way to go?
If so, then I need to make sure I know all the restrictions and pitfalls on rename would have....
Thanks in advance!!
cayennerp0428 wrote:
>
I've got a situation coming up possibly, that I'm looking at where I may need to rename a table that has about 3 TB of data in it.
I'd looked at doing the oracle RENAME command, and it mentions that some restrictions that would error out would be:
views, synonyms, and stored procedures and functions that reference the table.
I'd been looking around on different sites researching more, and found some saying that tables with foreign keys, check constraints would also error out on this....but in the Oracle docs I see it saying:
"Oracle Database automatically transfers integrity constraints, indexes, and grants on the old object to the new object."
Were the other non-Oracle site references maybe to older versions? I'm using 11Gr2.
The other part of this is that the app designers really want to recreate the original table. Essentially this is doing
TABLENAME1 -> TABLENAME1_OLD
Then recreating TABLENAME1 anew empty for new use.
My original thoughts were to do select * from TABLENAME1 into TABLENAME1_OLD, and then truncate TABLENAME1....but with the size of the data (and this will eventually be done in PROD), I"m trying to say that doing the RENAME and recreating the empty table would be less resource intensive.
Would the rename and recreate table be the way to go?
{quote}
You are missing a key piece of the requirements
What is the intended use of the OLD and the NEW tables?
Why do you need a new table with exactly the same name unless you intend to use it exactly the same way you were using the old table? And if that is the case it seems to me that other tables with foreign keys need to be truncated also and point to the new table and not the old one.Unfortunately, I don't know. This is just a request the devs have, and I'm not sure of their reasoning, but this is what they're asking for, so, I'm trying to research the best way to do what they request.
Thanks,
C -
How to pass internal table between views
Hello Experts,
How to pass an internal table between views? I have followed some steps but its showing an error.
i have created a table type of ZTTYPE_VBAP and line type VBAP.
I have declared in component controllers attribute LT_VBAP of associated type ZTTYPE_VBAP .
But when i am using this in my method in component controller its not taking.Venkata123# wrote:
Hello Experts,
>
> How to pass an internal table between views? I have followed some steps but its showing an error.
>
> i have created a table type of ZTTYPE_VBAP and line type VBAP.
> I have declared in component controllers attribute LT_VBAP of associated type ZTTYPE_VBAP .
> But when i am using this in my method in component controller its not taking.
you will have to declare a node with the attributes in the context tab of component controller. by doing this you will make this node a global one in your entire application . now copy the value you have in the internal table of yours in this node.
after doing so you can read this node anywhere in the program and you can retrieve the values.
regards,
sahai.s -
When I try to open any docx file from the SharePoint it opens on web via office web apps, and when I choose edit document > edit in Word , Microsoft word show me this error "Sorry, we couldn't find your file.
Is it possible it was moved, renamed or deleted?" followed by half a url to the end users document on onedrive.
I noted that this problem only happens with Docx files, with specific users and only when you try to open the Docx file from OneDrive folder ( SkyDrive ) which is hosted in the MySite.
Any Help?Hi,
According to your post, my understanding is that you failed to open the Docx file from OneDrive folder ( SkyDrive ).
Since this problem only happens with Docx files, with specific users, I recommend to delete and recreate the personal site for the specific users.
More information:
Configure My Sites in SharePoint Server 2013
Best Regards,
Linda Li
Linda Li
TechNet Community Support
Maybe you are looking for
-
How to turnoff firewall on solaris 10?
hey everybody, do you know how to turn off the firewall on solaris 10 ?, because i installed 3 rd party program, and need to disable the firewall... thank you so much, for your help
-
Hi I recently moved from iTunes Library from from NAS to my local HD. In doing so iTunes didn't pick up some of my purchased music in the Music directory, leaving them orhpaned on the file system. The iCloud version appears in iTunes, but if I re-add
-
$RSObject = Get-WmiObject -namespace root\Microsoft\SqlServer\ReportServer\RS_MSSQLSERVER\v11\Admin -Class MSReportServer_ConfigurationSetting -computername xxxx When I execute the above statement I get below error. what might be the problem... than
-
Hi experts, any can help me in this topic Drill-down into AWR reports.
-
Avctl start_agent: Http Communication error: 404
Hi Experts, I am encountering this error when starting the agent in the AV server: avctl start_agent -agentname avagent1 **Error executing task start_agent: Http Communication error: Http Communication error: 404** I made sure that oc4j is running in