Skip links

Terraforming your way to an Autonomous Database

Oracle Cloud Infrastructure (OCI) is a good platform for many things including building enterprise grade databases on.  Over the last few years, Oracle has been promoting the Oracle Autonomous Database (ADB) quite extensively and how to build them on OCI.  The way that Oracle builds it within the OCI framework is simply through the console and wizard driven method. Now in reality when building an ADB, you may only need one or two of these types of databases depending on what you are doing in production.  For development, you would want multiple instances spun up.  Doing either of these through the console could take some time, which does not fit into a DevOps model.  To solve this problem, you would just write some code that would build an ADB or multiple ADBs in a more efficient way.  

To write the code needed, just use Terraform.  

Oracle documentation for OCI doesn’t provide any details on how to use Terraform with their infrastructure, but it can be done.  The documentation that needs to be referenced is actually under the HashiCorp docs for Terraform. Under the OCI Provider look for oci_database_autonomous_database.  This piece of documentation provides all the details needed to build an ADB within OCI.

Basic Code

The below code will work to build a basic ADB with a default workload of Data Warehouse.  What needs to be understood from this code is that there are five (5) required options that need to be provided – admin password, what compartment to build in, number of cpus needed, how much block storage should be allocated in terrabytes, and the name of the database.  This gets you a basic ADB built.

hcl
,,,,,,,,,
##############################
# OCI - Autonomous Database(s)
##############################

resource "oci_database_autonomous_database" "demo_adb" {

#Required
admin_password = “<password>"
compartment_id = "ocid1.compartment.oc1………..gmwuiynsonpq74fo2djk6hd64qu3lzw2xybym4svyhq"
cpu_core_count = "1"
data_storage_size_in_tbs = "1"
db_name = “RDADB1”

}
,,,,,,,,,,,

A bit more

The above code provides a great start, but what about a bit more control over different aspects of the database.  What if you want a different version of database or even change the workload that the database is used for.  These are all questions that can be answered by the “optional” items for the resource within Terraform.  To expand the above code to include optional options it would look similar to this:

hcl
,,,,,,,,,,
##############################
# OCI - Autonomous Database(s)
##############################

resource "oci_database_autonomous_database" "demo_adb" {

#Required
admin_password = “<password>"
compartment_id = "ocid1.compartment.oc1………..gmwuiynsonpq74fo2djk6hd64qu3lzw2xybym4svyhq"
cpu_core_count = "1"
data_storage_size_in_tbs = "1"
db_name = "RDADB1"

#Optional
db_version = "19c"
db_workload = "OLTP"
display_name = "RDADB1"
is_free_tier = "false"
license_model = "BRING_YOUR_OWN_LICENSE"
source = "NONE"

}
,,,,,,,,

What you should notice with the extend code is that the ADB will be built to support OLTP workloads using a 19c version and that you have to already own a license that you bring to the cloud. Additionally, the option is_free_tier is set to false.  This means that the ADB will be built without the limitations that are in-place for the free tier – expect to pay when used.  In this example, the last thing to point out is the source option.  Source is set to NONE because this is the default, but this is also used when you want to copy another ADB (I’ll may write something on that later).

Output

Once the ADB is built, you obviously want to get information related to that database.  In order to retrieve any information you first have to identify the id of the database after it is built.  You can write this in a output code block, but that will not be useful.  Grabbing the id and then using it in an output block is the way to go.  

To grab the id, you would write a data block of code.  It would look something along these lines:

hcl
,,,,,,,,,,
data "oci_database_autonomous_database" "demo_adb_info” {
     autonomous_database_id = oci_database_autonomous_database.demo_adb.id
}
,,,,,,,,,,

Now that you have the id, it can be referenced in an output code block to return items such as the Service Console URL.  The output block looks similar to this:

hcl
,,,,,,,,
output "service_url_adb" {
value = data.oci_database_autonomous_database.demo_adb_info.service_console_url
}
,,,,,,,,,

After the ADB is built, the output displayed will be something similar to this:

data.oci_database_autonomous_database.demo_adb_info: Refreshing state...

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

service_url_adb = https://adb.us-ashburn-1.oraclecloud.com/console/index.html?tenant_name=OCID1.TENANCY.OC1............FPRZT2SX75LWEIVOU6XEOMTO4GVJXUUYRAXCDAKFF4DUJQ&database_name=RDADB1&service_type=ATP

At this point, you can copy the service_url_adb and post it in a web browser.  It will open the Service Console for the ADB created, allowing you to review the Overview, Activity, Administration, and Development pages.

oci_adb_terraform_service_console_url.png

Summary

Although Oracle has made it quite easy to build Autonomous Databases within the OCI Consoles, HashiCorp has made it even easier to build these workloads as code.  The examples that I’ve provided in this post work for basic ADB builds, but can be expanded to provide more details if needed.

Enjoy!!!

Leave a comment

  1. Здравствуйте, друзья! Сегодня я хочу обсудить важную тему для обладателей автомобилей
    группы VAG – фирменные брелоки.

    Многие из нас встречались
    с ситуацией, когда ключ от
    машины внезапно перестает
    работать или пропадает. Такое может произойти в самый неподходящий момент, заставляя нас чувствовать себя беспомощными и разочарованными.

    Вот почему я хочу подчеркнуть важность применения только оригинальных ключей VAG.

    Оригинальные ключи VAG – это
    далеко не только кусок пластика с электроникой.
    Это высокотехнологичное устройство, разработанное специально
    для вашего автомобиля. Такие ключи гарантируют максимальную безопасность и совместимость со всеми системами
    вашего авто.
    Вот несколько причин, в пользу
    использования только оригинальные ключи VAG:

    Надежность: Оригинальные ключи произведены из материалов высшего качества, что обеспечивает их длительный
    срок службы.
    Безопасность: В них используются инновационные методы кодирования, оберегающие ваш автомобиль от несанкционированного доступа и угона.

    Широкие возможности: Новейшие брелоки обладают дополнительными
    функциями, такими как дистанционный запуск двигателя или управление климат-контролем.

    Гарантийное обслуживание:
    Фирменные брелоки поставляются с гарантией производителя, что обеспечивает
    вам спокойствие и поддержку в случае неисправности.

    А сейчас поговорим о том, где можно приобрести оригинальные ключи VAG.

    После тщательного изучения рынка я нашел проверенный магазин – Ключ Шкода Кодиак.
    У них в наличии большой выбор фирменных брелоков для
    всех моделей автомобилей VAG, включая Volkswagen, Audi, Škoda и SEAT.

    Что привлекло мое внимание,
    так это их экспертный сервис.
    Они не просто продают ключи – они обеспечивают полный спектр услуг, включая программирование
    и синхронизацию брелока с вашим транспортным средством.
    Это критически необходимо, так как
    неправильно запрограммированный ключ может оказаться
    бесполезным или даже нарушить работу электронику вашего авто.

    Вдобавок, их расценки весьма конкурентоспособны, особенно если учесть уровень предоставляемых услуг и подлинность товаров.
    У них есть различные варианты доставки,
    что очень удобно, если вы не можете приехать к ним самостоятельно.

    Подводя итог, отмечу, что вложение средств в оригинальный брелок VAG – это вклад в защиту и долговечность вашего транспортного
    средства. Не экономьте на
    этом критически важном компоненте – ваше спокойствие намного важнее.

    А вы имели опыт с заменой брелока для своего автомобиля VAG?
    Расскажите о своих впечатлениях
    в комментариях под постом!

  2. As a devoted golf player, I can not worry sufficient just how important the appropriate devices
    are to not only taking pleasure in the game yet likewise boosting your performance on the training
    course. Golf is as much a psychological video game as it is physical, and having the appropriate gear can actually make a difference in exactly how
    you approach each round.

    To start with, allow’s discuss golf gloves.
    Several players underestimate the relevance
    of a great glove. It’s not almost preventing sores; a glove
    assists you preserve a regular grip on your club, which is vital for controlling your shots.

    Particularly in moist or damp problems, a good handwear cover can be the
    distinction in between a strong drive and a wild slice.

    Gloves with a snug fit made from premium natural leather
    have a tendency to offer the most effective performance.
    They mold to your hand over time, supplying both comfort and integrity.

    Another usually ignored device is the golf tee. Yes, it’s a little product, but the right tee
    can really affect your video game. For instance, using much longer
    tees with your motorist can aid you accomplish better
    launch angles, while much shorter tees are excellent when you require more
    control with your irons. Personally, I favor utilizing eco-friendly or plastic tees since they’re extra
    durable and green.

    Golf bags are an additional necessary that are entitled to even more attention than they normally get.
    A well-designed golf bag isn’t nearly design– it’s about performance and
    comfort. If you favor walking the course, a lightweight stand bag with
    great storage choices can make your round far more delightful.
    On the other hand, if you’re riding in a cart, a cart bag with lots of space for
    all your equipment is a must. The right golf bag aids you stay arranged,
    which is crucial when you require to focus
    on your game.

    One device that’s ending up being increasingly popular
    is the rangefinder. I can’t inform you just how much this little gadget has enhanced my game.

    Understanding the precise range to the pin or hazards allows you to choose the right club with self-confidence.
    Whether you go with a laser rangefinder or a GPS one, the precision these devices offer is important.

    Lastly, never ever ignore the importance of a great golf towel and
    umbrella. A towel maintains your clubs and spheres clean, guaranteeing
    much better call and accuracy, while an umbrella is a lifesaver during unanticipated weather condition changes.
    These small things add to the total top quality of your game.

    To conclude, buying the appropriate golf devices is crucial for anyone significant concerning improving their video
    game. Whether it’s a handwear cover that fits just right, a long lasting
    golf bag, or a high-tech rangefinder, having the
    right devices can make every round a lot more enjoyable and effective.
    For anybody searching for in-depth evaluations and expert suggestions on the very best golf equipment, I
    very recommend checking out https://butik.copiny.com/question/details/id/928542.