Oracle 12.2 使用Database Link優化Standby Database Workload
從Oracle 12.2開始,可以通過在database_link_to引數來指定一個資料庫鏈路來優化備庫workload。由於安全原因,Oracle建議使用私有資料庫鏈路。這個鏈路必須屬於sys使用者並且能讓有許可權的使用者來訪問。Oracle資料庫包含一個預設的許可權使用者名稱為SYS$UMF。
在主庫中使用sys使用者建立表t1與配置sys$umf使用者,這個使用者預設是被鎖定的,所以需要先解鎖這個使用者並設定密碼:
SQL> alter user sys$umf account unlock identified by xxzx7817600; User altered. SQL>create table t1 as select * from user_tables; Table created. SQL> create index idx_t1_tablename on t1(table_name); Index created. SQL> exec dbms_stats.gather_table_stats('sys','t1',degree => 4,cascade => true); PL/SQL procedure successfully completed.
建立一個備庫(cs_dg)到主庫的鏈路,由於ADG是隻讀的,所以建立資料庫鏈路操作都需要在主庫中執行:
SQL> create database link cs_dg2_to_cs2 connect to sys$umf identified by abcd1234 using 'CS'; Database link created.
在備庫中驗證資料庫鏈路是否建立成功
col owner for a20 SQL> col object_name for a50 SQL> select owner,object_name from dba_objects where object_type='DATABASE LINK'; OWNER OBJECT_NAME -------------------- -------------------------------------------------- SYS CS_DG2_TO_CS2 SYS SYS_HUB SQL> select table_name from user_tables@cs_dg2_to_cs2; no rows selected SQL> select sysdate from dual@cs_dg2_to_cs2; SYSDATE ------------ 24-JAN-19
在備庫中對錶t1執行查詢,database_link_to引數用來指定備庫到主庫的資料鏈路名cs_dg2_to_cs2
SQL> variable tname varchar2(30); SQL> variable query varchar2(500); SQL> exec :tname := 'jy_task'; PL/SQL procedure successfully completed. SQL> exec :query := 'select /*+ full(t)*/ col1 from t1 t where table_name=''T1'''; PL/SQL procedure successfully completed. SQL> begin 2 :tname := dbms_sqltune.create_tuning_task 3 ( 4 sql_text => :query, 5 task_name => :tname, 6 database_link_to => 'CS_DG2_TO_CS2', 7 scope=>'COMPREHENSIVE', 8 time_limit=>60, 9 description=>'Task to tune a query_on adg'); 10 end; 11 / PL/SQL procedure successfully completed. SQL> exec dbms_sqltune.execute_tuning_task(:tname); PL/SQL procedure successfully completed. SQL> select dbms_sqltune.report_tuning_task(:tname) from dual; DBMS_SQLTUNE.REPORT_TUNING_TASK(:TNAME) -------------------------------------------------------------------------------- GENERAL INFORMATION SECTION ----------------------------------------------------
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2564690/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle12.2 adg ORA-46952: standby database format mismatch for password fileOracleDatabaseORM
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- Oracle DG Standby Database型別OracleDatabase型別
- Oracle DG建立Physical Standby DatabaseOracleDatabase
- Oracle DG建立Logical Standby DatabaseOracleDatabase
- Performing a Failover to a Physical Standby DatabaseORMAIDatabase
- 在Oracle DG Standby庫上啟用flashback database功能OracleDatabase
- Setup Standby Database on One PC(轉)Database
- Oracle Database Cloud - Database as a Service Quick StartOracleDatabaseCloudUI
- ORACLE database vaultOracleDatabase
- Oracle clone databaseOracleDatabase
- [20230110]sql profile run standby database.txtSQLDatabase
- Oracle Database Scheduler整理OracleDatabase
- Oracle Physical Database LimitsOracleDatabaseMIT
- [20210723]Database link and user defined datatypes.txtDatabase
- Oracle 19c透過recover standby database from service修復GAP案例OracleDatabase
- Oracle 12c DG備庫啟動報錯standby database requires recoveryOracleDatabaseUI
- 4 Creating a Logical Standby Database 建立邏輯備庫Database
- Oracle OCP(35):Database 安裝OracleDatabase
- oracle 10g flashback databaseOracle 10gDatabase
- Oracle 12.2 How to Generate AWRs in Active Data Guard Standby DatabasesOracleDatabase
- Oracle 12.2 physical standby備庫收集AWR報告Oracle
- 透過RMAN備份standby database成功恢復還原Database
- Oracle OCP(38):Database 物理結構OracleDatabase
- 關於Oracle Database Vault介紹OracleDatabase
- Scheduler in Oracle Database 10g(轉)OracleDatabase
- [翻譯]-Detect And Repair Corruption in an Oracle DatabaseAIOracleDatabase
- Oracle 19c Database Management ToolsOracleDatabase
- Oracle 19c Concepts(01):Introduction to Oracle DatabaseOracleDatabase
- Oracle 19c Concepts(13):Oracle Database InstanceOracleDatabase
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- Oracle 12C Database File Mapping for Oracle ASM FilesOracleDatabaseAPPASM
- Error querying database. XXXXXXXXXXXXX, No database selected。ErrorDatabase
- Oracle OCP(37):Database 體系結構OracleDatabase
- Converting Oracle Database from Linux to Windows using RMANOracleDatabaseLinuxWindows
- Oracle database 升級(文件)to 10.2.0.4 from 10.2.0.1OracleDatabase
- Migration Of An Oracle Database Across OS Platforms [ID 733205.1]OracleDatabaseROSPlatform
- Sqlcl 連線Oracle DataBase 19cSQLOracleDatabase