Quickstart: Use Oracle Toolkit for Google Cloud with Compute Engine
Learn how to get started with Oracle Toolkit for Google Cloud.
This quickstart shows you how to use Oracle Toolkit to create and run an Oracle database on a Compute Engine virtual machine (VM).
The instructions in this quickstart use Google Cloud CLI.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create or select a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_ID
with your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Compute Engine API:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles.gcloud services enable compute.googleapis.com
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create or select a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_ID
with your Google Cloud project name.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Compute Engine API:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles.gcloud services enable compute.googleapis.com
- Create an auto mode Virtual Private Cloud (VPC) network.
- Create a Cloud Storage bucket to host the Oracle software image.
- Create a Compute Engine default service account.
- Grant the following Identity and Access Management (IAM) role on the Cloud Storage bucket:
To learn how to grant IAM roles and permissions, see Manage access to projects, folders, and organizations.
Create a Compute Engine VM
Create a Compute Engine VM to host the Oracle database.
Run the following command:
gcloud compute instances create VM_NAME \ --zone=ZONE \ --machine-type=MACHINE_TYPE \ --image-project=oracle-linux-cloud \ --image-family=oracle-linux-8 \ --metadata enable-oslogin=TRUE \ --boot-disk-size=20GB \ --create-disk size=DISK_SIZEGB,device-name=oracle-u01 \ --create-disk size=DISK_SIZEGB,device-name=oracle-asm-data-1 \ --create-disk size=DISK_SIZEGB,device-name=oracle-asm-reco-1
Replace the following:
- VM_NAME: a name for the VM.
- ZONE: the zone in which to create the VM.
- MACHINE_TYPE: the machine type of the VM. See Machine families resource and comparison guide.
DISK_SIZE: the size, in gigabytes, of the disk. Acceptable sizes range, in 1 GB increments, from 10 GB to 65,536 GB inclusive.
The command creates three disks, namely
oracle-u01
,oracle-asm-data-1
, andoracle-asm-reco-1
.
Download the Oracle Toolkit for Google Cloud
To download the Oracle Toolkit, run the following commands:
python3 -m venv oracle-toolkit-venv source oracle-toolkit-venv/bin/activate pip3 install --upgrade pip pip3 install ansible-core==2.16.0 jmespath
curl -L -o oracle-toolkit-master.zip https://github.com/google/oracle-toolkit/archive/refs/heads/master.zip && unzip ./oracle-toolkit-master.zip && rm ./oracle-toolkit-master.zip && mv oracle-toolkit-master oracle-toolkit cd oracle-toolkit
Download the Oracle software
Download and stage the Oracle software that you need in the Cloud Storage bucket. The Oracle Toolkit doesn't contain any Oracle software. You are responsible for procuring the required Oracle software in accordance with the applicable licenses governing such software.
To download and stage the Oracle software, do the following:
Obtain a list of required Oracle software download files. To verify the files for your required Oracle version, add the
--ora-version
argument.bash ./check-swlib.sh --ora-swlib-bucket gs://BUCKET_NAME --ora-version 19
Replace the following:
- BUCKET_NAME: the name of your Cloud Storage bucket which hosts the Oracle software image.
Download the missing files to your local machine:
- Download patches (files starting with 'p') from My Oracle Support.
- Download base releases from Oracle Software Delivery Cloud or Oracle Technology Network.
Transfer the files to the Cloud Storage bucket. Also, in the bucket itself, disable the parallel composite uploads to let MD5 signatures be recorded for file integrity verification.
gcloud storage cp *.zip gs://BUCKET_NAME --property=storage/parallel_composite_upload_enabled=False
Verify that the required Oracle software is available in the bucket.
bash ./check-swlib.sh --ora-swlib-bucket BUCKET_NAME
Install the Oracle software and create an Oracle database
To install the Oracle software and create a database, do the following:
Capture the OS login user profile.
OS_LOGIN_USER=$(gcloud os-login describe-profile)
Capture the IP address of your VM.
INSTANCE_IP_ADDR=$(gcloud compute instances describe VM_NAME --zone=ZONE --format="value(networkInterfaces[0].networkIP)")
Replace the following:
- VM_NAME: the name of the Compute Engine VM which you created earlier in this guide.
- ZONE: the zone of the VM.
Run the following command to install the software and create the database through a single command:
bash ./install-oracle.sh \ --instance-ip-addr $INSTANCE_IP_ADDR \ --instance-ssh-user $OS_LOGIN_USER \ --instance-ssh-key "$HOME/.ssh/google_compute_engine" \ --ora-version 19 \ --ora-swlib-bucket gs://BUCKET_NAME \ --ora-swlib-path /u01/oracle_install \ --ora-data-mounts-json '[{"purpose":"software","blk_device":"/dev/disk/by-id/google-oracle-u01","name":"u01","fstype":"xfs","mount_point":"/u01","mount_opts":"nofail"}]' \ --ora-asm-disks-json '[{"diskgroup":"DATA","disks":[{"blk_device":"/dev/disk/by-id/google-oracle-asm-data-1","name":"DATA1"}]},{"diskgroup":"RECO","disks":[{"blk_device":"/dev/disk/by-id/google-oracle-asm-reco-1","name":"RECO1"}]}]' \ --ora-db-name DATABASE_NAME
Replace the following:
- BUCKET_NAME: the name of your Cloud Storage bucket which hosts the Oracle software image.
- DATABASE_NAME: a name for your database. It must not be more than 8 characters, and must begin with an alphabetic character.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, delete the Google Cloud project with the resources.
Delete the Compute Engine VM:
gcloud compute instances delete VM_NAME --zone=ZONE
Replace the following:
- VM_NAME: the name of the Compute Engine VM which you created earlier in this guide.
- ZONE: the zone of the VM.
Delete the Cloud Storage bucket:
Use the
gcloud storage rm
command with the--recursive
flag to delete the bucket and anything inside of it:gcloud storage rm gs://BUCKET_NAME --recursive
Replace the following:
- BUCKET_NAME: the name of your Cloud Storage bucket.
If successful, the command returns a message similar to:
Removing gs://BUCKET_NAME/...