[Autonomous Database]メンテナンス（パッチ）情報確認

Autonomous Database（ADB）では、事前適宜のメンテナンス・ウィンドウを使用して自動的にパッチが適用されます。

# 次回メンテナンスの確認
* OCIコンソールの「Autonomous Databaseの詳細」→「**メンテナンス**」から次回のメンテナンス（パッチ適用）予定日を確認できます。

* ```履歴表示```から過去のメンテナンスの履歴を確認できます

![adb.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/449014/7b014859-816e-8126-0f47-5ec6a3dd3996.png)

![adb2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/449014/0e1cd9b4-4192-5ddf-3a43-7b42120ef644.png)

# パッチの詳細を確認
* パッチの詳細を確認するにはADBにログインし、```DBA_CLOUD_PATCH_INFO```ビューを問い合せます。

```sql
set pages 200 line 200
col BUG_NU for a20
col BUG_TITLE for a130
col COMPONENT_NAME for a15
col PATCH_VERSION for a15
SELECT * FROM DBA_CLOUD_PATCH_INFO ORDER BY PATCH_VERSION;
```
```sql
   BUG_NUM BUG_TITLE                                                                                                                          COMPONENT_NAME  PATCH_VERSION
---------- ---------------------------------------------------------------------------------------------------------------------------------- --------------- ---------------
  30978304 ORA-20000 DURING IMPDP WITH STATS AND THE UNIQUE INDEX FOR THE PK IS NOT CREATED                                                   RDBMS           ADBS-21.10.1.2
  32863831 KUP-11504: ERROR FROM EXTERNAL DRIVER:  JAVA.LANG.INTERNALERROR  -  SR 3-25860122051                                               CLOUDSQL        ADBS-21.10.2.1
  32917191 404 NOT FOUND --> /ORDS/_INSTANCE-API/STABLE/DATABASE-POOLS/                                                                       ORDS            ADBS-21.10.2.1
  33335420 UPDATE WITH SELECT JSON_TABLE RETURNS WRONG RESULT                                                                                 RDBMS           ADBS-21.10.2.2
  32965460 ORA-17500 WHEN STARTING THE DATABASE USING "SQLPLUS / AS SYSDBA".                                                                  RDBMS           ADBS-21.10.2.2
  33388473 OGG-02092  Unexpected condition in indexOutOfRangeError at line 50. Index 40 out of range. Number of elements: 25                  RDBMS           ADBS-21.10.2.2
  32857719 AC: APPLICATION CONTINUITY FOR OCI SHOULD RETURN ORIGINAL ERROR WHEN REPLAY IS NOT POSSIBLE                                        RDBMS           ADBS-21.10.2.2
  33065526 ORA-00600 [KTCRAB: CALLER PASSED INVALID XCB] DBMS_SQLCONTROL_INTERNAL                                                             RDBMS           ADBS-21.10.2.2
  32198292 EGUL-DEV1|SQLEXCEPTION: ORA-00600: INTERNAL ERROR CODE |US2GD6IV1                                                                  RDBMS           ADBS-21.10.2.2
  33182152 AH: TO DUMP OBJD BLOCK DISKLOCATOR ROWID WITH ORA-600:[KOKL_KAF:INVALID LOCATOR VERSION]                                           RDBMS           ADBS-21.10.2.2
  32303211 PROVIDE BUG FIX CONTROL FOR BUG18655662                                                                                            RDBMS           ADBS-21.10.2.2
  32831901 ATP-D: DG LOST WRITE ON DG SETUP BETWEEN : HYD (PRIMARY) / YYZ (STANDBY)                                                           RDBMS           ADBS-21.10.2.2
  33178223 QUORUM DISK VALIDATIONS FROM CELLCLI NOT WORKING AFTER FIX FOR 32139531                                                            RDBMS           ADBS-21.10.2.2
  30994996 PROBLEMS IN CATMVRS.SQL OF BUG:30083002                                                                                            RDBMS           ADBS-21.10.3.2
  31117282 ORA-65390: UNABLE TO MARK THE APPLICATION OBJECT AS SPECIFIC LINK IN APPLICATION CONTAINER                                         RDBMS           ADBS-21.10.3.2
  32944321 NO PRIVILEGE ASSIGNED TO ADBSNMP USER                                                                                              METADATA        ADBS-21.10.4.1
  32626703 DATA PUMP NETWORK IMPORTS CRASHES 1031 ERROR                                                                                       METADATA        ADBS-21.10.4.1
（略）
```

# メンテナンス（パッチ適用）情報を表示
* ```DB_NOTIFICATIONS```ビューを問い合わせると、ADBのメンテナンス・ステータス通知などを確認できます。
```sql
set pages 200 line 300
col type for a15
col TIME for a35
col EXPECTED_START_DATE for a35
col EXPECTED_END_DATE for a35
col ACTUAL_START_DATE for a35
col ACTUAL_END_DATE for a35
col MAINTENANCE_PRODUCT for a10
col MAINTENANCE_STATUS for a10
col DESCRIPTION for a50
col PATCH_ID for a15
SELECT * FROM DB_NOTIFICATIONS WHERE TYPE = 'MAINTENANCE';
```
```sql
TYPE            TIME                                EXPECTED_START_DATE                 EXPECTED_END_DATE                   ACTUAL_START_DATE                   ACTUAL_END_DATE       MAINTENANC MAINTENANC DESCRIPTION                                         PATCH_ID
--------------- ----------------------------------- ----------------------------------- ----------------------------------- ----------------------------------- ----------------------------------- ---------- ---------- -------------------------------------------------- ---------------
MAINTENANCE     22-03-11 23:18:14.656665 +00:00     22-03-18 23:00:00.000000 +00:00     22-03-19 01:00:00.000000 +00:00     22-03-19 05:01:12.000000 +00:00     22-03-19 06:01:09.000000 +00:00     DATABASE   COMPLETED  Maintenance run has ended                             ADBS-22.3.3.2
MAINTENANCE     22-03-19 05:01:12.392859 +00:00     22-03-25 23:00:00.000000 +00:00     22-03-26 01:00:00.000000 +00:00     22-03-25 23:00:02.000000 +00:00     22-03-25 23:28:36.000000 +00:00     DICTIONARY COMPLETED  Maintenance run has ended                             ADBS-22.3.4.2
MAINTENANCE     22-03-25 23:00:02.817669 +00:00     22-04-01 23:00:00.000000 +00:00     22-04-02 01:00:00.000000 +00:00     22-04-01 23:07:36.000000 +00:00     22-04-02 00:06:35.000000 +00:00     DATABASE   COMPLETED  Maintenance run has ended                             ADBS-22.4.1.1
MAINTENANCE     22-04-01 23:07:36.692508 +00:00     22-04-08 23:00:00.000000 +00:00     22-04-09 01:00:00.000000 +00:00     22-04-08 23:00:02.000000 +00:00     22-04-08 23:18:13.000000 +00:00     DICTIONARY COMPLETED  Maintenance run has ended                             ADBS-22.4.2.2
MAINTENANCE     22-04-08 23:00:02.636989 +00:00     22-04-15 23:00:00.000000 +00:00     22-04-16 01:00:00.000000 +00:00                                                                  SCHEDULED  Maintenance run is scheduled for the instance
```

# 参考
* [32 メンテナンス・ウィンドウ、パッチ適用オプション、タイム・ゾーン・データ更新、作業リクエスト、イベントと通知および顧客連絡先の管理と表示](https://docs.oracle.com/cd/E83857_01/paas/autonomous-database/adbsa/maintenance-windows-patching.html#GUID-AFF19A13-6B82-4FCE-9272-A0F3F5B32CB4)
* Autonomous Database 技術FAQ - [パッチ・メンテナンス関連](https://oracle-japan.github.io/ocidocs/faq/services/autonomous/autonomous-database-faq/)