当前位置: 首页 >> 技术文章 >> 【Oracle云:云上一键安装数据库补丁集 (上)】Database Patching? Then patch like a king with single click – Database As A Service (DBaaS)
【Oracle云:云上一键安装数据库补丁集 (上)】Database Patching? Then patch like a king with single click – Database As A Service (DBaaS)
发布时间:2017-02-12 发布人:Joel Perez,Nassyam Basha 3451

作者简介:

06.jpg


Joel Perez

Oracle ACE总监, Maximum Availability OCM,OTN 专家,全球第一批ACE称号获得者,致力于数据库高可用、灾难恢复、升级迁移和数据复制等方向设计和实现解决方案。

Nassyam Basha

Oracle ACE总监,专注于Oracle高可用技术,印度甲骨文社区成员,定期在Oracle技术活动中进行演讲。并在实践中为客户提供最佳解决方案。



Introduction

Patching your databases is regular task whenever Oracle releases new security patches on quarterly basis and at the end it is customer take depending on the downtime, when you planned for patching of On-Premises database then you have to take care of many things manually such as conflicts, OPatch utility version, Patching and post tasks but all these tasks we handle manually and carefully each step. This is numerously challenges are decreased if your database on cloud. This article explains how easy to perform patching on your database (DBaaS) using single click.


当Oracle每季度发布新的安全修补程序时,及时升级打补丁是常规任务,客户一般会根据停机时间决定是否应用补丁。当有计划性地为数据库安装补丁集时,必须手动处理许多事情,例如版本冲突,OPatch实用程序版本,修补和一些安装后的任务,所有这些任务,我们都要手动并且仔细处理。 如果你的数据库在云上,安装的过程会简化许多。 本文介绍如何轻松地通过单击执行安装补丁集到数据库(DBaaS)的过程。


Challenges of patching over On-Premises

计划性打补丁集面临的挑战

This is the job we are doing so far and of course still, this requires lot of plan and below is the few important ones


目前对于打补丁这项工作,仍然并将一直需要同时处理以下事务:

·         What patches have been applied? 已经打过哪些补丁

·         What patches we can apply on our database?目标库能打哪些补丁

·         Downloading patches 下载补丁集

·         OPatch utility version 确定Opatch应用程序的版本

·         One-off patch conflict detection and resolution 一次性补丁冲突检测和解析

·         Installation of patch at Oracle Home level 安装补丁到Oracle目录

·         Performing post tasks (loading modified SQL) 执行安装后的程序

·         Invalid objects compilation 失效对象编译


These are the above steps if we have planned very well and lot of work involved to download the patch and update the OPatch utility version to meet the requirement and many steps. If the one oracle home shared by the more than one databases then we have to take care of all the databases to perform post tasks.


对于以上涉及到的步骤我们都要做完整规划部署并按照要求执行,尤其是Opatch应用程序的版本一定要满足。如果一个oracle home目录被多个数据库共享,那么必须针对所有数据库执行post程序。


DBaaS – Cloud patching

DbaaS-云上打补丁的实现

Now consider customer databases moved from on-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 its database, hence have to apply patch like we do on-premises.?

猜测:是不是只是在云端托管数据库,但最终还是在数据库终端打补丁,因此做法跟普通数据库应用补丁集并没有太大区别?


Answer: Single click apply patch will do everything for you within 30 minutes of span time for the security patches again it depends.

答:只需要通过单击按钮一键式安装补丁集,根据补丁集的不同,时间会不等,但一般在半个下傲视之内都可以完成。


How it is possible?

这可能吗?


Oracle cloud made things easy to interrelate for all the oracle sources such as My Oracle Support, Special DBaaS Monitoring, and Easy access to the secured Oracle sources and hence Oracle Cloud have flexibility to perform all the tasks at one stop, so that manual intervention is not required any more to download the patches or to analyze or to 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 patch on Database of cloud

在云上应用数据库补丁集

 

In order to access our database service from the cloud we 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 you can see below screen with the list of databases services.


我们通过在导航栏输入Dashboard访问到Oracle云上的数据库服务页面,然后选择“Oracle Database Cloud Service” à在我的服务中选择“click on URL” à然后在新的页面选择数据库实例名称就可以打开以下页面,页面上我们会看到很多的数据库服务。

1.gif


From the home page of database service, we can see the hardware configuration, connectivity information of database. Now we can jump to the administration section of the left side panel to check the list of the available patches and to know the patch history.


在数据库服务的主页面,有硬件配置、数据库的连接信息,选择控制面板,查看可用的补丁集和 已经应用的补丁集。

2.gif


So this section shows us that the database is eligible to apply the PSU update 12.1.0.2.160419 which is April 2016 PSU and we can see other information such as when this patch is released and quick access to readme file.


在这部分我们可以看到在2016年4月份该数据库成功应用过12.1.0.2.160419的补丁集,同样,我们也可以查看该补丁集什么时候被释放,或者直接点击阅读readme文件。


If once we decided to go to apply the patch then the first step is to perform the “pre-check” of database over the database. Manually we have to run the command using OPatch but here single click can perform and provides the output whether the patch have any conflicts or not.


如果决定应用补丁,第一步就是在数据库上执行数据库的“预检查”。非云上数据块我们必须手动执行Opatch程序,但这里直接可以单击执行,并提供输出显示补丁是否有冲突。


3.gif


After initiating pre-check it will start checking with database homes.


预检查完成之后接下来检查Oracle home目录。


4.gif

It takes very little time to perform the pre-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.


执行预检查的过程很快就会完成,然后提示一下状态信息(如图),图中显示有冲突,因此该步骤会根据冲突发生的不同情况而反复执行。


5.gif

Now we are ready to go for patching, prior to that we will gather the OPatch lsinventory information so that we can crosscheck after applying the patch.


现在准备就绪,可以应用补丁集了。应用之前,先收集OPatch lsinventory信息,以便在应用补丁后进行交叉检查。


code.png

 

We have gathered required information and now we will proceed to apply patch directly from the cloud dashboard for the database service.


收集了所需的信息,接下来将直接从云仪表板应用数据库服务的修补程序。


6.gif

Before proceeding with patching cloud prompts for your approval once again to ensure, because it requires downtime and hence this step should consider when the downtime is accepted. You can leave a comment so that the job id tagged with comment to view for other users. 


在修补云提示以获得批准之前,请再次确认,因为需要停机时间,此步骤应考虑何时接受停机时间。 操作用户可以在此处留下评论,以便将作业标签标记为评论,以供其他用户查看。


7.gif


Once the comment entered and acknowledged that means we are ensuring to apply patch forcibly then again we can click on the patch button and then the job id will be created and oracle cloud handles the complete patching.


当输入评论以后,就意味着用户将会强制应用补丁集,此时点击Opatch程序将会创建job id, oracle cloud handles将会辅助完成应用补丁集的过程。


8.gif

Now the patching is in progress and we can check the status on clicking the “Last Patch applied” section and it shows when the patching is started with the job id and the current status.


如上图,正在应用补丁集。可以通过选择“Last Patch applied”查看应用状态。状态信息包括开始应用的时间,job ID,当前完成状态等。


9.gif

We can review the database and listener status while patching in progress from the console using putty ssh terminal. If we see below the listener and also the database are already down and that means of 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 of overall process; the duration depends on each patch and the number of databases.


整个安装补丁集的过程25分钟就完成了,一般完成时间取决于不同的补丁集和数据库的数量。(不大于30分钟)。


10.gif

In span of 25 minutes all the tasks are performed

在25分钟完成了以下全部过程


·         Download required patches 下载相应的补丁集

·         Apply the patch over Oracle Home 在Oracle home目录应用补丁集

·         Loading modified SQL  上传修饰SQL

Recompiling invalid objects 重新编译失效对象


11.gif


Further more information can be grabbed from the Patch history by clicking like below.


如下图,可以查询历史补丁集的更多信息。


12.gif

After patching completed we can verify the status from database level using the below query .


完成补丁应用以后,我们通过以下语句确认数据库层面的各类状态。


13.gif


The same information we can also gather from the database alert log and the contents are  below.


以上信息我们也可以通过数据库的告警日志获得。

123.png

我们已经对补丁集做了交叉检查,并从告警日志加载了修饰sql,通过交叉检查OPatch lsinventory可以获取应用补丁列表。

456.png

Conclusion

We’ve seen the step by step procedure to apply the patch for database service on cloud and the major challenges of applying patches from on-premises and the advantages of patching of cloud database with just single click.


通过以上一步一步的过程,将云计算数据库服务的补丁应用到云上。文章同时对比了传统应用补丁的主要挑战以及云数据库应用补丁集的优点。

Reference

https://docs.oracle.com/cloud/latest/dbcs_dbaas/CSDBI/GUID-C843AC5A-0C1C-4475-8EEC-3A13D1DD92B2.htm#CSDBI-GUID-C843AC5A-0C1C-4475-8EEC-3A13D1DD92B2