前面介紹瞭如何通過RMAN Duplicate方式構建物理備用資料庫,本篇將演示如何利用Cloud Control構建物理備用資料庫。 1 軟體環境 Oracle Linux 6.9 Oracle 12.1.0.2 Oracle Enterprise Management Cloud Control ...
前面介紹瞭如何通過RMAN Duplicate方式構建物理備用資料庫,本篇將演示如何利用Cloud Control構建物理備用資料庫。
1 軟體環境
- Oracle Linux 6.9
- Oracle 12.1.0.2
- Oracle Enterprise Management Cloud Control 12.1.0.4
- 主庫:odd.oracle.com,IP:192.168.1.105
- 備庫:even.oracle.com,IP:192.168.1.106
2 使用Cloud Control創建備庫
2.1 網路配置
2.1.1 主庫網路配置
1)監聽器配置
[oracle@odd admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = odd.oracle.com)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
2)TNS配置
[oracle@odd admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TNS_ODD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.105)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
TNS_EVEN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.106)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCLDG)
)
)
2.1.2 備庫網路配置
1)監聽器配置
[oracle@even admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCLDG)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = ORCLDG)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = even.oracle.com)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
2)TNS配置
[oracle@even admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TNS_ODD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.105)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL)
)
)
TNS_EVEN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.106)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCLDG)
)
)
2.1.3 測試網路
1)主庫測試
[oracle@odd ~]$ tnsping tns_odd
[oracle@odd ~]$ tnsping tns_even
2)備庫測試
[oracle@even admin]$ tnsping tns_odd
[oracle@even admin]$ tnsping tns_even
2.2 圖形界面創建備庫
1)登錄Cloud Control,進入目標>資料庫實例ORCL
2)輸入用戶名和口令,點擊登錄3)添加備用資料庫,點擊繼續
4)設置備份類型,點擊下一步
5)備份選項,不勾選,點擊下一步
6)備庫配置頁,點擊檢索按鈕
7)選擇目標備庫所在主機
8)填寫備庫信息後,點擊下一步
9)選擇備庫文件位置為OFA,點擊定製
10)檢查所有文件路徑,確保ORCL置換為ORCLDG,點擊確定
11)出現警告,點擊繼續
12)回到文件位置配置頁,點擊下一步
13)備庫配置頁面,更改備庫參數,點擊下一步
14)添加備庫複查頁面,如沒問題,點擊完成
15)點擊檢查作業鏈接
16)作業執行過程中
17)在Oracle資料庫>作業活動頁,可看到正在創建備庫
2.3 搭建完畢,驗證
2.3.1 主庫操作
1)查詢主庫角色信息
SQL> select name,open_mode,database_role,db_unique_name,dataguard_broker from v$database;
NAME OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME DATAGUAR
--------- -------------------- ---------------- ------------------------------ --------
ORCL READ WRITE PRIMARY ORCL ENABLED
2)創建測試數據
SQL> create table scott.test(id number,name varchar2(100));
Table created.
SQL> insert into scott.test values(1,'Alen');
1 row created.
SQL> commit;
Commit complete.
3)查詢數據
SQL> select * from scott.test;
ID NAME
---------- ----------------------------------------------------------------------------------------------------
1 Alen
2.3.2 備庫操作
1)查詢主庫角色信息
SQL> select name,open_mode,database_role,db_unique_name,dataguard_broker from v$database;
NAME OPEN_MODE DATABASE_ROLE DB_UNIQUE_NAME DATAGUAR
--------- -------------------- ---------------- ------------------------------ --------
ORCL READ ONLY WITH APPLY PHYSICAL STANDBY ORCLDG ENABLED
2)查詢數據
SQL> select * from scott.test;
ID NAME
---------- ----------------------------------------------------------------------------------------------------
1 Alen
綜上,就是使用Cloud Control搭建物理備用資料庫的整個過程