翻譯|使用教程|編輯:鮑佳佳|2021-04-21 10:12:49.173|閱讀 301 次
概述:在本文中,我們將描述一個(gè)簡(jiǎn)單的替代方法,該方法關(guān)于如何使用通過dbForge Studio for Oracle的工具創(chuàng)建的模板文件輕松地自動(dòng)化數(shù)據(jù)庫(kù)開發(fā)過程。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
在開發(fā)和部署數(shù)據(jù)庫(kù)時(shí)提出與提高性能,提高Oracle數(shù)據(jù)庫(kù)可靠性和完整性有關(guān)的問題時(shí),真正的價(jià)值在于使流程自動(dòng)化和安全地管理更改。
DBA通常會(huì)執(zhí)行例如數(shù)據(jù)庫(kù)管理任務(wù),其中包括創(chuàng)建Oracle數(shù)據(jù)庫(kù)自動(dòng)化腳本或過程。這將使他們不再浪費(fèi)時(shí)間在重復(fù)性任務(wù)上,并提高了效率并提高了生產(chǎn)率。
在本文中,我們將描述一個(gè)簡(jiǎn)單的替代方法,該方法關(guān)于如何使用通過dbForge Studio for Oracle的工具創(chuàng)建的模板文件輕松地自動(dòng)化數(shù)據(jù)庫(kù)開發(fā)過程。
首先,讓我們介紹本文中要使用的主要定義。
什么是用于Oracle數(shù)據(jù)庫(kù)的DevOps?
在Oracle中進(jìn)行數(shù)據(jù)庫(kù)部署和變更管理時(shí),實(shí)現(xiàn)工作流程自動(dòng)化是一個(gè)好主意。DevOps可以實(shí)現(xiàn)這一點(diǎn),它不僅可以促進(jìn)Oracle數(shù)據(jù)庫(kù)部署自動(dòng)化并減少數(shù)據(jù)庫(kù)部署到生產(chǎn)環(huán)境的發(fā)布周期,還可以確保更高的數(shù)據(jù)庫(kù)性能和可靠性。
DevOps是一套實(shí)踐和工具,旨在與開發(fā)人員和運(yùn)營(yíng)團(tuán)隊(duì)進(jìn)行協(xié)調(diào)和協(xié)作,并使軟件開發(fā)生命周期自動(dòng)化,以便更快地交付更好,更可靠的產(chǎn)品并提高性能。
如何在DevOps工作流程中使用dbForge Studio for Oracle
命令行腳本包括以下步驟:
首先,請(qǐng)確保在您的計(jì)算機(jī)上安裝了dbForge Studio for Oracle。點(diǎn)擊鏈接
在執(zhí)行腳本之前,借助dbForge Studio for Oracle創(chuàng)建模板文件(.scomp,.dcomp,.dit和/或.dgen,將在命令中使用)。在本例中,我們將使用DBFORCL作為測(cè)試服務(wù)器。
步驟1.創(chuàng)建一個(gè)用戶
要?jiǎng)?chuàng)建新用戶SCOTT,請(qǐng)執(zhí)行以下命令:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /execute D:/DevOps_Oracle/Create_SCOTT.sql /connection:"User Id=sys; Password=[password];Server=DBFORCL; Connect Mode=SysDba; Unicode=True; Connection Timeout=0;Pooling=False; Direct=True; Service Name=orcllast; Enlist=False; Transaction Scope Local=True"
其中Create_SCOTT.sql是我們先前使用dbForge Studio for Oracle創(chuàng)建的模板文件。
步驟2.創(chuàng)建一個(gè)表
接下來,要?jiǎng)?chuàng)建一個(gè)空表,請(qǐng)以SCOTT用戶身份執(zhí)行以下命令行腳本:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /execute D:/DevOps_Oracle/Create_tables_in_SCOTT.sql /connection:"User Id=SCOTT;Password=[password];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True"
其中Create_tables_in_SCOTT.sql是我們先前使用dbForge Studio for Oracle創(chuàng)建的模板文件。
步驟3.用數(shù)據(jù)填充表
要為表生成隨機(jī)數(shù)據(jù),我們將使用dbForge Studio for Oracle提供的數(shù)據(jù)生成器和數(shù)據(jù)導(dǎo)入/導(dǎo)出功能。
使用數(shù)據(jù)生成器功能
數(shù)據(jù)生成器是生成大量真實(shí)測(cè)試數(shù)據(jù)的最簡(jiǎn)單方法。它支持多種Oracle數(shù)據(jù)類型,并包括200多個(gè)數(shù)據(jù)生成器,以使用不同類型的值填充表。
使用先前配置的數(shù)據(jù)生成器模板文件(SCOTT_Data_Generation.dgen),執(zhí)行以下命令行腳本:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /generatedata /projectfile:"D:\DevOps_Oracle\SCOTT_Data_Generation.dgen" /connection:"User Id=SCOTT; Password=[password]; Server=DBFORCL; Unicode=True; Connection Timeout=0; Pooling=False; Direct=True; Service Name=orcllast; Enlist=False; Transaction Scope Local=True"
使用數(shù)據(jù)導(dǎo)入/導(dǎo)出功能
dbForge Studio for Oracle使您可以輕松地從單獨(dú)的文件導(dǎo)入數(shù)據(jù)和/或?qū)С鰯?shù)據(jù)。該工具支持不同的數(shù)據(jù)文件格式,并允許您根據(jù)需要自定義導(dǎo)入和導(dǎo)出選項(xiàng)。
要將數(shù)據(jù)插入表中,我們將使用先前配置并保存在dbForge Studio for Oracle中的數(shù)據(jù)導(dǎo)入模板運(yùn)行命令行腳本:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /dataimport /connection:"User Id=SCOTT;Password=[password];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True" /templatefile:D:/DevOps_Oracle/BONUS_template.dit "C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /dataimport /connection:"User Id=SCOTT;Password=[password];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True" /templatefile:D:/DevOps_Oracle/DEPT_template.dit "C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /dataimport /connection:"User Id=SCOTT;Password=[password];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True" /templatefile:D:/DevOps_Oracle/EMP_template.dit "C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /dataimport /connection:"User Id=SCOTT;Password=[password];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True" /templatefile:D:/DevOps_Oracle/SALGRADE_template.dit
步驟4.在不同服務(wù)器上同步架構(gòu)
在某些情況下,當(dāng)我們需要在同一臺(tái)或另一臺(tái)服務(wù)器上復(fù)制數(shù)據(jù)庫(kù)時(shí),“功能是一種有用的解決方案,它允許快速,準(zhǔn)確地比較和同步模式。
要在另一臺(tái)服務(wù)器上創(chuàng)建新的架構(gòu)結(jié)構(gòu),請(qǐng)運(yùn)行以下命令行腳本:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /schemacompare /compfile:"D:\DevOps_Oracle\SCOTT_Schema_Compare.scomp" /source connection:"User Id=SCOTT;Password=[passowrd];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True" /target connection:"User Id=SCOTT;Password=[password];Server=dbforacle18;Unicode=True;Pooling=False;Direct=True;Service Name=oracle18;Enlist=False;Transaction Scope Local=True" /schemas:SCOTT,SCOTT /sync
這將添加在使用dbForge Studio for Oracle中的“模式比較”工具創(chuàng)建SCOTT_Schema_Compare.scomp模板時(shí)選擇的表,視圖,過程,函數(shù)和觸發(fā)器。
步驟5.用測(cè)試數(shù)據(jù)填充數(shù)據(jù)庫(kù)
要將數(shù)據(jù)插入數(shù)據(jù)庫(kù),我們將使用數(shù)據(jù)比較工具,該工具可以輕松地將測(cè)試數(shù)據(jù)從一個(gè)數(shù)據(jù)庫(kù)或腳本文件夾遷移到另一個(gè)數(shù)據(jù)庫(kù)或腳本文件夾。
要填充數(shù)據(jù)庫(kù),請(qǐng)運(yùn)行以下腳本:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /datacompare /compfile:"D:\DevOps_Oracle\SCOTT_Data_Compare.dcomp" /source connection:"User Id=SCOTT;Password=[password];Server=DBFORCL;Unicode=True;Connection Timeout=0;Pooling=False;Direct=True;Service Name=orcllast;Enlist=False;Transaction Scope Local=True" /target connection:"User Id=SCOTT;Password=[password];Server=dbforacle18;Unicode=True;Pooling=False;Direct=True;Service Name=oracle18;Enlist=False;Transaction Scope Local=True" /schemas:SCOTT,SCOTT /sync
其中SCOTT_Data_Compare.dcomp是一個(gè)模板文件,以前是使用dbForge Studio for Oracle中內(nèi)置的數(shù)據(jù)比較工具配置的。
步驟6:生成文檔
在比較并同步了Oracle方案并將數(shù)據(jù)插入數(shù)據(jù)庫(kù)之后,我們將生成整個(gè)架構(gòu)的文檔。該工具有助于創(chuàng)建HTML,PDF或Markdown文件格式的文檔。在我們的示例中,我們將使用.pdf文件格式。
要生成文檔,請(qǐng)執(zhí)行以下腳本:
"C:\Program Files\Devart\dbForge Studio for Oracle\dbforgeoracle.com" /document /projfile:"D:\DevOps_Oracle\SCOTT_dbforacle18.ddoc" /connection:"User Id=SCOTT;Password=[password];Server=dbforacle18;Unicode=True;Pooling=False;Direct=True;Service Name=oracle18;Enlist=False;Transaction Scope Local=True" /password /documentformat:Pdf /outputfile:"D:\DevOps_Oracle\SCOTT_dbforacle18.pdf" /breadcrumbs:Y
其中SCOTT_dbforacle18.ddoc是先前使用dbForge Studio for Oracle中內(nèi)置的Documenter工具配置的模板文件。
結(jié)果,您將收到一個(gè)部署腳本,該腳本將允許您自動(dòng)執(zhí)行架構(gòu)和數(shù)據(jù)庫(kù)的創(chuàng)建,測(cè)試數(shù)據(jù)填充,架構(gòu)結(jié)構(gòu)和數(shù)據(jù)的比較和同步以及以方便的文件格式生成文檔。
結(jié)論
dbForge Studio for Oracle是一個(gè)強(qiáng)大的工具,可以輕松地集成到DevOps數(shù)據(jù)庫(kù)自動(dòng)化工具中。您可以使用該工具輕松地將DevOps概念應(yīng)用于數(shù)據(jù)庫(kù)部署,并改善Oracle中的變更管理。在Oracle模式中部署常規(guī)和重復(fù)腳本時(shí),使用DevOps for Oracle數(shù)據(jù)庫(kù)將幫助您節(jié)省時(shí)間并提高效率。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: