Rename a Constraint?
Is it possible to rename a system named constraint?
I am using Oracle 8.1.7
Thanks
Not that I know of.
However if the constraint is not an index-generating constraint, there should be little risk in opening the database in restricted mode, dropping the system named constraint and recreating one with a name of your choosing.
If it is index-generating, than you have to decide if it is worth it.
Sorry, but I don't that that you have an easy and totally painless solution in front of you; this is why so many DBAs are anile about DDL with constraints named up front.
Michael
Similar Messages
-
SQL-tab / refresh button: does not take into account renamed constraint.
I discovered a small bug:
1) find or create a table with system generated constraint names (SYS_C007289)
2) open that table in SQL Developer (I'm using 3.0.04.34). On the constraints tab, there will be the SYS% constraints. On the SQL-tab, the constraints will be shown without a name (simply "not null" for example).
3) Return to the Constraints tab and use Actions / Constraints / Rename single to rename a constraint.
4) return to the SQL tab and press the Refresh button. Unexpectedly, the new constraint name is still not in the SQL!
5) close the entire window/tab for the table
6) re-open that table.
7) go to the SQL-tab: now the name of the constraint is in the code.
As shown above, the workaround is easy, so this is a very minor bug-let.Looks like you add an ActionListener to your button <next> every time yuou call buildGui() and, believe it or not, adding a listener more than once triggers additional events. Thus, it's okay on your first loop but on the second it now has 2 listeners and thus will skip 3 and go to four. After this it now has three listeners and will skip 4 and 5 and go to 6 etc, etc.
// in your buldGui() method
System.out.println("prints next");
frameContainer.add(next);
next.addActionListener(this);
System.out.println("it has already printed next");
exit.addActionListener(this);
frameContainer.add(exit); -
I was wondering if it is possible to rename a constraint once it has been created. Without going through the process of disabling it and then cascade dropping the constraint and then recreating. I have check all my current reference material. Any help would be appericated. Thanks
There is no direct statemtn as we have to rename to table.
Infact, I ask u to try this...
DECLARE
c_owner CONSTANT VARCHAR2 (30) := 'FLEETPRO';
CURSOR cons_cur
IS
SELECT C.owner, C.constraint_name, C.table_name,
TRANSLATE (C.table_name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ_',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
as RTrimTable
, CR.owner as ROwner, CR.constraint_name as RCName,
CR.table_name as RTable,
TRANSLATE (CR.table_name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ_',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ') as RtrimRTable
FROM all_constraints C, all_constraints CR
WHERE C.owner = 'FLEETPRO'
AND C.owner = CR.owner
AND C.constraint_type in ('R')
AND UPPER(SUBSTR(C.constraint_name,1,3)) <> 'FK_'
AND C.r_constraint_name = CR.constraint_name
ORDER BY C.table_name,CR.table_name;
-- AND rownum < 50;
cons_rec cons_cur%ROWTYPE;
CURSOR col_curs
IS
SELECT column_name, position
FROM all_cons_columns cc
WHERE cc.owner = cons_rec.owner
AND cc.constraint_name = cons_rec.constraint_name
AND cc.table_name = cons_rec.table_name
ORDER BY position;
CURSOR col_R_curs
IS
SELECT column_name, position
FROM all_cons_columns cc
WHERE cc.owner = cons_rec.ROwner
AND cc.constraint_name = cons_rec.RCname
AND cc.table_name = cons_rec.RTable
ORDER BY position;
v_table_name all_constraints.table_name%type;
v_Rtable_name all_constraints.table_name%type;
v_ctr int;
v_fklist VARCHAR2 (1000);
v_fklist_R VARCHAR2 (1000);
v_global_name VARCHAR2 (80);
BEGIN
OPEN cons_cur;
v_table_name := NULL;
v_Rtable_name := NULL;
v_ctr := 0;
LOOP
FETCH cons_cur INTO cons_rec;
EXIT WHEN cons_cur%NOTFOUND;
v_fklist := NULL;
v_fklist_R := NULL;
FOR col_rec IN col_curs
LOOP
IF v_fklist IS NULL THEN
v_fklist := '( ' || col_rec.column_name;
ELSE
v_fklist := v_fklist || ', ' || col_rec.column_name;
END IF;
END LOOP;
FOR col_rec IN col_R_curs
LOOP
IF v_fklist_R IS NULL THEN
v_fklist_R := '( ' || col_rec.column_name;
ELSE
v_fklist_R := v_fklist_R || ', ' || col_rec.column_name;
END IF;
END LOOP;
IF ((v_table_name = cons_rec.table_name)
AND (v_Rtable_name = cons_rec.Rtable))
THEN v_ctr := v_ctr + 1;
Else
v_ctr := 0;
v_table_name := cons_rec.table_name;
v_Rtable_name := cons_rec.Rtable;
End If;
v_fklist := v_fklist || ')';
v_fklist_R := v_fklist_R || ')';
DBMS_OUTPUT.put_line
'alter table ' || cons_rec.owner || '.' || cons_rec.table_name
DBMS_OUTPUT.put_line
'drop constraint ' || cons_rec.constraint_name || ';'
DBMS_OUTPUT.put_line
'alter table ' || cons_rec.owner || '.' || cons_rec.table_name
IF v_ctr > 0 THEN
v_global_name := 'FK_' || cons_rec.table_name || '_'
|| cons_rec.RTable || to_char(v_ctr);
ELSE
v_global_name := 'FK_' || cons_rec.table_name || '_'
|| cons_rec.RTable;
END IF;
IF length( v_global_name ) > 29 Then
IF v_ctr > 0 then
v_global_name := 'FK_' || cons_rec.RtrimTable || '_'
|| cons_rec.RtrimRTable || to_char(v_ctr);
ELSE
v_global_name := 'FK_' || cons_rec.RtrimTable || '_'
|| cons_rec.RtrimRTable;
END IF;
END IF;
DBMS_OUTPUT.put_line
'add constraint ' || v_global_name || ' foreign key ' ||
v_fklist
DBMS_OUTPUT.put_line
'references ' || cons_rec.ROwner || '.' || cons_rec.Rtable || ' '
||
v_fklist_R ||
DBMS_OUTPUT.new_line ();
END LOOP;
END; -
Can we rename the system generated constraint_name as per our convenience ?
I created a table by
CREATE TABLE table_name AS (SELECT * FROM existing_table_name WHERE 1=2);
and got the all constraints of the existing table with default names. I want to rename those constraints as per current table data.
thank you in advance
Edited by: 930934 on Apr 29, 2012 8:51 AMsb92075 wrote:
WHY? What difference does the CONSTRAINT_NAME make?A lot. Because with a consistent naming convention it's a lot easier to understand the error message when the constraint is violated.
When you see this error message:
SQL> insert into foo (id, some_value) values (1, -1);
insert into foo (id, some_value) values (1, -1)
ERROR at line 1:
ORA-02290: check constraint (FOOBAR.SYS_C0016210) violatedDo you really know which column violates the constraint?
Now give the constraint a meaningful name, like this:
SQL> insert into foo (id, some_value) values (1,-1);
insert into foo (id, some_value) values (1,-1)
ERROR at line 1:
ORA-02290: check constraint (FOOBAR.CHK_SOME_VALUE_POSITIVE) violatedthen it becomes obvious which of the colums is meant.
Or think about foreign keys:
SQL> insert into bar (id, foo_id, product_id) values (1, 0, 0);
insert into bar (id, foo_id, product_id) values (1, 0, 0)
ERROR at line 1:
ORA-02291: integrity constraint (FOOBAR.SYS_C0016214) violated - parent key not foundAgain, with the right name, it becomes obvious which column violated the constraint:
SQL> insert into bar (id, foo_id, product_id) values (1, 0, 0);
insert into bar (id, foo_id, product_id) values (1, 0, 0)
ERROR at line 1:
ORA-02291: integrity constraint (FOOBAR.FK_BAR_REFERENCES_FOO) violated - parent key not foundMost probably one would use a slighlty less verbose name for the foreign key in real life due to Oracles limit on identifiers, but it shows how much more readable an error message is, with a proper name. -
Change dimension constraints key after copy and paste
How do I change the dimension constraint key after I copy and paste or after the dimension is created? The reason is that the dimension I copy and paste has constraints named as "COPY_OF_RP_MERCHANT_UK" (I would like to be remove the COPY_OF)
Right-click on the dimension and select Editor. In the editor, click on the Edit menu and select Table Properties. Click on the constraints tab and rename the constraints.
Regards:
Igor -
Hi,
I am relatively new to databases. So, I have seen and experienced only Oracle 8i and to some extent 9i.
I have a few queries.
1. What is the versioning convention used by Oracle. I mean, what does the "i" mean in these versions? And what does the "g" mean in 10g.
2. Which is the latest version of Oracle. Is it 10g?
3. I would like to know, briefly, the features introduced with each of the major versions like 7i, 8i, 9i, 10g...
It would be great if someone can clarify these or point me to some place where I can find brief answers for these. For example, there is the Oracle documentation site which gives a detailed list of features, some of which I don't understand. Moreover, I felt it is too much detail.
Thanks in advance,
Rajeshhi rajesh
1.i means internet
g means grid
2.latest version is 10g
but 9 rel 2 is widely used.
3. 10g http://otn.oracle.com/pub/articles/10gdba/index.html
9i undo tablespace
flash back query
tablespace export
partitioning enhancement
rel 2 rename column,constraint
sql/plsql enhancement
dbms_metadata.get_ddl
transport tablespace enhancement export import on multiblock size 8k to 16k
8i index org table
drop column
transport tablespace
function based index
locally manage tablespace
temporary table
7 ??
kuljeet pal singh -
Strawman Feature Factoring List - Feedback requested
OK - as promised, here's the strawman feature list for Oracle Database XE. Please send feedback on
1) Anything you think is missing from the list
2) Anything that has a no against it that you simply cannot live without
Last but not least, this is just strawman. Oracle reserves the right to change this factoring at any time
Options/Major Features not included:
Oracle Real Application Clusters
Oracle Clusterware
Oracle Spatial
Oracle Database Workspace Manager
Advanced Security Option
Oracle Label Security
Oracle Enterprise Manager
Oracle Change Management Pack
Oracle Configuration Management Pack
Oracle Diagnostic Pack
Oracle Tuning Pack
Oracle Partitioning
Oracle OLAP
Oracle Data Mining
Oracle Streams (Apply process only in SE/XE)
Oracle Workflow
Messaging Gateway
Oracle Connection Manager
Oracle Names
Application Development/Language/Database Features
SQL*Plus YES
iSQL*Plus NO
HTMLDB Application Development Environment YES
PL/SQL stored procedures and triggers YES
PL/SQL server pages YES
PL/SQL native compilation YES
JDBC drivers YES Client side JDBC only
Java support in the Database NO
Java Server Pages NO
Java native compilation NO
SQLJ NO
XML support in the database YES No XQuery, JNDI, SERVLET
ODP.Net, OLE DB.NET and ODBC.NET support YES Windows only
.NET Common Language Runtime Procedure support YES Windows only
Microsoft Transaction Server/COM+ integration YES Windows only
COM Automation NO Windows only
Oracle Objects for OLE (OO4O) NO Windows only
VLM Support, 4GB RAM Tuning NO Windows only
DML triggers YES
Database event triggers YES
Instead-of triggers YES
Index-organized tables YES
Temporary tables YES
Data Compression NO
Objects and Extensibility YES
LOB (large object) support YES
Oracle Text YES English/French Knowledge Bases not supplied
Ultra Search NO
interMedia NO
Locator NO (To be confirmed)
Function-based index YES
Bitmapped index, bitmapped join index NO
Regular Expressions YES
Sample Scan YES
SQL Model YES
Analytic functions YES
Summary Management NO
Materialized View Query Rewrite NO
Parallel query/DML NO
Parallel statistics gathering NO
Parallel index build/scans NO
Parallel export/import NO
Globalization support YES 10 languages, limited character sets
Availability/Backup and Recovery Features
Drop column YES
Rename column, constraint YES
Comprehensive online schema reorganization/redefinition NO
Flashback Query YES
Flashback Table NO
Flashback Database NO
Flashback Transaction Query NO
Online Backup YES
Incremental backup and recovery YES No change tracking file or optimized incremental backup capability
Automatic Backup/Recovery to Flash Recovery Area NO Manual, may be scheduled at OS level
Duplexed backup sets NO
Fast-Start Selectable Recovery Time NO
Block-level media recovery NO
Parallel backup and recovery NO
Point-in-time tablespace recovery NO
Trial recovery NO
Legato Storage Manager NO
Oracle Data Guard Redo Apply (Physical Standby) NO
Oracle Data Guard SQL Apply (Logical Standby) NO
Rolling Upgrade Support Patch Set, Database and O/S NO
LogMiner NO (To be confirmed)
Security Features
Password management YES
Encryption toolkit YES (DBMS_CYRPTO)
Virtual Private Database NO
Fine grained auditing NO
Manageability Features
Automatic Memory Management YES
Automatic Undo management YES
Automatic redo management YES
Automatic Statistics Management YES
Server-generated Alerts NO
Database Resource Manager NO (Provided, but not configurable)
Data Movement/Integration Features
Direct Path Load API YES
External tables YES
Synchronous Change Data Capture NO
Asynchronous Change Data Capture NO
Transportable tablespaces, including cross-platform NO
Advanced Queuing YES
Basic Replication YES Updateable materialized view site
Distributed queries YES To be confirmed
Distributed transactions YES To be confirmed
Advanced Replication NO Multi-master replication
Heterogeneous Services NO To be confirmedVirtual Private Database NOThat is bad, kind of hard to have a good and secure HTMLDB application without that feature. The problem is, RLS is not part of the standard edition. So delivering XE with EE functions enabled will mess up the upgrade path when users decide they need to scale. They're going to have to jump from free to EE licence and that's a big chunk of difference.
Java support in the Database NOWe vote for Yes!!!!, its very important for our project.There goes the small footprint....
Point-in-time tablespace recovery NO I believe the lack of point in time recovery is unfortunate. Seconded. I think is the most crucial missing feature. It's the only omission that undermines XE's usefulness as a production platform. Everything else is just nice-to-have.
Cheers, APC -
Cwm Error Message: API0307:
Hi
we know that we can rename the constraint name in OWB and infact I have done it lot of times but now it throws me the following error when I am trying to rename the constraint name in fact or dimension tables.
What has to be done so that I am allowed to change the constraint names?
The detail of the error is as follows
Cwm Error Message: API0307: Fatal Error in NS service, Please check OWB
error log for details..
Cwm Error: SQL Exception
Class Name: LocalNamespaceService
Method Name: reserveName
Repository Error Message: API0308: OWB_ERROR_LOG_TABLE in repository
keeps the log...
Cwm Error Message: API0307: Fatal Error in NS service, Please check OWB
error log for details..
Cwm Error: SQL Exception
Class Name: LocalNamespaceService
Method Name: reserveName
Repository Error Message: API0308: OWB_ERROR_LOG_TABLE in repository
keeps the log...
at
oracle.wh.repos.impl.namespace.LocalNamespaceService.reserveAction(LocalNamespaceService.java:433)
at
oracle.wh.repos.impl.namespace.LocalNamespaceService.reserveAction(LocalNamespaceService.java:387)
at
oracle.wh.repos.impl.namespace.LocalNamespaceService.onFCORename(LocalNamespaceService.java:214)
at
oracle.wh.repos.impl.namespace.LocalNamespaceService.renameObject(LocalNamespaceService.java:642)
at
oracle.wh.repos.impl.dispatcher.EventDispatcherImpl.beforeEditNameField(EventDispatcherImpl.java:367)
at
oracle.wh.repos.impl.foundation.CMPElement.internalSetName(CMPElement.java:1648)
at
oracle.wh.repos.impl.foundation.CMPElement.setName(CMPElement.java:1698)
at
oracle.wh.ui.enterprise.TableConstraintSource.setData(TableConstraintSource.java:329)
at oracle.ewt.grid.Grid._doneEditing(Unknown Source)
at oracle.ewt.grid.Grid.commitCellEdit(Unknown Source)
at oracle.ewt.grid.GridKeyAdapter.keyPressed(Unknown Source)
at java.awt.Component.processKeyEvent(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextComponent.processKeyEvent(Unknown
Source)
at oracle.ewt.lwAWT.lwText.LWCommonText.processKeyEvent(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextField.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.lwText.LWTextComponent.processEventImpl(Unknown
Source)
at oracle.ewt.lwAWT.lwText.LWTextField.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.processKeyEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.Dialog.show(Unknown Source)
at oracle.wh.ui.common.WbPropertyDialog.show(WbPropertyDialog.java:403)
at java.awt.Component.show(Unknown Source)
at java.awt.Component.setVisible(Unknown Source)
at
oracle.wh.ui.common.WbPropertyDialog.setVisible(WbPropertyDialog.java:411)
at
oracle.wh.ui.enterprise.TablePropertySheet.init(TablePropertySheet.java:103)
at
oracle.wh.ui.enterprise.TablePropertySheet.<init>(TablePropertySheet.java:68)
at
oracle.wh.ui.enterprise.EdmController$TablePropertyListener.actionPerformed(EdmController.java:234)
at
oracle.wh.ui.common.OWBConsumer.dataItemAvailable(OWBInfoBus.java:380)
at
javax.infobus.DefaultController.fireItemAvailable(DefaultController.java:91)
at javax.infobus.InfoBus.fireItemAvailable(InfoBus.java:982)
at oracle.wh.ui.common.OWBInfoBus.produce(OWBInfoBus.java:159)
at oracle.wh.ui.common.OWBInfoBus.produce(OWBInfoBus.java:76)
at
oracle.wh.ui.dimension.DimensionGraph.launchDimensionTable(DimensionGraph.java:1768)
at
oracle.wh.ui.dimension.DimensionEditorController.handleMenuAction(DimensionEditorController.java:136)
at
oracle.wh.ui.dimension.DimensionEditorController.handleEditorEvent(DimensionEditorController.java:63)
at
oracle.wh.ui.common.WhFolderEditor$MyMenuItemListener.actionPerformed(WhFolderEditor.java:928)
at
oracle.wh.ui.common.FolderEditorMenuObject$DefaultMenuItemListener.actionPerformed(FolderEditorMenuObject.java:497)
at oracle.ewt.lwAWT.lwMenu.LWMenuItem.processActionEvent(Unknown
Source)
at oracle.ewt.lwAWT.lwMenu.LWMenuItem.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at oracle.ewt.lwAWT.lwMenu.LWMenuItem.activate(Unknown Source)
at
oracle.ewt.lwAWT.lwMenu.laf.VertMenuItemController.mouseReleased(Unknown
Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.lwMenu.LWMenuItem.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at
oracle.ewt.event.tracking.GlassMouseGrabProvider$Disp._redispatchEvent(Unknown
Source)
at
oracle.ewt.event.tracking.GlassMouseGrabProvider$Disp._redispatchEvent(Unknown
Source)
at
oracle.ewt.event.tracking.GlassMouseGrabProvider$Disp.mouseReleased(Unknown
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEventImpl(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)This is a bug should be fixed in OWB 9.0.3.x. If your version is lower, please upgrade.
Regards:
Igor -
How to delete/mark obsolete database objects from ODI model?
Hi,
ODI never deletes objects while reverse engineering.
So is it way to automate deletion or marking obsolete database objects (dropped or renamed fields, constraints) from an ODI model?
Does someone use ODI Java API (http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e17060/overview-tree.html) or direct updating SNP_% repository tables to do it?I can help you with marking obsolete database objects.
In the model, there is an option "Display the metadata changes in the Model Tree". Check this.
This will show you what has changed or is obsolete. -
Data Modeler design rules warning
When I apply the design rules to the relationel model Data Modeler warns me about both Primary keys and Foreign keys "with wrong naming standards is not recommended".
However, I have designed the naming rules in the Tools => General Options => Naming Standard => Templates section for example like this: Primary Key: PK_{table abbr}_{column abbr} or like this {table abbr}_{column abbr}_PK and defined table and column abbreviations. Data modeler warns about either form, and since only recommended naming rules exists I do not understand the warning.The warning is shown if you deviate/rename the constraints from what is set in the templates, so having selected abbr from the variable list you should not be seeing the warning. We extended the variables to include the abbreviation and it looks like these have not been included in the validation. I have logged a bug to track that.
Sue -
Unable to remove recycle bin entries from user_constraints table
When I do select * from user_constraints table I get few entries like BIN$HY86N3B2RQi/1ODAiR9CTw==$0.
I have tried purging the recycle bin many times but these entries are still there. When i try to read the database information from my code(JDBC Connection) these keys are being read and generating erroneous results.
One more important thing. When i tried to rename these keys, they are getting generated again. Any help on this issue will be very helpful to me. Thanks in advance.>
When i tried to rename these keys, they are getting generated again
>
What does this mean? Show us the statement you used to do the rename.
>
its not present in the recycle bin but it is present in the table user_constraints only. when i do a select * from user_constraints i get two entries where the constraint_name is like this BIN$.........
>
Exactly - once you flashback the table the constraints aren't in the recycle bin so you can't purge them from it. But you can rename these if you own them. You don't have to be SYS.
See the 'Notes on Flashing Back Dropped Tables in the SQL reference
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9012.htm
>
Notes on Flashing Back Dropped Tables The following notes apply to flashing back dropped tables:
•Oracle Database retrieves all indexes defined on the table retrieved from the recycle bin except for bitmap join indexes. (Bitmap join indexes are not put in the recycle bin during a DROP TABLE operation, so cannot be retrieved.)
•The database also retrieves all triggers and constraints defined on the table except for referential integrity constraints that reference other tables.
The retrieved indexes, triggers, and constraints have recycle bin names. Therefore it is advisable to query the USER_RECYCLEBIN view before issuing a FLASHBACK TABLE ... TO BEFORE DROP statement so that you can rename the retrieved triggers and constraints to more usable names.
•When you drop a table, all materialized view logs defined on the table are also dropped but are not placed in the recycle bin. Therefore, the materialized view logs cannot be flashed back along with the table.
•When you drop a table, any indexes on the table are dropped and put into the recycle bin along with the table. If subsequent space pressures arise, then the database reclaims space from the recycle bin by first purging indexes. In this case, when you flash back the table, you may not get back all of the indexes that were defined on the table.
>
Just rename the constraints since they are in your own schema. -
Hello Guru's,
Today I have tried with DBMS_REDEFINITION package, I'm successfully partitioning the existing table, but there are some dependent objects are missing after completing the redefinition package.
Im Using 11g R2.
Please assist me , in which stage it went wrong, Actually my table is have around 12 dependent procedures, functions, Synonyms how ever, after completing the redefinition when i query the all_dependancies I m getting only 9 objects with correct status.
Please suggest me that what happened to remaining 3 dependent objects. Its a bit urgent.
Steps I followed:
1.Created a bkp table of same as existing table A.
2.EXEC Dbms_Redefinition.Can_Redef_Table(USER, 'A'); ---No errors got.
3.DBMS_REDEFINITION.start_redef_table(uname => USER, orig_table => 'A',int_table => 'A_BKP'); ----No errors
4. dbms_redefinition.sync_interim_table(
uname => USER,
orig_table => 'A',
int_table => 'A_BKP'); ----No errors got.
5.Manually Added constraints on A_BKP what ever constraints on A .--- No errors
6. Manually Added Indexes on A_BKP what ever indexs are there on A columns ----No errors
7.EXEC DBMS_STATS.gather_table_stats(USER, 'A_BKP', cascade => TRUE); ---No errors
8.dbms_redefinition.finish_redef_table(
uname => USER,
orig_table => 'A',
int_table => 'A_BKP'); ----No errors
9. Manually Droped A_BKP table
10. Manually Renamed all constraints and Indexex to the original names -----No errors
11. Queried Select count(*) from A;
Then I queried in all_dependencies, now there is mis match between before partitioned table dependencies and after ,
Please tell me whats wrong with this steps , its a bit urgent, any fruther steps to be taken ?No I have checked that missing objects there are present in the DB and when i query in All_dependancies with that referenced name, it will giving less rows than original
-
Can't import DDL file that has alter table rename constraint
Hi:
Version 3.1.0.691 on Windows 7 Enterprise 64-bit SP1
I'm trying to import a DDL file with syntax similar to what's below. The <name> notes that I've replaced the actual names for obfuscation purposes.; the real names are in the script.
ALTER TABLE <name>
RENAME CONSTRAINT SYS_C0041150
TO <name2>_CK;
ALTER TABLE <name>
RENAME CONSTRAINT AVCON_1281559518_ACTIV_022
TO <name2>_CK;
I get the following error:
Oracle SQL Developer Data Modeler 3.1.0.691
Oracle SQL Developer Data Modeler Import Log
Date and Time: 2012-01-13 16:29:05 PST
Design Name: <name>
RDBMS : Oracle Database 11g
All Statements: 819
Imported Statements: 0
Failed Statements: 0
Not Recognized Statements: 819
<<<<< Not Recognized >>>>>
ALTER TABLE <name>
RENAME CONSTRAINT SYS_<name>
TO <name2>_CK
ALTER TABLE <name>
RENAME CONSTRAINT AVCON_1281559518_QVI_A_000
TO <name2>_CK
Thanks for any help you can provide.
DocHi:
The file was indeed comprised of just alter statements. As a test, I trimmed the file down to just one alter statement:
ALTER TABLE <name> RENAME CONSTRAINT SYS_C0041413 TO <name2>_CK;
The output file contained exactly the following, where the <<BEGIN OF FILE>> and <<END OF FILE>> were simply added here for clarity. There was no section called
<<<<< ERRORS >>>>> and the ddl file contained no create table statements.
<<BEGIN OF FILE>>
Oracle SQL Developer Data Modeler 3.1.0.691
Oracle SQL Developer Data Modeler Import Log
Date and Time: 2012-01-16 10:16:42 PST
Design Name: <name>
RDBMS : Oracle Database 11g
All Statements: 1
Imported Statements: 0
Failed Statements: 0
Not Recognized Statements: 1
<<<<< Not Recognized >>>>>
ALTER TABLE <name> RENAME CONSTRAINT SYS_C0041413 TO <name2>_CK
<<END OF FILE>>
Other info.
When I do an model import, none of the existing check constraint names get captured. Also, if I add names afterwards to two separates models via DM and then compare them. The output DDL shows a drop of the target constraint referencing its name, but the recreation of the not null constraint doesnt reference the source constraint name set for it manually in DM. Here's the example I did and the output ddl.
ALTER TABLE <name>
DROP CONSTRAINT SYS_C0041413
ALTER TABLE <name>
MODIFY ( <column_name> NOT NULL )
That last line should have read as follows due to the constraint_name I added for it in DM.
ALTER TABLE <name>
MODIFY (<column_name> CONSTRAINT <name2>_CK NOT NULL);
In the example directly above, <name2>_CK is the name I explicity set via DM and would have expected the compare to have used to recreated the constraint since it referenced the target constraint name when it constructed the drop constraint syntax.
I believe at least one bug is involved here, most likely two.
The first bug is that model imports are not capturing not null check constraint names.
The second bug is that the source constraint name is not being used when generating the ddl necessary to change the not null constraint name in the target model.
All of this is assuming that I haven't just goofed and forgotten to check a box somewhere telling it to do what I've been talking about here. :-)
Doc -
Help me create a procedure to rename plenty of constraints
about 500 tables' constraints require to be renamed from SYS**** to the table's name.
what procedure could you guys think of?
If you've used a previous one please let me know, or if you know where I could download a package, procedure or something, show me the link to get it.
My DB is: version 8173This Procedure renames PK to PK+TableName(excuse the german comments):
procedure rename_primary_key
is
cursor c_user_cons is
select
c.constraint_name,
c.constraint_type,
c.r_constraint_name,
rc.table_name r_table_name,
c.table_name,
to_char(NULL) key_columns,
i.tablespace_name
from user_constraints c, user_constraints rc, user_indexes i
where c.constraint_type in ('P','R')
and (c.r_constraint_name like 'SYS%' or c.r_constraint_name is null)
and c.constraint_name = i.index_name (+)
and c.r_constraint_name = rc.constraint_name (+)
order by c.constraint_type desc, c.table_name, c.constraint_name;
type cons_list is table of c_user_cons%rowtype;
key_columns varchar2(1000);
constraint_liste cons_list := cons_list(NULL);
begin
for rec in c_user_cons loop
-- Liste mit vorhandenen constraints erstellen
constraint_liste(constraint_liste.last) := rec;
for rec_col in (
select column_name, position
from user_cons_columns
where constraint_name = rec.constraint_name
order by position
) loop
if rec_col.position = 1 then
key_columns := rec_col.column_name;
else
key_columns := key_columns||','||rec_col.column_name;
end if;
end loop;
constraint_liste(constraint_liste.last).key_columns := key_columns;
constraint_liste.extend;
end loop;
constraint_liste.trim;
for i in constraint_liste.first..constraint_liste.last loop
-- Aufgrund der Sortierung des Cursors sind Foreign Keys zuerst in der Liste und
-- werden vor zugehörigem PK gelöscht
if constraint_liste(i).constraint_type = 'P' then -- PK löschen und neu anlegen
if constraint_liste(i).tablespace_name is not NULL then
-- nur ausführen, wenn eigener Index für PK vorhanden
execute immediate 'alter table '||constraint_liste(i).table_name||' drop primary key';
execute immediate 'alter table '||constraint_liste(i).table_name||' add (constraint PK'
||substr(constraint_liste(i).table_name, 1, 30)|| ' primary key ('
||constraint_liste(i).key_columns||') using index tablespace '
||constraint_liste(i).tablespace_name||')';
end if;
else -- FK löschen
execute immediate 'alter table '||constraint_liste(i).table_name||' drop constraint '||constraint_liste(i).constraint_name;
end if;
end loop;
for i in constraint_liste.first..constraint_liste.last loop
-- FK neu anlegen
if constraint_liste(i).constraint_type = 'R' then
execute immediate 'alter table '||constraint_liste(i).table_name||' add (constraint '
||constraint_liste(i).constraint_name||' foreign key('||constraint_liste(i).key_columns
||') references '||constraint_liste(i).r_table_name||' deferrable initially deferred)';
end if;
end loop;
end rename_primary_key; -
BI Publisher Multiple tray/ Renaming of file / Zipping of BI Publisher O/P
Hi Team,
I want to know, whether we can achieve the following task in embedded BI publisher or not.
Also, if we can do, let me know what are the possible steps to achieve them:
1. Multiple Tray selection
Here multiple Tray means different tray available in a single printer i.e tray 1 can have A4 paper, tray 2 can have A3 paper , tray 3 can have pre- printed stationary etc. so our BIP output can be send to multiple tray.
*2. Checking the groupings - how many levels*
Embedded BIP can provide a maximum of upto 4 levels of grouping.
our requirement demand to group upto 7 level, I have suggested that we can achieve this through manual coding in RTF.
*3. Email Feature - HTML (body is dynamic).*
BIP has this emailing facility where we can have dynamic body in a mail. We need to figure out what max no of character , we can have in the body.
*4. Reports that are uploaded to different folders.*
It means that PDF/RTF files should be able to be copied to different folders like C:\DMU, D:\CTA etc
5. Inserting records into SQL
We need to find way for connecting to database and inserting our BIP records.
6. Renaming files for the Email and Doc Central.
We need to find out methods where we can rename our BIP outputs.Generally BIP file name gets generated automatically with UBE engine when it generates XML file.
*7. Integrate with Doc Central (PDFs and Common XML)*
Client is having one DOC Central software where client keeps repository of all its documents. we need to figure out that can we integrate our JDE with DOC central for keeping our BIP outputs in it.
*8.Zipping of the files and sending the documents by FTP.*
we need to figure out ways where we can zip our BIP outputs and send it through FTP.
Let me know possible ways to achieve above 8 constraints, any java/dot net program if require to meet those above 8 facilities are also welcome.
Thanks!
Deepak MishraHi ,
Do not have an answer yet . but with some research and trials it seems this may not be possible.
Regards,
PKB
Maybe you are looking for
-
Error Message while assigning resource to work orders
Hi All, We have the MRS tool integration with service work orders for scheduling. When we assign the resources with 9 hours as duration there is no error. When we allocate more than 9 hours for some resources, not all, we receive the error message as
-
Open analysis report in BI Publisher in OBIEE plus
Hi, I am unable to open a report in BI Publisher which was generated in analysis in OBIEE plus(11g). Previously I did it through Oracle BI Analysis+ in the Data Modle (Data Set). Now I am unbale to find the reports through same process. I noticed onl
-
How do i get hosted website files back into iWeb after they were lost off iWeb?
Lost all website files from my iWeb program. Possible I updated a newer non compatible iWeb version? At any rate........have website files back on my desktop and have no idea how to get them back into iWeb so I can modify. Any help will be greatly
-
Why is my Mac's Flash Storage full?
I have an issue on my Mac where my flash storage's free space suddenly shrank. I am using a Macbook Air (128 GB). As the storage is pretty small, I am trying to keep my storage as efficient as possible. Last 3 days, my free space is 37 GB
-
Updaing 2 schema's in 1 db = non-emulated datasource
When updating two databases from within a single tx, you must use a non-emulated datasource (i.e. JTA support is required). Is this true of updating two database schema's (same database) in the same tx as well ? The Oracle documentation seems not to