编辑手记:为数据库升级打补丁是一项常规的任务,在通常情况下 ,打补丁是一件繁琐的事情,需要考虑的细节比较多。但在云上,可以通过按钮一键式应用 相关补丁集,高效便捷。我们今天一起来学习 Oracle Cloud Database Patching Then patch like a king with single click Database As A Service (DbaaS)
系列文章回顾:
1、Configure and Practice Backup and Recovery in Cloud 在Oracle公有云上备份与恢复的配置和实践
2、Create a Primary and Standby Database in the Cloud 在Oracle公有云上创建standby数据库
3、 Create a database clone in the cloud 在Oracle公有云上创建克隆数据库
作者简介
Joel Perez
Oracle ACE总监, Maximum Availability OCM,OTN 专家,全球第一批ACE称号获得者,致力于数据库高可用、灾难恢复、升级迁移和数据复制等方向设计和实现解决方案。
Nassyam Basha
Oracle ACE总监,专注于Oracle高可用技术,印度甲骨文社区成员,定期在Oracle技术活动中进行演讲。并在实践中为客户提供最佳解决方案。
Introduction简介
Patching your databases is regular taskwhenever Oracle releases new security patches on quarterly basis and at the endit is customer take depending on the downtime, when you planned for patching ofOn-Premises database then you have to take care of many things manually such asconflicts, OPatch utility version, Patching and post tasks but all these taskswe handle manually and carefully each step. This is numerously challenges aredecreased if your database on cloud. This article explains how easy to performpatching on your database (DBaaS) using single click.
当Oracle每季度发布新的安全修补程序时,及时升级打补丁是常规任务,客户一般会根据停机时间决定是否应用补丁。当有计划性地为数据库安装补丁集时,必须手动处理许多事情,例如版本冲突,OPatch实用程序版本,修补和一些安装后的任务,所有这些任务,我们都要手动并且仔细处理。 如果你的数据库在云上,安装的过程会简化许多。 本文介绍如何轻松地通过单击执行安装补丁集到数据库(DBaaS)的过程。
Challengesof patching over On-Premises
计划性打补丁集面临的挑战
This is the job we are doing so far and ofcourse still, this requires lot of plan and below is the few important ones
目前对于打补丁这项工作,仍然并将一直需要同时处理以下事务:
What patches have been applied?已经打过哪些补丁
What patches we can apply onour database?目标库能打哪些补丁
Downloading patches 下载补丁集
OPatch utility version 确定Opatch应用程序的版本
One-off patch conflictdetection and resolution 一次性补丁冲突检测和解析
Installation of patch at OracleHome level 安装补丁到Oracle目录
Performing post tasks (loadingmodified SQL) 执行安装后的程序
Invalid objects compilation 失效对象编译
These are the above steps if we haveplanned very well and lot of work involved to download the patch and update theOPatch utility version to meet the requirement and many steps. If the oneoracle home shared by the more than one databases then we have to take care ofall the databases to perform post tasks.
对于以上涉及到的步骤我们都要做完整规划部署并按照要求执行,尤其是Opatch应用程序的版本一定要满足。如果一个oracle home目录被多个数据库共享,那么必须针对所有数据库执行post程序。
DBaaS– Cloud patching
DbaaS-云上打补丁的实现
Now consider customer databases moved fromon-premises to the Oracle cloud then….
假设用户的数据库现在迁移到了云上
Question: How easy to apply patch when database is on cloud?
问:在云上为数据库打补丁实现起来真的很简单吗?
Guess: Probably we host database in cloud but again at the end itsdatabase, hence have to apply patch like we do on-premises.?
猜测:是不是只是在云端托管数据库,但最终还是在数据库终端打补丁,因此做法跟普通数据库应用补丁集并没有太大区别?
Answer: Single click apply patch will do everything for you within 30minutes of span time for the security patches again it depends.
答:只需要通过单击按钮一键式安装补丁集,根据补丁集的不同,时间会不等,但一般在半个下傲视之内都可以完成。
Howit is possible?
这可能吗?
Oracle cloud made things easy tointerrelate for all the oracle sources such as My Oracle Support, Special DBaaSMonitoring, and Easy access to the secured Oracle sources and hence OracleCloud have flexibility to perform all the tasks at one stop, so that manualintervention is not required any more to download the patches or to analyze orto apply.
Oracle云为所有Oracle数据源(例如My Oracle Support,特殊DBaaS监控和轻松访问受保护的Oracle源)提供了易于互连的功能,因此Oracle Cloud可以灵活地一站式执行所有任务,以便手动干预,并且不需要任何更多的下载补丁或分析应用。
Environment Information
Service/Hostname : CKPT-DBaaS
Domain : nassyambasha
Oracle RDBMS : 12.1.0.2
Database : On Cloud
SID : ORC1
OPatch version : 12.1.0.1.10
Patch to apply : April 2016 PSU
Patch 22291127: DATABASE PATCH SET UPDATE 12.1.0.2.160419
Patch 22291127 - Database Patch Set Update 12.1.0.2.160419(Includes CPUApr2016)
Applying patchon Database of cloud
在云上应用数据库补丁集
In order to access our database service from the cloudwe can navigate as Dashboard à Select Oracle Database Cloud Serviceà from My services “click on URL” à from new page under database click on “ x instance(s) and then youcan see below screen with the list of databases services.
我们通过在导航栏输入Dashboard访问到Oracle云上的数据库服务页面,然后选择“Oracle Database Cloud Service” à在我的服务中选择“click onURL”à然后在新的页面选择数据库实例名称就可以打开以下页面,页面上我们会看到很多的数据库服务。
From the home page of database service, wecan see the hardware configuration, connectivity information of database. Nowwe can jump to the administration section of the left side panel to check thelist of the available patches and to know the patch history.
在数据库服务的主页面,有硬件配置、数据库的连接信息,选择控制面板,查看可用的补丁集和 已经应用的补丁集。
So this section shows us that the databaseis eligible to apply the PSU update 12.1.0.2.160419 which is April 2016 PSU andwe can see other information such as when this patch is released and quickaccess to readme file.
在这部分我们可以看到在2016年4月份该数据库成功应用过12.1.0.2.160419的补丁集,同样,我们也可以查看该补丁集什么时候被释放,或者直接点击阅读readme文件。
If once we decided to go to apply the patchthen the first step is to perform the “pre-check” of database over thedatabase. Manually we have to run the command using OPatch but here singleclick can perform and provides the output whether the patch have any conflictsor not.
如果决定应用补丁,第一步就是在数据库上执行数据库的“预检查”。非云上数据块我们必须手动执行Opatch程序,但这里直接可以单击执行,并提供输出显示补丁是否有冲突。
After initiating pre-check it will startchecking with database homes.
预检查完成之后接下来检查Oracle home目录。
It takes very little time to perform thepre-check and after that you will see below status message of the conflicts.This step can be performed as much as many times if in case.
执行预检查的过程很快就会完成,然后提示一下状态信息(如图),图中显示有冲突,因此该步骤会根据冲突发生的不同情况而反复执行。
Now we are ready to go for patching, priorto that we will gather the OPatch lsinventory information so that we cancrosscheck after applying the patch.
现在准备就绪,可以应用补丁集了。应用之前,先收集OPatch lsinventory信息,以便在应用补丁后进行交叉检查。
[oracle@CKPT-DBaaS~]$ hostname
CKPT-DBaaS
[oracle@CKPT-DBaaS~]$ id
uid=54321(oracle)gid=54321(oinstall) groups=54321(oinstall),54322(dba)
[oracle@CKPT-DBaaS~]$
[oracle@CKPT-DBaaS~]$ export PATH=$ORACLE_HOME/OPatch:$PATH
[oracle@CKPT-DBaaS~]$ OPatch version
OPatch Version:12.1.0.1.10
OPatch succeeded.
[oracle@CKPT-DBaaS~]$ OPatch lsinventory
Oracle Interim PatchInstaller version 12.1.0.1.10
Copyright (c) 2016,Oracle Corporation. All rights reserved.
Oracle Home :/u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory :/u01/app/oraInventory
from :/u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.10
OUI version : 12.1.0.2.0
Log file location :/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/OPatch2016-07-16_08-23-00AM_1.log
Lsinventory Outputfile location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/lsinv/lsinventory2016-07-16_08-23-00AM.txt
----------------------------------------------------------------------
LocalMachine Information::
Hostname:CKPT-DBaaS.compute-nassyambasha.oraclecloud.internal
ARU platform id: 226
ARU platformdescription:: Linux x86-64
Installed Top-levelProducts (1):
Oracle Database12c 12.1.0.2.0
There are 1 productsinstalled in this Oracle Home.
Interim patches (3):
Patch 22139226 : applied on Thu Jan 21 12:30:53 IST 2016
Unique PatchID: 19729684
...
----------------------------------------------------------------------
OPatch succeeded.
[oracle@CKPT-DBaaS~]$
We have gathered required information andnow we will proceed to apply patch directly from the cloud dashboard for thedatabase service.
收集了所需的信息,接下来将直接从云仪表板应用数据库服务的修补程序。
Before proceeding with patching cloudprompts for your approval once again to ensure, because it requires downtimeand hence this step should consider when the downtime is accepted. You canleave a comment so that the job id tagged with comment to view for otherusers.
在修补云提示以获得批准之前,请再次确认,因为需要停机时间,此步骤应考虑何时接受停机时间。 操作用户可以在此处留下评论,以便将作业标签标记为评论,以供其他用户查看。
Once the comment entered and acknowledged thatmeans we are ensuring to apply patch forcibly then again we can click on thepatch button and then the job id will be created and oracle cloud handles thecomplete patching.
当输入评论以后,就意味着用户将会强制应用补丁集,此时点击Opatch程序将会创建job id, oracle cloud handles将会辅助完成应用补丁集的过程。
Now the patching is in progress and we cancheck the status on clicking the “Last Patch applied” section and it shows whenthe patching is started with the job id and the current status.
如上图,正在应用补丁集。可以通过选择“LastPatch applied”查看应用状态。状态信息包括开始应用的时间,job ID,当前完成状态等。
We can review the database and listenerstatus while patching in progress from the console using putty ssh terminal. Ifwe see below the listener and also the database are already down and that meansof course patching is in progress.
我们可以在使用putty ssh终端从控制台进行修补过程中查看数据库和监听器状态。我们看到下面的监听器和数据库已经关闭,安装补丁集的过程还在进行。
[oracle@CKPT-DBaaS~]$ ps -ef|grep pmon
oracle 6848 1369 0 08:36 pts/1 00:00:00 grep pmon
[oracle@CKPT-DBaaS~]$ ps -ef|grep tns
root 20 2 0 Jun26 ? 00:00:00 [netns]
oracle 6850 1369 0 08:36 pts/1 00:00:00 grep tns
[oracle@CKPT-DBaaS~]$
Whole patching took for 25 minutes ofoverall process; the duration depends on each patch and the number ofdatabases.
整个安装补丁集的过程25分钟就完成了,一般完成时间取决于不同的补丁集和数据库的数量。(不大于30分钟)。
In span of 25 minutes all the tasks areperformed
在25分钟完成了以下全部过程:
Download required patches 下载相应的补丁集
Apply the patch over OracleHome 在Oracle home目录应用补丁集
Loading modified SQL 上传修饰SQL
Recompiling invalid objects 重新编译失效对象。
Further more information can be grabbedfrom the Patch history by clicking like below.
如下图,可以查询历史补丁集的更多信息。
After patching completed we can verify thestatus from database level using the below query .
完成补丁应用以后,我们通过以下语句确认数据库层面的各类状态。
The same information we can also gatherfrom the database alert log and the contents are below.
以上信息我们也可以通过数据库的告警日志获得。
Sat Jul 16 08:44:452016
AQPC started withpid=35, OS id=15902
DatabaseCharacterset for PDB$SEED is AL32UTF8
Opening pdb PDB$SEED(2) with no Resource Manager plan active
ALTER PLUGGABLEDATABASE ALL OPEN
DatabaseCharacterset for PSPDB is AL32UTF8
Opening pdb PSPDB(3) with no Resource Manager plan active
Pluggable databasePSPDB opened read write
Completed: ALTERPLUGGABLE DATABASE ALL OPEN
Starting backgroundprocess CJQ0
Completed: ALTERDATABASE OPEN
Sat Jul 16 08:44:482016
CJQ0 started withpid=36, OS id=16023
Sat Jul 16 08:44:492016
===========================================================
Dumping currentpatch information
===========================================================
Patch Id: 19769480
...
Patch Id: 23192060
...
===========================================================
Sat Jul 16 08:44:492016
db_recovery_file_dest_sizeof 6144 MB is 48.22% used. This is a
user-specified limiton the amount of space that will be used by this
database forrecovery-related files, and does not reflect the amount of
space available inthe underlying filesystem or ASM diskgroup.
Sat Jul 16 08:45:382016
SERVER COMPONENTid=UTLRP_BGN: timestamp=2016-07-16 08:45:38 Container=CDB$ROOT Id=1
diag_adl:SERVERCOMPONENT id=UTLRP_END: timestamp=2016-07-16 08:45:41 Container=CDB$ROOT Id=1
diag_adl:
diag_adl:XDBinstalled.
diag_adl:
diag_adl:XDBinitialized.
Sat Jul 16 08:54:282016
Resize operationcompleted for file# 1, old size 839680K, new size 849920K
We have crosschecked the patching and theloading modified sql from alert log and we finally crosscheck the OPatchlsinventory to know the list of patches are applied.
我们已经对补丁集做了交叉检查,并从告警日志加载了修饰sql,通过交叉检查OPatch lsinventory可以获取应用补丁列表。
[oracle@CKPT-DBaaS ~]$export PATH=$ORACLE_HOME/OPatch:$PATH
[oracle@CKPT-DBaaS~]$ OPatch lsinventory
Oracle Interim PatchInstaller version 12.1.0.1.10
Copyright (c) 2016,Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1
Central Inventory :/u01/app/oraInventory
from :/u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc
OPatch version : 12.1.0.1.10
OUI version : 12.1.0.2.0
Log file location :/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/OPatch2016-07-16_15-37-52PM_1.log
Lsinventory Outputfile location :
...
OPatch succeeded.
[oracle@CKPT-DBaaS~]$
Conclusion总结
We’ve seen the step by step procedure toapply the patch for database service on cloud and the major challenges ofapplying patches from on-premises and the advantages of patching of clouddatabase with just single click.
通过以上一步一步的过程,将云计算数据库服务的补丁应用到云上。文章同时对比了传统应用补丁的主要挑战以及云数据库应用补丁集的优点。
文章转自数据和云公众号,原文链接