"There is a problem with your environment because the Application Express files are not up-to-date!" Error After Upgrading APEX
On my Autonomouse Database i got this error..
Oracle Support.. : "There is a problem with your environment because the Application Express files are not up-to-date!" Error After Upgrading APEX in the Database (Doc ID 2932174.1)”
And Solutions for Autonomouse
So i decided to create an scheduler job:
But not within an Procedure is it allowed.
CREATE OR REPLACE PROCEDURE update_apex_image_prefix AS
v_current_prefix VARCHAR2(255);
v_new_version VARCHAR2(20);
v_new_prefix VARCHAR2(255);
BEGIN
-- Get the latest APEX version
SELECT version_no
INTO v_new_version
FROM APEX_RELEASE
ORDER BY version_no DESC
FETCH FIRST 1 ROWS ONLY;
-- Construct the new IMAGE_PREFIX value
v_new_prefix := 'https://static.oracle.com/cdn/apex/' || v_new_version || '/';
-- Get the current IMAGE_PREFIX
SELECT APEX_INSTANCE_ADMIN.get_parameter(p_parameter => 'IMAGE_PREFIX')
INTO v_current_prefix
FROM dual;
-- Check if the IMAGE_PREFIX needs to be updated
IF v_current_prefix != v_new_prefix THEN
-- Update the IMAGE_PREFIX if it's different
APEX_INSTANCE_ADMIN.set_parameter(
p_parameter => 'IMAGE_PREFIX',
p_value => v_new_prefix
);
COMMIT;
END IF;
END;
/
I got this error if i create a procedure..
LINE/COL ERROR
--------- -------------------------------------------------------------
17/5 PL/SQL: SQL Statement ignored
17/12 PL/SQL: ORA-01031: Keine ausreichenden Berechtigungen
24/9 PL/SQL: Statement ignored
24/9 PLS-00904: Ihre Berechtigungen reichen nicht aus, um auf Objekt PUBLIC.APEX_INSTANCE_ADMIN zuzugreifen
trying it in dbms_scheduler as plsql block it works:
HAAPY IMAGE S
-- Step 2: Create the Scheduler job to run the procedure regularly
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'update_apex_image_prefix_job',
job_type => 'PLSQL_BLOCK',
job_action => q'#declare
v_current_prefix VARCHAR2(255);
v_new_version VARCHAR2(20);
v_new_prefix VARCHAR2(255);
BEGIN
-- Get the latest APEX version
SELECT version_no
INTO v_new_version
FROM APEX_RELEASE
ORDER BY version_no DESC
FETCH FIRST 1 ROWS ONLY;
-- Construct the new IMAGE_PREFIX value
v_new_prefix := 'https://static.oracle.com/cdn/apex/' || v_new_version || '/';
-- Get the current IMAGE_PREFIX
SELECT APEX_INSTANCE_ADMIN.get_parameter(p_parameter => 'IMAGE_PREFIX')
INTO v_current_prefix
FROM dual;
-- Check if the IMAGE_PREFIX needs to be updated
-- IF v_current_prefix != v_new_prefix THEN
-- Update the IMAGE_PREFIX if it's different
APEX_INSTANCE_ADMIN.set_parameter(
p_parameter => 'IMAGE_PREFIX',
p_value => v_new_prefix
);
COMMIT;
-- END IF;
dbms_output.put_line('YES');
END;#',
start_date => SYSTIMESTAMP,
repeat_interval => 'FREQ=DAILY; BYHOUR=2', -- Runs daily at 2 AM; adjust as needed
enabled => TRUE
);
END;
/