...
b- If the WA005_PROCESS_LOG was renamed to WA005_PROCESS_LOG_ARCHIVE_(CURRENT MONTH)_(CURRENT YEAR) and the WA005_PROCESS_LOG was re-created then fix the problem and undo the renamed by running the code below:
Script to run---
Code Block | ||
---|---|---|
| ||
DROP table WA005_PROCESS_LOG cascade constraints; |
...
ALTER TABLE camis. WA005_PROCESS_LOG_ARCHIVE_(CURRENT MONTH)_(CURRENT YEAR) RENAME TO WA005_PROCESS_LOG; |
...
--------rename INDEXES and CONSTRAINT back--------- |
...
ALTER INDEX WA005_PK_b RENAME TO WA005_PK; |
...
ALTER INDEX WA005_IE1_b RENAME TO WA005_IE1; |
...
ALTER INDEX WA005_IE2_b RENAME TO WA005_IE2; |
...
ALTER TABLE camis.WA005_PROCESS_LOG rename constraint WA005_PK_b to WA005_PK; |
...
----Create triggers----------------------------- |
...
CREATE OR REPLACE TRIGGER CAMIS.WA005_TG1_BI_PROCESS_LOG_ID |
...
BEFORE INSERT |
...
ON CAMIS.WA005_PROCESS_LOG |
...
REFERENCING OLD AS OLD NEW AS NEW |
...
FOR EACH ROW |
...
BEGIN |
...
-- IF :NEW.process_log_id IS NULL THEN |
...
SELECT WA005_SQ1_BI_PROCESS_LOG_ID.NEXTVAL |
...
INTO :NEW.PROCESS_LOG_ID |
...
FROM DUAL; |
...
-- END IF; |
...
END; |
...
/
...
/ CREATE OR REPLACE TRIGGER CAMIS.WA005_TG1_BU_DATE_LAST_UPDATE |
...
BEFORE UPDATE |
...
ON CAMIS.WA005_PROCESS_LOG |
...
REFERENCING OLD AS OLD NEW AS NEW |
...
FOR EACH ROW |
...
DECLARE |
...
BEGIN |
...
:NEW.DATE_LAST_UPDATE_DTE := SYSDATE; |
...
END; |
...
/ |
...
--SYNONYMS---- |
...
CREATE OR REPLACE SYNONYM CAMIS_ANALYST.WA005_PROCESS_LOG FOR CAMIS.WA005_PROCESS_LOG; |
...
...
CREATE OR REPLACE SYNONYM CAMIS_DATA_ADMIN.WA005_PROCESS_LOG FOR CAMIS.WA005_PROCESS_LOG; |
...
...
CREATE OR REPLACE SYNONYM CAMIS_DUI.WA005_PROCESS_LOG FOR CAMIS.WA005_PROCESS_LOG; |
...
--GRANTS---- |
...
GRANT SELECT ON CAMIS.WA005_PROCESS_LOG TO CAMIS_ANALYST; |
...
GRANT DELETE, INSERT, SELECT, UPDATE ON CAMIS.WA005_PROCESS_LOG TO CAMIS_DATA_ADMIN; |
...
GRANT SELECT ON CAMIS.WA005_PROCESS_LOG TO CAMIS_DUI WITH GRANT OPTION; |
...
GRANT DELETE, INSERT, UPDATE ON CAMIS.WA005_PROCESS_LOG TO CAMIS_DUI; |
...
...
GRANT DELETE, INSERT, SELECT, UPDATE ON CAMIS.WA005_PROCESS_LOG TO CAMIS_EMER; |
...
GRANT DELETE ON CAMIS.WA005_PROCESS_LOG TO CAMIS_EXTB; |
...
---for the previous backup table, the one that existed before running the Oracle job, |
...
---check if there are no indexes, constraint, synonyms or grants and recreate them as follow: |
...
CREATE UNIQUE INDEX CAMIS.WA005_PK_B ON CAMIS. WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE)(PROCESS_LOG_ID); |
...
ALTER TABLE CAMIS.WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE) ADD ( |
...
CONSTRAINT WA005_PK_b |
...
PRIMARY KEY |
...
(PROCESS_LOG_ID) |
...
USING INDEX CAMIS.WA005_PK_b |
...
ENABLE VALIDATE); |
...
CREATE INDEX CAMIS.WA005_IE1_b ON CAMIS.WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE) |
...
(DATE_LAST_UPDATE_DTE); |
...
CREATE INDEX CAMIS.WA005_IE2_b ON CAMIS.WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE) |
...
(PROCESS_NAME_NM); |
...
...
--SYNONYMS for the previous backup table ---- |
...
CREATE OR REPLACE SYNONYM CAMIS_ANALYST.WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE) FOR CAMIS.WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE); |
...
...
CREATE OR REPLACE SYNONYM CAMIS_DATA_ADMIN.WA005_PROCESS_LOG_ARCHIVE_(PREVIOUS_BACKUP TABLE) FOR CAMIS.WA005_PROCESS_LOG_ (PREVIOUS_BACKUP TABLE); |
c- Nothing was updated. Again, make sure to know exactly where the program failed and fix the problem.
...