Skip to content

Commit 220adf2

Browse files
committed
Most of the first cut of the content
1 parent e772f5c commit 220adf2

37 files changed

+1733
-19
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,23 @@ Oracle Database@Azure brings Oracle's best databases - Exadata and Autonomous Da
99
* Quickly react to business demands using one converged, fully automated database that’s optimized for all workloads and data formats.
1010

1111
## Getting Started
12-
* [Install the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
13-
* [Deploy a new Oracle Autonomous Database using the Azure CLI](azure-cli/deploy-adb.md)
14-
* Get started with Select AI ([enable access](sql/select-ai-admin-enable.sql) | [samples](sql/select-ai-get-started.sql))
12+
* [Subscribe to Oracle Database@Azure](https://www.youtube.com/watch?v=MEB8kB_TI2I)
13+
* Deploy a new Oracle Autonomous Database
14+
* [Using the Azure Portal](https://youtu.be/QOCvRr5CfeQ)
15+
* [Using Terraform scripts](https://github.com/oci-landing-zones/terraform-oci-multicloud-azure/tree/main)
16+
* [Using the Azure CLI](azure-cli/create-adb.md)
17+
* Connect to your Autonomous Database
18+
* [Learn about connectivity options](https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/connect-preparing.html)
19+
* Use these great VS Code extensions that help you develop and debug your database apps
20+
* SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer))
21+
* Oracle Developer Tools for VS Code ([Learn More](https://docs.oracle.com/en/database/oracle/developer-tools-for-vscode/getting-started/gettingstarted.html) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools))
22+
* Sample code
23+
* Create a database user and add sample data
24+
* Work with data in Azure Storage
25+
* Get started with Select AI ([enable access](sql/select-ai-admin-enable.sql) | [samples](sql/select-ai-get-started.sql))
26+
* Create JSON table collections and access using python / REST
27+
* Run a spatial query, graph query
28+
* .... and more
1529

1630
<!--
1731

azure-cli/config

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1+
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
14
# update the values below to match your requirements
25
LOCATION="eastus"
3-
RESOURCE_GROUP="resource-group-name-goes-here"
4-
VNET_ID="vnet-resource-name-goes-here"
5-
SUBNET_ID="subnet-resource-name-goes-here"
6-
ADB_NAME="adb-name-goes-here"
6+
RESOURCE_GROUP="development"
7+
ADB_NAME="quickstart"
8+
9+
## NETWORKING
10+
# database
11+
VNET_NAME="dev-vnet"
12+
VNET_PREFIX="192.168.0.0/16"
13+
# subnet for the database
14+
SUBNET_NAME="dev-sn-db"
15+
SUBNET_PREFIX="192.168.1.0/24"
16+
# client subnet
17+
SUBNET2_NAME="dev-sn-client"
18+
SUBNET2_PREFIX="192.168.2.0/24"
19+
20+
#network security group
21+
NSG_NAME=$SUBNET2_NAME-nsg
22+
23+
## COMPUTE VM
24+
VM_NAME="adb-vm-client"
25+
VM_PREFERRED_SIZES=( "Standard_DS3_v2" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )
26+
VM_IMAGE="MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"
27+
28+
## CLOUD STORAGE
29+
# Storage accounts require a unique name across azure. Enter your unique name below.
30+
STORAGE_ACCOUNT_NAME="your-storage-account"
31+
STORAGE_CONTAINER_NAME="adb-sample"
32+
33+
## IDENTITIES
34+
# This identity will be used for your VM. The password will also be used for the database ADMIN user
35+
USER_NAME="adb"
36+
USER_PASSWORD="your-complex-password"

azure-cli/config.default

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
# update the values below to match your requirements
5+
LOCATION="eastus"
6+
RESOURCE_GROUP="development"
7+
ADB_NAME="quickstart"
8+
9+
## NETWORKING
10+
# database
11+
VNET_NAME="dev-vnet"
12+
VNET_PREFIX="192.168.0.0/16"
13+
# subnet for the database
14+
SUBNET_NAME="dev-sn-db"
15+
SUBNET_PREFIX="192.168.1.0/24"
16+
# client subnet
17+
SUBNET2_NAME="dev-sn-client"
18+
SUBNET2_PREFIX="192.168.2.0/24"
19+
20+
#network security group
21+
NSG_NAME=$SUBNET2_NAME-nsg
22+
23+
## COMPUTE VM
24+
VM_NAME="adb-vm-client"
25+
VM_PREFERRED_SIZES=( "Standard_DS3_v2" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )
26+
VM_IMAGE="MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"
27+
28+
## CLOUD STORAGE
29+
# Storage accounts require a unique name across azure. Enter your unique name below.
30+
STORAGE_ACCOUNT_NAME="your-storage-account"
31+
STORAGE_CONTAINER_NAME="adb-sample"
32+
33+
## IDENTITIES
34+
# This identity will be used for your VM. The password will also be used for the database ADMIN user
35+
USER_NAME="adb"
36+
USER_PASSWORD="your-complex-password"

azure-cli/create-adb.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Oracle Database@Azure: Create an Autonomous Database
2+
The steps below show how to create an Autonomous Database using the Azure CLI.
3+
4+
Prerequisites:
5+
* [Install the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
6+
* [Subscribe to Oracle Database@Azure](https://www.youtube.com/watch?v=MEB8kB_TI2I)
7+
* Ensure you have the appropriate user groups and privileges. See [details for onboarding Autonomous Database](https://learn.microsoft.com/en-us/azure/oracle/oracle-db/onboard-oracle-database)
8+
9+
## Deploy your Autonomous Database
10+
Use the following scripts to deploy your infrastructure and Autonomous Database. You can run the scripts independently or run `create-all-resources.sh`. Simply update the [`config`](#configuration-file) prior to running the scripts:
11+
12+
|Script|Description|
13+
|----|---|
14+
|[create-resource-group.sh](create-resource-group.sh)|Create a resource group|
15+
|[create-network.sh](create-network.sh)|Create virtual cloud network. <br><br>ADB must be deployed to a delegated subnet. In addition, ADB access is thru a private endpoint. This means it must be accessed from either the same VCN or another privileged network.|
16+
|[create-adb.sh](create-adb.sh)|Create an Autonomous Database|
17+
|[create-compute-vm.sh](create-compute-vm.sh)|Create a VM in that VCN|
18+
|[create-all-resources.sh](create-all-resources.sh)|Creates your resource group, network, ADB and VM|
19+
|[create-data-lake-storage.sh](create-data-lake-storage.sh)|Creates an Azure Data Lake Gen 2 storage account, a container and uploads sample data into that container|
20+
|[delete-all-resources.sh](delete-all-resources.sh)|Deletes your resource group, network, ADB and VM|
21+
22+
### Configuration file
23+
The Azure cli deployment scripts rely on settings found in the config file. These resources **will be created** by the scripts. Update the config file prior to running any of the scripts.
24+
25+
>**IMPORTANT:** This file will contain a password that is used to connect to Autonomous Database and the virtual machine. Set the file's permissions so that only the file's owner can view its contents:
26+
```bash
27+
chmod 600 config
28+
```
29+
30+
|Setting|Description|Example|
31+
|----|----|----|
32+
|LOCATION|Region where resources will be deployed. [See documentation](https://docs.oracle.com/en-us/iaas/Content/database-at-azure/oaa_regions.htm) for regions where Oracle Database 23ai is available|"eastus"|
33+
|RESOURCE_GROUP|Target resource group for new resources|"development"|
34+
|ADB_NAME|Autonomous Database name. This name must be unique within a region location|"quickstart"|
35+
|VNET_NAME|Virtual network|"dev-vnet"|
36+
|VNET_PREFIX|CIDR range for the virtual network|"192.168.0.0/16"|
37+
|SUBNET_NAME|Delegated subnet where the database will be deployed|"dev-sn-db"|
38+
|SUBNET_PREFIX|CIDR range for the delegated subnet|"192.168.1.0/24"|
39+
|SUBNET2_NAME|Client subnet. The VM will be deployed to this subnet|"dev-sn-client"|
40+
|SUBNET2_PREFIX|CIDR range for the client subnet|"192.168.2.0/24"|
41+
|NSG_NAME|Name of the network security group used by the client subnet|$SUBNET2_NAME-nsg|
42+
|VM_NAME|Name of the virtual machine|"adb-vm-client"|
43+
|VM_PREFERRED_SIZES|A list of VM sizes. Change these values based on region availability. The script will attempt to create a VM based on the order listed|( "Standard_GS1" "Standard_DC1s_v2" "Standard_DC2s_v2" "Standard_DC2ads_v5" "Standard_L4s" )|
44+
|VM_IMAGE|The image used by the VM|"MicrosoftWindowsDesktop:Windows-11:win11-22h2-pro:latest"|
45+
|STORAGE_ACCOUNT_NAME|The name of an Azure Data Lake Storage Gen 2 account. This name must be unique across Azure. Sample data files will be uploaded into this storage account.|"mytenancysamplestorageaccount"|
46+
|STORAGE_CONTAINER_NAME|The name of the container where files will be uploaded|"adb-sample"|
47+
|USER_NAME|The name of the user for the virtual machine|"adb"|
48+
|USER_PASSWORD|The password for both the VM and the Autonomous Database admin user|"Welcome1234#abcd"|
49+
50+
### Using the scripts
51+
Log into azure: after updating the config file:
52+
53+
```bash
54+
az login
55+
```
56+
Then, run your scripts. The following will deploy a complete environment, but you can also install independent components. Just make sure you install dependencies (e.g. a VCN prior to Autonomous Database):
57+
58+
Creating all of the resources will take approximately 15-20 minutes.
59+
60+
```bash
61+
./create-all-resources.sh
62+
```
63+
64+
Check for errors after running the script. For example, VM availability can impact the success of creating the resource. If there is an issue, simply rerun the script that creates the resource (note: you may need to update the config file).
65+
66+
## What's next
67+
Connect to your Autonomous Database!
68+
* [Learn about connectivity options](https://docs.oracle.com/en/cloud/paas/autonomous-database/serverless/adbsb/connect-preparing.html)
69+
* Use these great VS Code extensions that help you develop and debug your database apps:
70+
* SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer))
71+
* Oracle Developer Tools for VS Code ([Learn More](https://docs.oracle.com/en/database/oracle/developer-tools-for-vscode/getting-started/gettingstarted.html) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.oracledevtools))
72+
73+
#### JDBC Example:
74+
JDBC is a common way to connect to Autonomous Database. For example, you can use the **Custom JDBC URL** in the VS Code SQL Developer Extension:
75+
![connection dialog](images/connect-dialog.png)
76+
77+
Notice the `jdbc:oracle:thin:@` prefix followed by a connection string. You can find the connection string in different ways.
78+
79+
1. Go to your Autonomous Database blade in the Azure Portal and go to **Settings -> Connections**:
80+
![Azure Portal connections](images/connections-portal.png)
81+
2. Use the Azure cli script [`show-adb-info.sh`](./show-adb-info.sh). That script will return information about your Autonomous Database, including connection details.
82+
83+
<hr>
84+
Copyright (c) 2024 Oracle and/or its affiliates.<br>
85+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/

azure-cli/create-adb.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2024 Oracle and/or its affiliates.
4+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
5+
6+
echo ""
7+
echo "##"
8+
echo "# deploy autonomous database"
9+
echo "##"
10+
echo ""
11+
# ensure you update the config file to match your deployment prior to running the deployment
12+
13+
source ./config
14+
15+
# ADB requires the IDs of the networking components
16+
VNET_ID=$(az network vnet show --resource-group $RESOURCE_GROUP --name $VNET_NAME --query id -o tsv)
17+
SUBNET_ID=$(az network vnet subnet show --resource-group $RESOURCE_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME --query id -o tsv)
18+
19+
# create the database
20+
az oracle-database autonomous-database create \
21+
--location $LOCATION \
22+
--autonomousdatabasename $ADB_NAME \
23+
--resource-group $RESOURCE_GROUP \
24+
--vnet-id $VNET_ID \
25+
--subnet-id $SUBNET_ID \
26+
--display-name $ADB_NAME \
27+
--compute-model ECPU \
28+
--compute-count 2 \
29+
--cpu-auto-scaling true \
30+
--data-storage-size-in-gbs 500 \
31+
--store-auto-scaling true \
32+
--backup-retention-period-in-days 7 \
33+
--license-model BringYourOwnLicense \
34+
--db-workload OLTP \
35+
--db-version 23ai \
36+
--regular \
37+
--admin-password $USER_PASSWORD

azure-cli/create-all-resources.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
3+
4+
set -e
5+
6+
./create-resource-group.sh
7+
./create-network.sh
8+
./create-adb.sh
9+
./create-data-lake-storage.sh
10+
./create-compute-vm.sh

azure-cli/create-compute-vm.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
4+
5+
echo ""
6+
echo "##"
7+
echo "# deploy compute vm"
8+
echo "##"
9+
echo ""
10+
11+
# ensure you update the config file to match your deployment prior to running the deployment
12+
source ./config
13+
14+
VM_SIZE=""
15+
IP_PUBLIC="${VM_NAME}-pip"
16+
NIC_NAME="${VM_NAME}-nic"
17+
18+
# Function to find the first available size from the priority list
19+
find_available_size() {
20+
21+
#availableSizes=$(az vm list-sizes --location $LOCATION --query "[].name" -o tsv)
22+
availableSizes=$(az vm list-skus --location $LOCATION --resource-type virtualMachines --query "[?restrictions[?reasonCode=='NotAvailableForSubscription']].name" -o tsv)
23+
24+
for size in "${VM_PREFERRED_SIZES[@]}"
25+
do
26+
echo ""
27+
echo "search for $size"
28+
echo ""
29+
if echo "$availableSizes" | grep -q "$size"; then
30+
echo ""
31+
echo "VM size $size is available in $LOCATION. Let's create the VM."
32+
VM_SIZE=$size
33+
break
34+
fi
35+
done
36+
}
37+
38+
# check if there are any available VMs
39+
find_available_size
40+
41+
# if no VMs are available - bail.
42+
if [ -z $VM_SIZE ]; then
43+
echo "No capacity for your VM sizes in $LOCATION. Unable to create a compute VM"
44+
exit -1
45+
fi
46+
47+
# Create a public IP address for the VM
48+
az network public-ip create \
49+
--resource-group $RESOURCE_GROUP \
50+
--name $IP_PUBLIC \
51+
--sku Standard
52+
53+
# Create a virtual NIC and associate with public IP address and NSG
54+
az network nic create \
55+
--resource-group $RESOURCE_GROUP \
56+
--name $NIC_NAME \
57+
--vnet-name $VNET_NAME \
58+
--subnet $SUBNET2_NAME \
59+
--public-ip-address $IP_PUBLIC \
60+
--network-security-group $NSG_NAME
61+
62+
# Create a virtual machine
63+
az vm create \
64+
--resource-group $RESOURCE_GROUP \
65+
--name $VM_NAME \
66+
--image $VM_IMAGE \
67+
--size $VM_SIZE \
68+
--admin-username $USER_NAME \
69+
--admin-password $USER_PASSWORD \
70+
--generate-ssh-keys \
71+
--nics $NIC_NAME

0 commit comments

Comments
 (0)