點擊上方“IT那活兒”公眾號,關注后了解更多內容,不管IT什么活兒,干就完了!!!
文章前言
本章內容包含測試六個場景:
需要回顧早前發布的文章,可點擊文章標題跳轉原文查看:
《oracle最佳連接方式之service簡介及創建(上)》
service測試相關腳本
2.1 先主庫建測試表及測試用戶
create user dbauser identified by oracle account unlock;
grant dba to dbauser;
create table dbauser.test_read(id number);
insert into dbauser.test_read values(1);
insert into dbauser.test_read values(2);
insert into dbauser.test_read values(3);
commit;
create table dbauser.test_write(id number);
#!/bin/bash
#Autor:Wangergui
#Description:test write
i=0
while true;do
sqlplus dbauser/oracle@PRI_EMREP1< insert into dbauser.test_write values ($i);
commit;
exec dbms_lock.sleep(5);
quit
EOF
sleep 2 && i=$(($i+1))
done
#!/bin/bash
#Autor:Wangergui
#Description:test read
i=0
while true;do
sqlplus -S dbauser/oracle@PRI_EMREP1 < select * from dbauser.test;
exec dbms_lock.sleep(5);
quit
EOF
sleep 1 && i=$(($i+1))
done
#!/bin/bash
#Autor:Wangergui
#Description:Monitor write
i=0
while true;do
sqlplus dbauser/oracle@PRI_EMREP1 < select * from dbauser.test_write;
exec dbms_lock.sleep(5);
quit
EOF
sleep 2 && i=$(($i+1))
done
說明:
192.168.8.111為備庫的SCAN IP
# Primary Node1
PRI_EMREP1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521))
)
(CONNECT_DATA =
(service_name = EMREP_R_S1)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
# Primary Node2
PRI_EMREP2 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521))
)
(CONNECT_DATA =
(service_name = EMREP_R_S2)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
# Standby Node1
STD_EMREP1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521))
)
(CONNECT_DATA =
(service_name = EMREP_RD_S1)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
# Standy Node2
STD_EMREP2 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521))
)
(CONNECT_DATA =
(service_name = EMREP_RD_S2)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
#!/bin/bash
#Autor:Wangergui
#Description: Montor service_name
while true;do sqlplus -S / as sysdba < alter session set nls_date_format=YYYY-MM-DD HH24:MI:SS;
set linesize 500 pagesize 100 echo off feedback off trims on newpage none;
set lines 400 pages 1000
col username for a15;
col machine for a25;
col program for a45;
col service_name for a20;
select inst_id,
sid,
username,
machine,
program,
service_name,
status,
logon_time
from gv$session where username=DBAUSER;
quit;
EOF
echo && sleep 1
done
測試場景
1)測試過程說明
session 1運行連接測試service.sh腳本;
session 2 運行session監控session.sh 腳本;
session 3關閉節點1數據庫shutdown immediate;
監控service會不會漂移。
srvctl stop instance –d –n –f -failover
srvctl stop instance –d -n -f -failover
#!/bin/bash
#Autor:Wangergui
#Description:test read
i=0
while true;do
sqlplus -S wangergui/oracle@STD_ORCL1 < select * from wangergui.test_read;
exec dbms_lock.sleep(5);
quit
EOF
sleep 1 && i=$(($i+1))
done
while true;do sqlplus -S / as sysdba < alter session set nls_date_format=YYYY-MM-DD HH24:MI:SS;
set linesize 500 pagesize 100 echo off feedback off trims on newpage none;
set lines 400 pages 1000
col username for a15;
col machine for a25;
col program for a45;
col service_name for a20;
select inst_id,
sid,
username,
machine,
program,
service_name,
status,
logon_time
from gv$session where username=WANGERGUI;
quit;
EOF
echo && sleep 1
done
節點1 session 2執行shutdown immediate關閉數據庫。
shutdown immedaite;
會話監控如下:
srvctl relocate service -db DGORCL -service ORCL_rd_s1 -oldinst orcl2 -newinst orcl1
1)測試場景說明
#!/bin/bash
#Autor:Wangergui
#Description:test read
i=0
while true;do
sqlplus -S wangergui/oracle@STD_ORCL1 < select * from wangergui.test_read;
exec dbms_lock.sleep(5);
quit
EOF
sleep 1 && i=$(($i+1))
done
while true;do sqlplus -S / as sysdba < alter session set nls_date_format=YYYY-MM-DD HH24:MI:SS;
set linesize 500 pagesize 100 echo off feedback off trims on newpage none;
set lines 400 pages 1000
col username for a15;
col machine for a25;
col program for a45;
col service_name for a20;
select inst_id,
sid,
username,
machine,
program,
service_name,
status,
logon_time
from gv$session where username=WANGERGUI;
quit;
EOF
echo && sleep 1
done
同場景一。
同場景二。
最佳實踐配置
#
Primary Node1 優先連接主庫節點1
PRI_ORCL1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521)) #主庫SCAN IP
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521)) #備庫SCAN IP
)
(CONNECT_DATA =
(service_name = ORCL_R_S1)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
# Primary Node2 優先連接主庫節點2
PRI_ORCL2 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521)) #主庫SCAN IP
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521)) #備庫SCAN IP
)
(CONNECT_DATA =
(service_name = ORCL_R_S2)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
# Standby Node1 優先連接備庫節點1
STD_ORCL1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521)) #備庫SCAN IP
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521)) #主庫SCAN IP
)
(CONNECT_DATA =
(service_name = ORCL_RD_S1)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
# Standy Node2 優先連接主庫節點2
STD_ORCL2 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.111)(PORT = 1521)) #備庫SCAN IP
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521)) #主庫SCAN IP
)
(CONNECT_DATA =
(service_name = ORCL_RD_S2)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
PRI_ORCL1 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521)) #主庫SCAN IP
)
(CONNECT_DATA =
(service_name = ORCL_R_S1)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
PRI_ORCL2 =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = off)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.110)(PORT = 1521)) #主庫SCAN IP
)
(CONNECT_DATA =
(service_name = ORCL_R_S2)
(FAILOVER_MODE =
(type = session)
(method = basic)
(retries = 10)
(delay = 5)
)
)
)
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://m.specialneedsforspecialkids.com/yun/129308.html
摘要:不幸的是,他不斷變化要求嚴格充滿活力的環境不適合許多組織仍然依賴的年歷史的廣域網。企業在上市時間上的變化很短,這對于推動廣域網轉型計劃的來說是一個很大的禁忌。全球企業轉向多云環境的最佳實踐:sd-wan如何幫助tweet您擁有多云環境-現在怎么辦?無論他們是否開始使用多個云,今天的大型企業最終都會使用多個云供應商。事實上,很難找到一家不使用Microsoft Azure、Amazon AWS...
摘要:來源是最流行的用于開發微服務的框架。以下依次列出了最佳實踐,排名不分先后。這非常有助于避免可怕的地獄。推薦使用構造函數注入這一條實踐來自的項目負責人。保持業務邏輯免受代碼侵入的一種方法是使用構造函數注入。 showImg(https://mmbiz.qpic.cn/mmbiz_jpg/R3InYSAIZkHQ40ly9Oztiart2lESCyjCH0JwFRp3oErlYobhibM...
摘要:高性能代碼的最佳實踐前言在這篇文章中,我們將討論幾個有助于提升應用程序性能的方法。要獲得有關應用程序需求的最好最可靠的方法是對應用程序執行實際的負載測試,并在運行時跟蹤性能指標。 showImg(https://segmentfault.com/img/bVbtgk4?w=256&h=254); 高性能Java代碼的最佳實踐前言 在這篇文章中,我們將討論幾個有助于提升Java應用程序性...
摘要:年月日甲骨文今日發布了最新的集成產品,以幫助企業更便利地運用變革性技術。甲骨文提供下一代用戶體驗,包括基于個人角色使用所有功能,同時通過預先制作的集成模板加速產品上市時間,為企業創造更多的價值。2017年10月11日 –甲骨文今日發布了最新的集成PaaS產品,以幫助企業更便利地運用變革性技術。除了最新的自治數據管理云服務、大數據分析和人工智能功能之外,甲骨文宣布在其應用程序開發平臺、數據集成...
閱讀 1353·2023-01-11 13:20
閱讀 1699·2023-01-11 13:20
閱讀 1211·2023-01-11 13:20
閱讀 1901·2023-01-11 13:20
閱讀 4161·2023-01-11 13:20
閱讀 2747·2023-01-11 13:20
閱讀 1397·2023-01-11 13:20
閱讀 3664·2023-01-11 13:20