DBMS_REDEFINITION in 8.1.7
Hi,
DBMS_REDEFINITION is appeared in 9.0.1. It is{ORACLE_HOME}/rdbms/admin/dbmshord.sql script. Can't we use it in 8.1.7 ? By for exemple copying dbmshord.sql script on {ORACLE_HOME}/rdbms/admin ?
Many thanks
Bad idea. It might use data dictionary which don't exists in 8i.
Furthermore the script you pointed out is only for the package declaration, not for the pakage body.
Nicolas.
Similar Messages
-
DBMS_REDEFINITION issue. ORA-12089 and ORA-42016
Hi all,
I need a little help understanding and using DBMS_REDEFINITION.
I have a table that I need to transform in a partitioned table, keeping all the indexes, constraints, primary and foreign keys unaltered. I found the DBMS_REDEFINITION and figured it is the best choice since I have to transform a table with more than 1 million records and a BLOB field. BTW I am working in a Windows 2003 R2 SP2 64bit environment on an Oracle 10.2.0.4 DB.
To test the procedure I used a smaller table, with fewer rows. This is what I did:
CREATE TABLE LONGO.ARRI_RICORSO as SELECT * from PRODUCTION.ARRI_RICORSO;
CREATE TABLE "LONGO"."ARRI_RICORSO2" ( "ARRI_ID" NUMBER(12) NOT NULL , "ARVB_ID" NUMBER(12) NOT NULL , "ARIN_ID" NUMBER(12),
"ARAV_ID" NUMBER(12), "ANAU_COD" VARCHAR2(4), "ANCO_ID" NUMBER(5), "ANNA_COD" CHAR(3), "ARRI_DATA" DATE,
"ARRI_PROT" VARCHAR2(20), "ARRI_D_TRASM" DATE, "ARRI_F_ESITO" CHAR(1), "ARRI_D_ESITO" DATE, "ARRI_PROT_ESITO" VARCHAR2(20),
"ERDO_ID_RICOR" NUMBER(12), "ERDO_ID_ESITO" NUMBER(12),
"ERDO_ID_PROVV" NUMBER(12)) TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 0K BUFFER_POOL DEFAULT)
LOGGING PARTITION BY RANGE ("ARRI_DATA") (PARTITION "ARRI_RICORSO2_P1" VALUES LESS THAN (TO_DATE(' 2009-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS',
'NLS_CALENDAR=GREGORIAN'))
TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT)
LOGGING NOCOMPRESS , PARTITION "ARRI_RICORSO2_P2" VALUES LESS THAN (TO_DATE(' 2009-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS',
'NLS_CALENDAR=GREGORIAN')) TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE
( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT) LOGGING NOCOMPRESS ,
PARTITION "ARRI_RICORSO2_P3" VALUES LESS THAN (TO_DATE(' 2009-04-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
TABLESPACE "USERS" PCTFREE 10 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT)
LOGGING NOCOMPRESS , PARTITION "ARRI_RICORSO2_P4" VALUES LESS THAN ...... ETC up to 60 partitions, one per MONTHSo I have the first table full and with constraints (a couple of NOT NULL values) and a second, completely empty, partitioned table.
I started off with:
exec dbms_redefinition.can_redef_table('LONGO', 'ARRI_RICORSO');that gave me the error
ERROR at line 1:
ORA-12089: cannot online redefine table "LONGO"."ARRI_RICORSO" with no primary
key
ORA-06512: at "SYS.DBMS_REDEFINITION", line 137
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1479
ORA-06512: at line 1So I modified the script with:
exec dbms_redefinition.can_redef_table('LONGO', 'ARRI_RICORSO',dbms_redefinition.cons_use_rowid);
PL/SQL procedure successfully completed.OK! After this I launched:
SQL> exec dbms_redefinition.start_redef_table('LONGO', 'ARRI_RICORSO', 'ARRI_RICORSO2');
BEGIN dbms_redefinition.start_redef_table('LONGO', 'ARRI_RICORSO', 'ARRI_RICORSO2'); END;
ERROR at line 1:
ORA-12089: cannot online redefine table "LONGO"."ARRI_RICORSO" with no primary
key
ORA-06512: at "SYS.DBMS_REDEFINITION", line 50
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1343
ORA-06512: at line 1Same problem I thought!
SQL> exec dbms_redefinition.start_redef_table('LONGO', 'ARRI_RICORSO', 'ARRI_RICORSO2', dbms_redefinition.cons_use_rowid);
BEGIN dbms_redefinition.start_redef_table('LONGO', 'ARRI_RICORSO', 'ARRI_RICORSO2', dbms_redefinition.cons_use_rowid); END;
ERROR at line 1:
ORA-12089: cannot online redefine table "LONGO"."ARRI_RICORSO" with no primary
key
ORA-06512: at "SYS.DBMS_REDEFINITION", line 50
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1343
ORA-06512: at line 1...ok... Now I am stuck! What have I done wrong? I also read various documents that explained how to use correctly the procedure, but I can't understand why I am getting this error!
This is how the table is structured:
SQL> desc arri_ricorso
Name Null? Type
ARRI_ID NOT NULL NUMBER(12)
ARVB_ID NOT NULL NUMBER(12)
ARIN_ID NUMBER(12)
ARAV_ID NUMBER(12)
ANAU_COD VARCHAR2(4)
ANCO_ID NUMBER(5)
ANNA_COD CHAR(3)
ARRI_DATA DATE
ARRI_PROT VARCHAR2(20)
ARRI_D_TRASM DATE
ARRI_F_ESITO CHAR(1)
ARRI_D_ESITO DATE
ARRI_PROT_ESITO VARCHAR2(20)
ERDO_ID_RICOR NUMBER(12)
ERDO_ID_ESITO NUMBER(12)
ERDO_ID_PROVV NUMBER(12)ARRI_RICORSO2 is exactly the same, but with no data in it and with partitions....
Please help! :)
Thanks in advance!
P.s. I also added a primary key to both the tables. That is when I got the ORA-42016 error while attempting the exec dbms_redefinition.start_redef_table process ant not the ORA-12089 anymore...
Edited by: Phelit on 17-mag-2013 6.07>
exec dbms_redefinition.start_redef_table('LONGO', 'ARRI_RICORSO', 'ARRI_RICORSO2', dbms_redefinition.cons_use_rowid);
>
Right idea, wrong implementation. You are passing the 'CONS_USE_ROWID' as the THIRD parameter instead of the FOURTH (col_mapping) parameter.
See the DBMS_REDEFINITION doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_redefi.htm#i998726
The 'OPTIONS_FLAG' is the THIRD parameter for the 'CAN_REDEF_TABLE' procedure
>
CAN_REDEF_TABLE Procedure
This procedure determines if a given table can be redefined online. This is the first step of the online redefinition process. If the table is not a candidate for online redefinition, an error message is raised.
Syntax
DBMS_REDEFINITION.CAN_REDEF_TABLE (
uname IN VARCHAR2,
tname IN VARCHAR2,
options_flag IN PLS_INTEGER := 1,
part_name IN VARCHAR2 := NULL);
>
But the 'OPTIONS_FLAG' is the FOURTH parameter for the 'START_REDEF_TABLE' procedure
>
START_REDEF_TABLE Procedure
Prior to calling this procedure, you must manually create an empty interim table (in the same schema as the table to be redefined) with the desired attributes of the post-redefinition table, and then call this procedure to initiate the redefinition.
Syntax
DBMS_REDEFINITION.START_REDEF_TABLE (
uname IN VARCHAR2,
orig_table IN VARCHAR2,
int_table IN VARCHAR2,
col_mapping IN VARCHAR2 := NULL,
options_flag IN BINARY_INTEGER := 1,
orderby_cols IN VARCHAR2 := NULL,
part_name IN VARCHAR2 := NULL);
>
This works for me:
exec dbms_redefinition.start_redef_table('SCOTT', 'ARRI_RICORSO', 'ARRI_RICORSO2', options_flag => dbms_redefinition.cons_use_rowid); -
Error using dbms_redefinition package
Hi,
I am trying to use dbms_redefinition package to add a column to a table using primary key method
SQL> conn / as sysdba
Connected.
SQL> grant execute on sys.dbms_redefinition to hr;
Grant succeeded.
SQL> grant dba to hr;
Grant succeeded.
SQL> conn hr/<password>
Connected.
SQL> create table tab1(roll_no number constraint roll_pk primary key,last_name varchar2(30));
Table created.
SQL> insert into tab1 values (1,'Hall');
1 row created.
SQL> commit;
Commit complete.
SQL> insert into tab1 values (2,'Mall');
1 row created.
SQL> commit;
Commit complete.
SQL> insert into tab1 values (3,'Roll');
1 row created.
SQL> commit;
Commit complete.
Adding required column
SQL>
SQL> alter table tab1 add(first_name varchar2(30));
Table altered.
Checking if table can be redefined
SQL> exec dbms_redefinition.can_redef_table('HR','TAB1',DBMS_REDEFINITION.CONS_USE_PK);
PL/SQL procedure successfully completed.
Creating interim table
SQL> create table tab2 as select roll_no,first_name,last_name from tab1 where 1=2;
Table created.
Adding primary key to interim table
SQL> alter table tab2 add constraint roll_pk_1 primary key (roll_no);
Table altered.
Starting redefinition :
SQL> exec dbms_redefinition.start_redef_table('HR','TAB1','TAB2','ROLL_NO,FIRST_NAME,LAST_NAME');
BEGIN dbms_redefinition.start_redef_table('HR','TAB1','TAB2','ROLL_NO,FIRST_NAME,LAST_NAME'); END;
ERROR at line 1:
ORA-00439: feature not enabled: Advanced replication
ORA-06512: at "SYS.DBMS_REDEFINITION", line 52
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1646
ORA-06512: at line 1
SQL>
Could you please help.
Thanks,
HaiderYou can, yes. That's why CAN_REDEF_TABLE and START_REDEF_TABLE both have an OPTIONS_FLAG argument that lets you specify whether you want to use the primary key or the ROWID to redefine the table.
SQL> drop table foo;
Table dropped.
SQL> create table foo( col1 number, col2 number );
Table created.I can't redefine the table using the primary key since there is no primary key
SQL> ed
Wrote file afiedt.buf
1 begin
2 sys.DBMS_REDEFINITION.CAN_REDEF_TABLE ( 'SCOTT', 'FOO' );
3* end;
SQL> /
begin
ERROR at line 1:
ORA-12089: cannot online redefine table "SCOTT"."FOO" with no primary key
ORA-06512: at "SYS.DBMS_REDEFINITION", line 139
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1782
ORA-06512: at line 2But I can use the ROWID
SQL> ed
Wrote file afiedt.buf
1 begin
2 sys.DBMS_REDEFINITION.CAN_REDEF_TABLE ( 'SCOTT', 'FOO', dbms_redefinition.cons_use_rowid );
3* end;
SQL> /
PL/SQL procedure successfully completed. Justin -
Hello, I am using the DBMS_REDEFINITION.START_REDEF_TABLE to migrate a large table to unicore data types. When I attempt this the list of columns is too long and it generates:
SP2-0027: Input is too long (> 2499 characters) - line ignored
Below is the procedure call. Is there a way to over come this?
EXECUTE DBMS_REDEFINITION.START_REDEF_TABLE( -
'FOCUS',
'PREFERRED_CUSTOMER',
'INT_PREFERRED_CUSTOMER', -
'PREFERRED_CUST_KEY PREFERRED_CUST_KEY,SIGNUP_STORE_KEY SIGNUP_STORE_KEY,SIGNUP_ASSOC_EMPKEY SIGNUP_ASSOC_EMPKEY,PREFERRED_CUST_NUM PREFERRED_CUST_NUM, -
ALT_PREFERRED_CUST_NUM ALT_PREFERRED_CUST_NUM,TAX_EXEMPT_NUMBER TAX_EXEMPT_NUMBER,EMPLOYEE_KEY EMPLOYEE_KEY,SIGNUP_DATE SIGNUP_DATE,ALLOW_CONTACT_IND ALLOW_CONTACT_IND, -
ALLOW_DISTRIB_IND ALLOW_DISTRIB_IND, ALLOW_EMAIL_IND ALLOW_EMAIL_IND, ALLOW_EMAIL_IND_EFF_DATE ALLOW_EMAIL_IND_EFF_DATE, ALLOW_MAIL_IND ALLOW_MAIL_IND, -
ALLOW_MAIL_IND_EFF_DATE ALLOW_MAIL_IND_EFF_DATE, ALLOW_TELEMARKET_IND ALLOW_TELEMARKET_IND, ALLOW_DIRECT_MAIL_IND ALLOW_DIRECT_MAIL_IND, ALLOW_STMT_INSERT_IND ALLOW_STMT_INSERT_IND, -
CUST_SOURCE_CD CUST_SOURCE_CD, NAME_ADDR_SOURCE_CD NAME_ADDR_SOURCE_CD, NAME_ADDR_EFF_DATE NAME_ADDR_EFF_DATE, TO_NCHAR(LAST_NAME) LAST_NAME, TO_NCHAR(FIRST_NAME) FIRST_NAME, -
TO_NCHAR(MIDDLE_INIT) MIDDLE_INIT, TO_NCHAR(NAME_PREFIX) NAME_PREFIX, TO_NCHAR(NAME_SUFFIX) NAME_SUFFIX, TO_NCHAR(ADDRESS1) ADDRESS1, TO_NCHAR(ADDRESS2) ADDRESS2, -
TO_NCHAR(ADDRESS3) ADDRESS3, TO_NCHAR(CITY) CITY, TO_NCHAR(STATE) STATE, COUNTRY COUNTRY, ZIP ZIP, ZIP ZIP, ZIP5 ZIP5, HOME_PHONE HOME_PHONE, AREA_CODE AREA_CODE, -
AREA_CODE_EXCHNG AREA_CODE_EXCHNG, WORK_PHONE WORK_PHONE, DATE_OF_BIRTH DATE_OF_BIRTH, GENDER_CD GENDER_CD, INSTORE_CONTACT_EMPKEY INSTORE_CONTACT_EMPKEY, -
LAST_TRANSACTION_TIME LAST_TRANSACTION_TIME, LAST_TRANS_AMT LAST_TRANS_AMT, LAST_RETAIL_TRANS_TIME LAST_RETAIL_TRANS_TIME, LAST_CATALOG_TRANS_TIME LAST_CATALOG_TRANS_TIME, -
LAST_INTERNET_TRANS_TIME LAST_INTERNET_TRANS_TIME, LIFETIME_AMT LIFETIME_AMT, LIFETIME_RETAIL_AMT LIFETIME_RETAIL_AMT, LIFETIME_CATALOG_AMT LIFETIME_CATALOG_AMT, -
LIFETIME_INTERNET_AMT LIFETIME_INTERNET_AMT, LIFETIME_UNIT_CNT LIFETIME_UNIT_CNT, LIFETIME_RETAIL_UNIT_CNT LIFETIME_RETAIL_UNIT_CNT, LIFETIME_CATALOG_UNIT_CNT LIFETIME_CATALOG_UNIT_CNT, -
LIFETIME_INTERNET_UNIT_CNT LIFETIME_INTERNET_UNIT_CNT, LIFETIME_RETURN_AMT LIFETIME_RETURN_AMT, LIFETIME_RETAIL_RETURN_AMT LIFETIME_RETAIL_RETURN_AMT, -
LIFETIME_CATALOG_RETURN_AMT LIFETIME_CATALOG_RETURN_AMT, LIFETIME_INTERNET_RETURN_AMT LIFETIME_INTERNET_RETURN_AMT, LIFETIME_RETURN_UNIT_CNT LIFETIME_RETURN_UNIT_CNT, -
LIFETIME_RETAIL_RTRN_UNIT_CNT LIFETIME_RETAIL_RTRN_UNIT_CNT, LIFETIME_CATALOG_RTRN_UNIT_CNT LIFETIME_CATALOG_RTRN_UNIT_CNT, LIFETIME_INTERNT_RTRN_UNIT_CNT LIFETIME_INTERNT_RTRN_UNIT_CNT, -
LIFETIME_VISIT_CNT LIFETIME_VISIT_CNT, LIFETIME_RETAIL_VISIT_CNT LIFETIME_RETAIL_VISIT_CNT, LIFETIME_CATALOG_VISIT_CNT LIFETIME_CATALOG_VISIT_CNT, -
LIFETIME_INTERNET_VISIT_CNT LIFETIME_INTERNET_VISIT_CNT, LIFETIME_RTRN_VISIT_CNT LIFETIME_RTRN_VISIT_CNT, LIFETIME_RETAIL_RTRN_VISIT_CNT LIFETIME_RETAIL_RTRN_VISIT_CNT, -
LIFETIME_CATALG_RTRN_VISIT_CNT LIFETIME_CATALG_RTRN_VISIT_CNT, LIFETIME_INTRNT_RTRN_VISIT_CNT LIFETIME_INTRNT_RTRN_VISIT_CNT, LAST_CONTACT_DATE LAST_CONTACT_DATE, -
LAST_CONTACT_TYPE LAST_CONTACT_TYPE, LAST_CATALOG_SENT_DATE LAST_CATALOG_SENT_DATE, LIFETIME_CATALOG_SENT_CNT LIFETIME_CATALOG_SENT_CNT, PRIVATE_CC_ACCT_NUM PRIVATE_CC_ACCT_NUM, -
PRIVATE_CC_FIRST_USE_DATE PRIVATE_CC_FIRST_USE_DATE, PRIVATE_CC_ACCT_BALANCE PRIVATE_CC_ACCT_BALANCE, PRIVATE_CC_LIMIT_AMT PRIVATE_CC_LIMIT_AMT, PRIVATE_CC_LIMIT_SET_DATE PRIVATE_CC_LIMIT_SET_DATE, -
PRIVATE_CC_LIMIT_EXPIRES_DATE PRIVATE_CC_LIMIT_EXPIRES_DATE, PRIVATE_CC_NUM_CARDS_ISSUED PRIVATE_CC_NUM_CARDS_ISSUED, PRIVATE_CC_JC_FIRST_NAME PRIVATE_CC_JC_FIRST_NAME, -
PRIVATE_CC_JC_MIDDLE_INIT PRIVATE_CC_JC_MIDDLE_INIT, PRIVATE_CC_JC_LAST_NAME PRIVATE_CC_JC_LAST_NAME, PRIVATE_CC_APP_STORE_KEY PRIVATE_CC_APP_STORE_KEY, -
ALT_ACCT_NUMBER ALT_ACCT_NUMBER, SOCIAL_SEC SOCIAL_SEC, COMPANY_NAME COMPANY_NAME, BUSINESS_TITLE BUSINESS_TITLE, HOW_DID_YOU_HEAR_CD HOW_DID_YOU_HEAR_CD, -
HOW_DID_YOU_HEAR_EFF_DATE HOW_DID_YOU_HEAR_EFF_DATE, PREFERRED_PROMO_METHOD_CD PREFERRED_PROMO_METHOD_CD, PREF_CUST_STATUS1_CD PREF_CUST_STATUS1_CD, PREF_CUST_STATUS1_EFF_DATE PREF_CUST_STATUS1_EFF_DATE, -
PREF_CUST_STATUS2_CD PREF_CUST_STATUS2_CD, PREF_CUST_STATUS2_EFF_DATE PREF_CUST_STATUS2_EFF_DATE, PREF_CUST_STATUS3_CD PREF_CUST_STATUS3_CD, PREF_CUST_STATUS3_EFF_DATE PREF_CUST_STATUS3_EFF_DATE, -
EMAIL_ADDR EMAIL_ADDR, COUNTRY_CD COUNTRY_CD');--
Thank you,
DavidI am not familiar with this. How would you recommend doing this?
David -
Move index to a different tablespace using dbms_redefinition?
Hi all, I am trying to move indexes to new tablespaces. Can I use oracle built-in package DBMS_REDEFINITION for this? As far as I know dbms_redefinitoin only works for tables rebuilt online? I am running 10.2.0.5 on linux red hat, and the index sizes from 100MB to 10gb. Thank you in advance all.
Since one can seamlessly move an index from one tablespace to another by simply doing:
SQL> alter index <index_name> rebuild tablespace <tablespace_name>;even considering DBMS_REDEFINITION for this makes no sense at all.
If your boss has any further questions, show him the Oracle documentation:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_redefi.htm
Quote from that page:
"The DBMS_REDEFINITION package provides an interface to perform an *online redefinition of tables*."
(Emphasis added by me.)
Hope that helps,
-Mark -
Use of DBMS_REDEFINITION Package with Goldengate
All,
I am currently using OGG 11.2.1.0.4 in an active-passive configuration and have an opportunity where I need to re-partition a table due to performance reasons. Given my up-time requirements, using the DBMS_REDEFINITION package seems to be a really good option. I am concerned as to how this would work with Goldengate. I do not currently use DDL replication with this extract/pump/replicat, but would this be the way to use this package and do the REDEFINITION simultaneously on both sides? Is there a better way?
I haven't found anything online pertaining to the use of this package and Goldengate so I am hoping this forum can help out.
Thanks!From the 11.2 admin guide:
Create an empty interim table (in the same schema as the table to be redefined) with all of the desired logical and physical attributes. If columns are to be dropped, do not include them in the definition of the interim table. If a column is to be added, then add the column definition to the interim table. If a column is to be modified, create it in the interim table with the properties that you want.The table being redefined remains available for queries and DML during the entire process.
Execute the FINISH_REDEF_TABLE procedure to complete the redefinition of the table. During this procedure, the original table is locked in exclusive mode for a very short time, independent of the amount of data in the original table. However, FINISH_REDEF_TABLE will wait for all pending DML to commit before completing the redefinition.>
If you did not want to create an interim table, then this approach is not going to work for you. There is no requirement for you to create anything other than the interim table, and any dependent objects can be done automatically, including materialized views. Where did you see that you have to create mview logs? -
Error running DBMS_REDEFINITION.copy_table_dependents!!!
Hi,
When i run DBMS_REDEFINITION.copy_table_dependents package i am getting the following error.
Error at line 1
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_REDEFINITION", line 233
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1952
ORA-06512: at line 4Can anyone share with me what are all the privileges are required to run this procedure.
Thankshi
I had given the following permissions
grant execute on dbms_redefinition to apps with grant option
grant CREATE TABLE, CREATE SEQUENCE, CREATE VIEW, CREATE PROCEDURE TO apps
GRANT ALTER ANY TABLE, CREATE ANY TABLE, DROP ANY TABLE, LOCK ANY TABLE, SELECT ANY TABLE TO APPSPlease let me know if i need to add anymore
Thanks -
Error with dbms_redefinition package?
Hi everybody!
I have a table ‘object_log’(it is partioned) .
I used dbms_redefinition to change its partion , and evrythink was ok.
When I tried to redefine this table for the second time it failed!
I run this script
BEGIN
DBMS_REDEFINITION.start_redef_table(
uname => 'TL_ETL',
orig_table => 'OBJECT_LOG',
int_table => 'OBJECT_LOG2');
END;
This is the error:
Ora-12008 error in materialized view refresh pathSorry, I didn'see the other errors
evrything is clear now :)
ORA-12008: error in materialized view refresh path
ORA-14400: inserted partition key does not map to any partition
ORA-06512: at "SYS.DBMS_REDEFINITION", line 50
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1343
ORA-06512: at line 2 -
Dbms_redefinition used to convert a non partitioned table to partitioned
A table is created with below DDL
CREATE TABLE TEST1("EQUIPMENT_DIM_ID" NUMBER(9,0) NOT NULL ENABLE,
"CARD_DIM_ID" NUMBER(9,0),
"NH21_DIM_ID" NUMBER(5,0) NOT NULL ENABLE);
Interim table created with
CREATE TABLE INTERIM("EQUIPMENT_DIM_ID" NUMBER(9,0) NOT NULL ENABLE,
"CARD_DIM_ID" NUMBER(9,0),
"NH21_DIM_ID" NUMBER(5,0) NOT NULL ENABLE);
PARTITION BY RANGE ("EQUIPMENT_DIM_ID")
(PARTITION "P0" VALUES LESS THAN (1)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) NOCOMPRESS ,
PARTITION "P1" VALUES LESS THAN (2)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) NOCOMPRESS ,
Performed dbms_Redefinition (start,sync and finish) to get the table test1 data from nonpartitioned to partitioned one. At the end of table conversion, dbms_metadata.get_ddl shows like below
CREATE TABLE TEST("EQUIPMENT_DIM_ID" NUMBER(9,0) CONSTRAINT "SYS_C005605" NOT NULL ENABLE,
"CARD_DIM_ID" NUMBER(9,0),
"NH21_DIM_ID" NUMBER(5,0) CONSTRAINT "SYS_C005601" NOT NULL ENABLE);
PARTITION BY RANGE ("EQUIPMENT_DIM_ID")
(PARTITION "P0" VALUES LESS THAN (1)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) NOCOMPRESS ,
PARTITION "P1" VALUES LESS THAN (2)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) NOCOMPRESS
Can you help me how to hide or remove the "CONSTRAINT "SYS_C005605"" etc section showing in ddl for the table?The reason being if take this ddl definition and load in another database where it can give error in case same named constraint already exist.
Many thanks
Regards
Manoj Thakkan
Oracle DBA
BangaloreCreate your NOT NULL check constraints using ALTER TABLE and name them as you would a primary or foreign key ... with a name that makes sense.
I personally have a strong dislike for system generated naming and would be thrilled if this lazy practice of defining columns as NOT NULL during table creation went away. -
Dbms_redefinition.start_redef_table -- error
While Redefining below , I got the error . Could you please help what I am missing
exec dbms_redefinition.start_redef_table('uname','orig table','interim table',NULL,2);
ORA-12008: error in materialized view refresh path
ORA-01114: IO error writing block to file (block # )
ORA-01114: IO error writing block to file 6 (block # 1693811)
ORA-29701: unable to connect to Cluster Synchronization Service
ORA-06512: at "SYS.DBMS_REDEFINITION", line 52
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1646
ORA-06512: at line 1
select * from v$version
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Thanks ,
MaheshMahesh wrote:
While Redefining below , I got the error . Could you please help what I am missing
exec dbms_redefinition.start_redef_table('uname','orig table','interim table',NULL,2);
ORA-12008: error in materialized view refresh path
ORA-01114: IO error writing block to file (block # )
ORA-01114: IO error writing block to file 6 (block # 1693811)
ORA-29701: unable to connect to Cluster Synchronization ServiceOS fatal flaw
what clues exist within system "messages" file.
post results of OS command below
df -k -
DBMS_REDEFINITION problem!!
Hi,
We are trying to sub partition(on id field) a already partitioned(on date field) table having 1.8Billions (255GB approax) of records.
We are using DBMS_Redefinition package to do so. Initially, it was failed due to the shortage of space in temp (we increased the size to 320GB). After doing so, the temp space exhaust problem was eliminated.
Now we are facing the following problem:-
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-04030: out of process memory when trying to allocate 65560 bytes
(klcliti:kghds,kdblc memory)
ORA-06512: at "SYS.DBMS_REDEFINITION", line 52
ORA-06512: at "SYS.DBMS_REDEFINITION", line 1646
ORA-06512: at line 2
We have increased the memory target to 31G. but no gain.
We have the following ulimit settings:-
!ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 299007
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 32768
cpu time (seconds, -t) unlimited
max user processes (-u) 16384
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
What needs to be done to redefine the table .
Is there any other method which does the same things quickly.
Please suggest.
Thanks in advance,
Regards,
AmitHi
You may try to set the workarea_size_policy=MANUAL and then set sort_area_size and hash_area_size to a nice size at session level and do the dbms_redefinition
Alter session set workarea_size_policy=MANUAL;
Alter session set sort_area_size=209715200;
Alter session set hash_area_size=209715200;
Do dbms_redefinition...now
Remember. Untunable part of PGA can make a process exceed the max threshold of a PGA per process limit and go all the way to blow up the physical RAM causing ORA-4030. -
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
-
Partitioning an Existing Table using DBMS_REDEFINITION with no primary key?
HI,
Is it possible to partiiton a table with dbms_redefination if the table contains no primary key?
DB version 10.2
Thank you All..Yes, of course, but you'll have to use rowID with "CONS_USE_ROWID" : http://68.142.116.68/docs/cd/B19306_01/appdev.102/b14258/d_redefi.htm#CBBFDJBC
This will be longer but it is possible. -
Dbms_redefinition package and COMPRESS attribute of the target table
Hi experts,
we have an already partitioned and compressed table under Oracle 10g R2 wich we want to move to another tablespace using online redefinition.
The table should keep the Partitions and compressed data after the move.
My question is: How much storage we must have in place for the move of the table ?
Example:
tab (compressed size) : 1000 MB
tab (uncompressed size) : 4000 MB
Seems it depends on how redefinition handles the move of the compressed data.
So if redefinition uses INSERT /* APPEND */ .... is should be roundabout 1000 MB ("compress during write")
Is this assumption correct ?
Can anybody shed some light on redefinition wich kind of compression-conserving stragetgy it uses ?
bye
BBFrom the 11.2 admin guide:
Create an empty interim table (in the same schema as the table to be redefined) with all of the desired logical and physical attributes. If columns are to be dropped, do not include them in the definition of the interim table. If a column is to be added, then add the column definition to the interim table. If a column is to be modified, create it in the interim table with the properties that you want.The table being redefined remains available for queries and DML during the entire process.
Execute the FINISH_REDEF_TABLE procedure to complete the redefinition of the table. During this procedure, the original table is locked in exclusive mode for a very short time, independent of the amount of data in the original table. However, FINISH_REDEF_TABLE will wait for all pending DML to commit before completing the redefinition.>
If you did not want to create an interim table, then this approach is not going to work for you. There is no requirement for you to create anything other than the interim table, and any dependent objects can be done automatically, including materialized views. Where did you see that you have to create mview logs? -
Negative effects by using DBMS_REDEFINITION package
Hello everybody,
I am looking for all 'bad' side effects of using the package.
I am in project where the definition of tables changes.
Sometimes a column needs to be placed in the middle of the table.
Up to now there are scripts which doing a lot of drops of columns, updates, add adds again.
My idea was to use the package, which I could test successfully.
Now I learned, that the grants to the table are lost.
What else should be concerned by using the package?
ThanksHi,
Sometimes a column needs to be placed in the middle of the table.hmm and why do you need some redefinition/reorg for the table - just put the columns on the right place in the select statement?
Now I learned, that the grants to the table are lost.hmm not "really"... have a look at the procedure "COPY_TABLE_DEPENDENTS".
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_redefi.htm#sthref5656
-> This subprogram is used to clone the dependent objects like grants, triggers, constraints and privileges from the table being redefined to the interim table (which represents the post-redefinition table).
Side effects:
You need to create/rebuild the indexes.. because of the rowids change.
Btw. your scenario seems a little bit "strange" to me...
Regards
Stefan
Maybe you are looking for
-
CoPilot will not upgrade due to lack of space on iPhone
This issue is occuring on both a 3G and 3Gs phone that we own. I have read on forums outside of here that others are having the same issue. When I origally tried to install CoPilot it told me there was not enough free space to install the 1.3g app. M
-
1. Strengths in technical subject ? 2. Explain best report which u did ? 3. Major events of reports ? 4. Difference between interactive and classical reports ? 5. Types of BDCs 6. If you say session than why ? 7. If you s
-
Adf bc jar for base entity classes and extending them existing project
Hi, I am using jdev 11.1.1.0 and have created a base workspace/project and adf jar for my base entity classes. 1. I can consume this base adf bc jar in a separate new consuming workspace and create VO based on base bc classes or create new EOs that e
-
Embedded OWD interview within a Siebel applet using a Symbolic URL
I'm trying to embed the actual Web Determinations interview within a Siebel applet (this will allow our internal Siebel users to use the exact same interview as is avialable to external users). I'm using Siebel OOB Symoblic URL Configuration within a
-
Exporting video as frames?
I would like to export a video as a series of frames (aka separate still image files) in order to draw over them in Flash to create an animation. I have Final Cut Pro 7 and I have access to all Adobe software. Please help as I really cannot find this