Oracle 12.2 How to Generate AWRs in Active Data Guard Standby Databases
從Oralce 12.2開始, 可以對Active Data Guard(ADG) standby database捕獲AWR資料。這個功能可以對ADG備庫的效能問題執行分析。在下面的例子中主庫與備庫都是兩節點的RAC(db_name=cs)。主庫(db_unique_name=cs),備庫(db_unique_name=cs_dg)分別執行在cs1,cs2與jytest1,jytest2節點上。
1對備庫確認資料庫的open mode與database role
SQL> select inst_id, open_mode, database_role from gv$database order by 1; INST_ID OPEN_MODE DATABASE_ROLE ---------- -------------------- ---------------- 1 READ ONLY WITH APPLY PHYSICAL STANDBY 2 READ ONLY WITH APPLY PHYSICAL STANDBY
2.在主庫中對sys$umf使用者解鎖並設定密碼,因為sys$umf使用者預設是被鎖定的。sys$umf使用者是預設的資料庫使用者它有訪問系統級別遠端管理框架(RMF)檢視與表的所有許可權。在RMF中所有AWR相關的操作只能通過sys$umf使用者來執行。
SQL> alter user sys$umf account unlock identified by xxzx7817600; User altered.
3.建立兩個dblink,一個是從主庫到備庫(cs_to_cs_dg),另一個是從備庫到主庫(cs_dg_to_cs)。但因為ADG庫是隻讀的,所以建立dblink的操作都需要在主庫執行
SQL> create database link cs_to_cs_dg connect to sys$umf identified by xxzx7817600 using 'cs_dg'; Database link created. SQL> create database link cs_dg_to_cs connect to sys$umf identified by xxzx7817600 using 'cs'; Database link created.
4.需要將資料庫節點配置到拓樸(topology)結構中,在拓樸結構中的每個資料庫節點必須被指定一個唯一名(預設值為db_unique_name),在這個例子中主庫為cs,備庫為cs_dg,在主庫中執行以下命令
SQL> exec dbms_umf.configure_node ('cs'); PL/SQL procedure successfully completed.
5.在備庫中執行以下命令,通過備庫到主庫的鏈路名來進行註冊
SQL> exec dbms_umf.configure_node ('cs_dg','CS_DG_TO_CS'); PL/SQL procedure successfully completed.
6.建立RMF拓樸,在主庫中執行以下命令
SQL> exec dbms_umf.create_topology ('topology_1'); PL/SQL procedure successfully completed.
7.執行以下語句來對上面的操作進行驗證
SQL> set line 132 SQL> col topology_name format a15 SQL> col node_name format a15 SQL> select * from dba_umf_topology; TOPOLOGY_NAME TARGET_ID TOPOLOGY_VERSION TOPOLOGY --------------- ---------- ---------------- -------- topology_1 1789571709 1 ACTIVE SQL> select * from dba_umf_registration; TOPOLOGY_NAME NODE_NAME NODE_ID NODE_TYPE AS_SO AS_CA STATE --------------- --------------- ---------- ---------- ----- ----- -------------------- topology_1 cs 1789571709 0 FALSE FALSE OK
8.向拓樸中註冊備庫,在主庫中執行下面的命令
SQL> exec dbms_umf.register_node ('topology_1', 'cs_dg', 'CS_TO_CS_DG', 'CS_DG_TO_CS', 'FALSE', 'FALSE'); PL/SQL procedure successfully completed.
9.在主庫上執行下面的操作把拓撲的ADG庫cs_dg的AWR service開啟:
SQL> exec dbms_workload_repository.register_remote_database(node_name=>'cs_dg'); PL/SQL procedure successfully completed.
如果遇到“ORA-15766: already registered in an RMF topology" 那麼要先執行DBMS_UMF.unregister_node清除註冊的節點然而再次執行DBMS_UMF.register_node來註冊節點
如果遇到"ORA-13519: Database id (1730117407) exists in the workload repository"那麼要先執行DBMS_WORKLOAD_REPOSITORY.unregister_remote_database清除遠端資料庫然後再次執行
DBMS_WORKLOAD_REPOSITORY.register_remote_database註冊遠端資料庫。
10.配置ADG的AWR功能就做完了,可以檢查相關檢視來驗證這個拓撲配置
SQL> set line 132 SQL> col topology_name format a15 SQL> col node_name format a15 SQL> select * from dba_umf_topology; TOPOLOGY_NAME TARGET_ID TOPOLOGY_VERSION TOPOLOGY --------------- ---------- ---------------- -------- topology_1 1789571709 4 ACTIVE SQL> select * from dba_umf_registration; TOPOLOGY_NAME NODE_NAME NODE_ID NODE_TYPE AS_SO AS_CA STATE --------------- --------------- ---------- ---------- ----- ----- -------------------- topology_1 cs 1789571709 0 FALSE FALSE OK topology_1 cs_dg 2145432700 0 FALSE FALSE OK SQL> select * from dba_umf_link; TOPOLOGY_NAME FROM_NODE_ID TO_NODE_ID LINK_NAME --------------- ------------ ---------- ---------------------------------------- topology_1 2145432700 1789571709 CS_DG_TO_CS topology_1 1789571709 2145432700 CS_TO_CS_DG SQL> select * from dba_umf_service; TOPOLOGY_NAME NODE_ID SERVICE --------------- ---------- ------- topology_1 2145432700 AWR
11.這時候每當預設生成AWR snapshot時,主庫與ADG庫會同時生成。如果要手工生成ADG的AWR快照,可以在主庫中執行下面的命令(引數值為ADG庫的node_id或node_name)
SQL> exec dbms_workload_repository.create_remote_snapshot(2145432700); PL/SQL procedure successfully completed. SQL> exec dbms_workload_repository.create_remote_snapshot('cs_dg'); PL/SQL procedure successfully completed.
至少要執行兩次命令來得到快照的begin_snap和end_snap。如果遇到 "ORA-13516: AWR Operation failed:Remote source not registered for AWR" 那麼需要對主庫執行alter system switch logfile命令
再切換日誌檔案兩到三次。
12.如果要生成ADG庫的AWR report,可以執行下面的操作:
SQL> @$ORACLE_HOME/rdbms/admin/awrrpti.sql Specify the Report Type ~~~~~~~~~~~~~~~~~~~~~~~ AWR reports can be generated in the following formats. Please enter the name of the format at the prompt. Default value is 'html'. 'html' HTML format (default) 'text' Text format 'active-html' Includes Performance Hub active report Enter value for report_type: html Type Specified: html Instances in this Workload Repository schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DB Id Inst Num DB Name Instance Host ------------ ---------- --------- ---------- ------ 1386528187 1 CS cs1 cs1.jy.net 1386528187 2 CS cs2 cs2.jy.net 2145432700 1 CS cs1 jytest1.jydb 2145432700 2 CS cs2 jytest2.jydb Enter value for dbid: 2145432700 這裡需要指定備庫的dbid Using 2145432700 for database Id Enter value for inst_num: 2 這裡指定備庫的例項ID Using 2 for instance number Specify the number of days of snapshots to choose from ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Entering the number of days (n) will result in the most recent (n) days of snapshots being listed. Pressing without specifying a number lists all completed snapshots. Enter value for num_days: 1 Listing the last day's Completed Snapshots Instance DB Name Snap Id Snap Started Snap Level ------------ ------------ ---------- ------------------ ---------- cs2 CS 1 24 Jan 2019 23:50 1 2 24 Jan 2019 23:51 1 Specify the Begin and End Snapshot Ids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Enter value for begin_snap: 1 Begin Snapshot Id specified: 1 Enter value for end_snap: 2 End Snapshot Id specified: 2 Specify the Report Name ~~~~~~~~~~~~~~~~~~~~~~~ The default report file name is awrrpt_2_1_2.html. To use this name, press to continue, otherwise enter an alternative. Enter value for report_name: /home/oracle/cs_dg_1_2.html Using the report name /home/oracle/cs_dg_1_2.html
下面是一個ADG庫的AWR report的例子,可以看到資料庫的Role為PHYSICAL STANDBY。
Oracle 12.2在Active Dataguard上引入AWR功能,可以讓Active dataguard的資料庫效能診斷更加容易。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2564691/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【DG】Data Guard搭建(physical standby)
- 【mos 1265700.1】Oracle Patch Assurance - Data Guard Standby-First Patch ApplyOracleAPP
- G008-ORACLE-DG ORACLE 19C Active Data Guard DML RedirectionOracle
- Oracle 19C Data Guard基礎運維-01安裝物理standbyOracle運維
- Oracle Data Guard Broker元件Oracle元件
- Oracle Data Guard簡介Oracle
- 1 關於 Oracle Data GuardOracle
- 2 Oracle Data Guard 安裝Oracle
- 1 Oracle Data Guard Broker 概念Oracle
- Oracle Data Guard和Broker概述Oracle
- 4.1.6 Oracle Restart 與 Oracle Data Guard 整合OracleREST
- Oracle 12.2 使用Database Link優化Standby Database WorkloadOracleDatabase優化
- Oracle 12.2 physical standby備庫收集AWR報告Oracle
- 8 Oracle Data Guard Broker 屬性Oracle
- 9 Oracle Data Guard 故障診斷Oracle
- [20201110]How to get the Data Guard broker configuration from a SQL query.txtSQL
- 【ASK_ORACLE】Oracle Data Guard(一)DG架構Oracle架構
- oracle 11g data guard維護Oracle
- 【DATAGUARD】Oracle19c Data Guard BrokerOracle
- 2 開始實用 Oracle Data GuardOracle
- 19 Oracle Data Guard 相關檢視Oracle
- 【DATAGUARD】Data Guard 12C 新特性:Far Sync Standby (Doc ID 2179719.1)
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- 12c DG新特性 - Active Data Guard Far Sync (Doc ID 2179719.1)
- oracle12.2 adg ORA-46952: standby database format mismatch for password fileOracleDatabaseORM
- 6 Oracle Data Guard Protection Modes 保護模式Oracle模式
- 15 Oracle Data Guard Scenarios 保護場景OracleiOS
- A Oracle Data Guard Broker 升級和降級Oracle
- Oracle Data Guard Feature 12cR2系列(二)Oracle
- Oracle Data Guard Feature 12cR2系列(一)Oracle
- 18 與Oracle Data Guard 相關的SQL語句OracleSQL
- Oracle 19C CBD Active DataGuard Standby passwd file 注意事項 ORA-01017Oracle
- How To Replicate Data from Oracle to Postgres Using GoldenGate (Doc ID 1544137.1OracleGo
- 【ASK_ORACLE】Oracle Data Guard(二)物理備庫的概念和優勢Oracle
- 【ASK_ORACLE】Oracle Data Guard(四)快照備庫的概念和優勢Oracle
- 【ASK_ORACLE】Oracle Data Guard(三)邏輯備庫的概念和優勢Oracle
- 單機搭建Data Guard
- Oracle 19C Data Guard基礎運維-02 Switchovers(物理)Oracle運維