Monday, May 20, 2024

ORA-13792: This operation requires a database link

There could be other reasons for this message to appear while you are trying to execute something in a standby database (or perhaps on primary database), however, in my case, this message was returned when I was trying to create an SQL Tuning Advisor task and wanted to submit for advisor’s recommendations. While doing so, I did not realize that I was actually trying to execute this on physical standby database. Following is the entire error stack that was returned.

SQL> show pdbs 

  

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED 

---------- ------------------------------ ---------- ---------- 

         2 PDB$SEED                       READ ONLY  NO 

         3 MYPDB19                        READ ONLY  NO 

SQL> alter session set container=MYPDB19; 

  

Session altered. 

  

SQL> set serverout on 

DECLARE 

  tune_task_id  VARCHAR2(100); 

BEGIN 

  tune_task_id := DBMS_SQLTUNE.create_tuning_task ( 

                                                  begin_snap       => 10931, 

                                                  end_snap         => 10953, 

                                                  sql_id           => '380gmg2qcveet', 

                          scope       => DBMS_SQLTUNE.scope_comprehensive, 

                          time_limit  => 5000, 

                          task_name   => '380gmg2qcveet_task', 

                          description => 'Tuning task for 380gmg2qcveet'); 

  DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id); 

END; 

/ 

SQL>    

DECLARE 

* 

ERROR at line 1: 

ORA-13792: This operation requires a database link. 

ORA-06512: at "SYS.DBMS_SQLTUNE_UTIL1", line 1646 

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79 

ORA-06512: at "SYS.DBMS_SQLTUNE_UTIL1", line 1638 

ORA-06512: at "SYS.DBMS_SQLTUNE", line 826 

ORA-06512: at line 4 


Initially I was quite perplexed until I realized that I was trying to execute this on physical standby database. 

Then I connected to the primary database and I was successfully able to submit tuning task.

Be careful! and always connect to the right database whenever you want to perform any task.  

No comments:

Post a Comment

Popular Posts - All Times