Thursday, 1 March 2018

TABLE COLUMNS MISMATCHING FROM PROD instance to Other NON PROD instances.(TABLE Mismatch with VIEW and SYNONYM):

TABLE COLUMNS MISMATCHING FROM PROD instance to Other NON PROD instances.(TABLE Mismatch with VIEW and SYNONYM):


Here are the steps to have TABLE COLUMNS same as VIEW and SYNONYM with some example.

Example:
========
create table :

create table XXPETS.XXRSC_TEST_DEMO_TAB
(
EMPID NUMBER,
ENAME VARCHAR2(30);
SALARY NUMBER
);

check table creation:

select * from dba_objects where object_name like 'XXRSC_TEST_DEMO_TAB%';

create SYNONYM and EDITION VIEW for the TABLE:


begin
ad_zd_table.upgrade('XXPETS', 'XXRSC_TEST_DEMO_TAB');     --- Object owner  , table name are paremeters.
end;

Note:ad_zd_table.upgrade --> it will create EDITION VIEW and SYNONYM


check whether all objects created or not:

select * from dba_objects where object_name like 'XXRSC_TEST_DEMO_TAB%';

Add new column to the table:

alter table  XXPETS.XXRSC_TEST_DEMO_TAB add NEW_SAL NUMBER;


check the new column presence in TABLE and VIEW:

select * from XXPETS.XXRSC_TEST_DEMO_TAB;

select * from XXPETS.XXRSC_TEST_DEMO_TAB#;

Note: Here latest column that you added will not be visible in APPS or VIEW, Because you only added column to the Schema that is XXPETS.XXRSC_TEST_DEMO_TAB.
      we need to explictly sync TABLE with SYNONYM and VIEW.


Run the below script to Refresh the Editioning View

begin
ad_zd_table.patch('XXPETS', 'XXRSC_TEST_DEMO_TAB');     --- Object owner  , table name are paremeters.
end;
/