點擊上方“IT那活兒”公眾號,關(guān)注后了解更多內(nèi)容,不管IT什么活兒,干就完了!?。?/strong>
文章前言
本章內(nèi)容包含測試六個場景:
需要回顧早前發(fā)布的文章,可點擊文章標題跳轉(zhuǎn)原文查看:
《oracle最佳連接方式之service簡介及創(chuàng)建(上)》
service測試相關(guān)腳本
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監(jiān)控session.sh 腳本;
session 3關(guān)閉節(jié)點1數(shù)據(jù)庫shutdown immediate;
監(jiān)控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
節(jié)點1 session 2執(zhí)行shutdown immediate關(guān)閉數(shù)據(jù)庫。
shutdown immedaite;
會話監(jiān)控如下:
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 優(yōu)先連接主庫節(jié)點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 優(yōu)先連接主庫節(jié)點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 優(yōu)先連接備庫節(jié)點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 優(yōu)先連接主庫節(jié)點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)
)
)
)
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/129308.html
摘要:不幸的是,他不斷變化要求嚴格充滿活力的環(huán)境不適合許多組織仍然依賴的年歷史的廣域網(wǎng)。企業(yè)在上市時間上的變化很短,這對于推動廣域網(wǎng)轉(zhuǎn)型計劃的來說是一個很大的禁忌。全球企業(yè)轉(zhuǎn)向多云環(huán)境的最佳實踐:sd-wan如何幫助tweet您擁有多云環(huán)境-現(xiàn)在怎么辦?無論他們是否開始使用多個云,今天的大型企業(yè)最終都會使用多個云供應商。事實上,很難找到一家不使用Microsoft Azure、Amazon AWS...
摘要:來源是最流行的用于開發(fā)微服務的框架。以下依次列出了最佳實踐,排名不分先后。這非常有助于避免可怕的地獄。推薦使用構(gòu)造函數(shù)注入這一條實踐來自的項目負責人。保持業(yè)務邏輯免受代碼侵入的一種方法是使用構(gòu)造函數(shù)注入。 showImg(https://mmbiz.qpic.cn/mmbiz_jpg/R3InYSAIZkHQ40ly9Oztiart2lESCyjCH0JwFRp3oErlYobhibM...
摘要:高性能代碼的最佳實踐前言在這篇文章中,我們將討論幾個有助于提升應用程序性能的方法。要獲得有關(guān)應用程序需求的最好最可靠的方法是對應用程序執(zhí)行實際的負載測試,并在運行時跟蹤性能指標。 showImg(https://segmentfault.com/img/bVbtgk4?w=256&h=254); 高性能Java代碼的最佳實踐前言 在這篇文章中,我們將討論幾個有助于提升Java應用程序性...
摘要:年月日甲骨文今日發(fā)布了最新的集成產(chǎn)品,以幫助企業(yè)更便利地運用變革性技術(shù)。甲骨文提供下一代用戶體驗,包括基于個人角色使用所有功能,同時通過預先制作的集成模板加速產(chǎn)品上市時間,為企業(yè)創(chuàng)造更多的價值。2017年10月11日 –甲骨文今日發(fā)布了最新的集成PaaS產(chǎn)品,以幫助企業(yè)更便利地運用變革性技術(shù)。除了最新的自治數(shù)據(jù)管理云服務、大數(shù)據(jù)分析和人工智能功能之外,甲骨文宣布在其應用程序開發(fā)平臺、數(shù)據(jù)集成...
閱讀 1356·2023-01-11 13:20
閱讀 1707·2023-01-11 13:20
閱讀 1215·2023-01-11 13:20
閱讀 1906·2023-01-11 13:20
閱讀 4165·2023-01-11 13:20
閱讀 2757·2023-01-11 13:20
閱讀 1402·2023-01-11 13:20
閱讀 3671·2023-01-11 13:20