{"id":768,"date":"2024-09-29T16:08:36","date_gmt":"2024-09-29T14:08:36","guid":{"rendered":"https:\/\/ilmarkerm.eu\/blog\/?p=768"},"modified":"2024-09-29T16:08:36","modified_gmt":"2024-09-29T14:08:36","slug":"creating-database-software-images-in-oci-using-terraform","status":"publish","type":"post","link":"https:\/\/ilmarkerm.eu\/blog\/2024\/09\/creating-database-software-images-in-oci-using-terraform\/","title":{"rendered":"Creating database software images in OCI using Terraform"},"content":{"rendered":"\n<p>I&#8217;ll continue exploring using OCI services with Terraform. Now it is time to start looking into databases. High Oracle PM-s have been lobbying for a database image creation service, where you just supply patch numbers and Oracle will return you the fully built database home. I see that this service is now available in the cloud (for cloud databases only).<\/p>\n\n\n\n<p>I&#8217;ll try it out, using terraform.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resource \"oci_database_database_software_image\" \"db_23051\" {\n    # NB! Waits until image is provisioned\n    # This took 10m47s to provision\n    compartment_id = oci_identity_compartment.compartment.id\n    display_name = \"23-db-23051\"\n\n    image_shape_family = \"VM_BM_SHAPE\" # For use in Database Base service\n    # oci db version list\n    # NB! 23.0.0.0 seems to be behind on patches, 23.0.0.0.0 seems to be current    \n    database_version = \"23.0.0.0.0\"\n    image_type = \"DATABASE_IMAGE\"\n    # Can't find how to query that list - but the format seems quite self-explanatory\n    # Exadata Cloud Service Software Versions (Doc ID 2333222.1)\n    patch_set = \"23.5.0.24.07\"\n}<\/code><\/pre>\n\n\n\n<p>I had hard time finding out the allowed values for parameter patch_set, but they seem to be described in Doc ID 2333222.1 (and what the contents are).<\/p>\n\n\n\n<p>Examining the state of the created resource<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ilmar_kerm@codeeditor:oci-terraform-example (eu-stockholm-1)$ terraform state show oci_database_database_software_image.db_23051\n\n# oci_database_database_software_image.db_23051:\nresource \"oci_database_database_software_image\" \"db_23051\" {\n    compartment_id                           = \"ocid1.compartment.oc1..aaaaaaaasbzzr7i54kpv6oc5s7i23isiij6n2tyentd5udc34ptzagovrgqa\"\n    database_software_image_included_patches = &#91;\n        \"35221462\",\n        \"36741532\",\n        \"36744688\",\n    ]\n    database_software_image_one_off_patches  = &#91;\n        \"35221462\",\n        \"36741532\",\n        \"36744688\",\n    ]\n    database_version                         = \"23.0.0.0.0\"\n    defined_tags                             = {\n        \"Oracle-Tags.CreatedBy\" = \"default\/ilmar.kerm@gmail.com\"\n        \"Oracle-Tags.CreatedOn\" = \"2024-09-29T12:36:02.119Z\"\n    }\n    display_name                             = \"23-db-23051\"\n    freeform_tags                            = {}\n    id                                       = \"ocid1.databasesoftwareimage.oc1.eu-stockholm-1.anqxeljr4ebxpbqadhgioquzxv6qtrui72e3sn3c7iwxcljncmdq7fx5jdbq\"\n    image_shape_family                       = \"VM_BM_SHAPE\"\n    image_type                               = \"DATABASE_IMAGE\"\n    is_upgrade_supported                     = false\n    patch_set                                = \"23.5.0.24.07\"\n    state                                    = \"AVAILABLE\"\n    time_created                             = \"2024-09-29 12:36:02.123 +0000 UTC\"\n}<\/code><\/pre>\n\n\n\n<p>One thing I notice here (verified with testing), that the parameter database_software_image_one_off_patches gets pre-populated with included patches after the image is created &#8211; so you have to include the included patches also the the parameter value.<\/p>\n\n\n\n<p>With 19c version process is similar<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resource \"oci_database_database_software_image\" \"db_19241\" {\n    # NB! Waits until image is provisioned\n    # This took 16m4s to provision\n    compartment_id = oci_identity_compartment.compartment.id\n    display_name = \"19-db-19241\"\n\n    image_shape_family = \"VM_BM_SHAPE\" # For use in Database Base service\n    # oci db version list\n    database_version = \"19.0.0.0\"\n    image_type = \"DATABASE_IMAGE\"\n    patch_set = \"19.24.0.0\"\n}<\/code><\/pre>\n\n\n\n<p>I did try to apply MRP on top of it, but maybe the cloud patch numbers are different, since the usual MRP patch number did not apply on top of it.<\/p>\n\n\n\n<p>In the next post I&#8217;ll try to spin up an actual database using the image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ll continue exploring using OCI services with Terraform. Now it is time to start looking into databases. High Oracle PM-s have been lobbying for a database image creation service, where you just supply patch numbers and Oracle will return you the fully built database home. I see that this service is now available in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[68,67],"class_list":["post-768","post","type-post","status-publish","format-standard","hentry","category-blog-entry","tag-oci","tag-terraform"],"_links":{"self":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/comments?post=768"}],"version-history":[{"count":1,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/768\/revisions"}],"predecessor-version":[{"id":769,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/posts\/768\/revisions\/769"}],"wp:attachment":[{"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/media?parent=768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/categories?post=768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ilmarkerm.eu\/blog\/wp-json\/wp\/v2\/tags?post=768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}