Skip to content

getting started #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
# oracle-database-azure-samples
# Oracle Database@Azure Samples

[![License: UPL](https://img.shields.io/badge/license-UPL-green)](https://img.shields.io/badge/license-UPL-green)<!--[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=oracle-devrel_oracle-database-azure-samples)](https://sonarcloud.io/dashboard?id=oracle-devrel_oracle-database-azure-samples)-->

## THIS IS A NEW, BLANK REPO THAT IS NOT READY FOR USE YET. PLEASE CHECK BACK SOON!
[![License: UPL](https://img.shields.io/badge/license-UPL-green)](https://img.shields.io/badge/license-UPL-green)

## Introduction

MISSING
Oracle Database@Azure brings Oracle's best databases - Exadata and Autonomous Database - to Microsoft Azure as a native Azure services. Modernize and deliver powerful new apps that leverage Oracle Database 23ai and Azure services:
* Build new cloud native apps using Azure services, such as Azure Kubernetes and Azure OpenAI, with Oracle Autonomous Database.
* Enhance existing apps with natural language and other generative AI capabilities.
* Quickly react to business demands using one converged, fully automated database that’s optimized for all workloads and data formats.

## Getting Started
* [Install the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/)
* [Deploy a new Oracle Autonomous Database using the Azure CLI](azure-cli/deploy-adb.md)
* Get started with Select AI ([enable access](sql/select-ai-admin-enable.sql) | [samples](sql/select-ai-get-started.sql))

MISSING
<!--

### Prerequisites

MISSING

## Notes/Issues

MISSING

## URLs

* Nothing at this time

## Contributing
-->

## Contributing
<!-- If your project has specific contribution requirements, update the
CONTRIBUTING.md file to ensure those requirements are clearly explained. -->

Expand All @@ -38,11 +39,10 @@ Please consult the [security guide](./SECURITY.md) for our responsible security
vulnerability disclosure process.

## License

Copyright (c) 2024 Oracle and/or its affiliates.

Licensed under the Universal Permissive License (UPL), Version 1.0.

See [LICENSE](LICENSE.txt) for more details.

ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
6 changes: 6 additions & 0 deletions azure-cli/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# update the values below to match your requirements
LOCATION="eastus"
RESOURCE_GROUP="resource-group-name-goes-here"
VNET_ID="vnet-resource-name-goes-here"
SUBNET_ID="subnet-resource-name-goes-here"
ADB_NAME="adb-name-goes-here"
52 changes: 52 additions & 0 deletions azure-cli/deploy-adb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Oracle Database@Azure: Create an Autonomous Database
The steps below show how to create an Autonomous Database using the Azure CLI. You will need to [install the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/) prior to running thru this example.

Run the examples below at a command prompt.

> [!NOTE]
> See the [details for onboarding Autonomous Database](https://learn.microsoft.com/en-us/azure/oracle/oracle-db/onboard-oracle-database)

## Deploy your Autonomous Database
Start by logging into Azure:
```bash
az login
```

Edit the [config file](./config) based on your deployment. These variables will be used by the Azure CLI.
```bash
LOCATION="eastus"
RESOURCE_GROUP="resource-group-name-goes-here"
VNET_ID="vnet-resource-name-goes-here"
SUBNET_ID="subnet-resource-name-goes-here"
ADB_NAME="adb-name-goes-here"
```
The VNET and SUBNET IDs must be fully qualified IDs. For example:
* **VNET_ID=**`"/subscriptions/99d4fb0e-ac2.../resourceGroups/your-resource-group/providers/Microsoft.Network/virtualNetworks/your-vnet"`
* **SUBNET_ID=**`"/subscriptions/99d4fb0e-ac2.../resourceGroups/your-resource-group/providers/Microsoft.Network/virtualNetworks/your-vnet/subnets/your-subnet"`

After updating the config file, create a new Autonomous Database by running [`./deploy-adb.sh`](./deploy-adb.sh) from the command line. You can also modify other database properties by editing the deployment script.

The script will prompte you for the Autonomous Database **ADMIN** user password. Enter a complex password.

After a few minutes, review your newly created database:
```bash
az oracle-database autonomous-database show \
--autonomousdatabasename $ADB_NAME \
--resource-group $RESOURCE_GROUP
```

## Delete an Autonomous Database
You can run the following command to an Autonomous Database:

```bash
az oracle-database autonomous-database delete \
--autonomousdatabasename $ADB_NAME \
--resource-group $RESOURCE_GROUP \
--no-wait false
```



<hr>
Copyright (c) 2024 Oracle and/or its affiliates.<br>
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
22 changes: 22 additions & 0 deletions azure-cli/deploy-adb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# ensure you update the config file to match your deployment prior to running the deployment

source ./config

az oracle-database autonomous-database create \
--location $LOCATION \
--autonomousdatabasename $ADB_NAME \
--resource-group $RESOURCE_GROUP \
--subnet-id $SUBNET_ID \
--display-name $ADB_NAME \
--compute-model ECPU \
--compute-count 2 \
--cpu-auto-scaling true \
--data-storage-size-in-gbs 500 \
--license-model BringYourOwnLicense \
--db-workload OLTP \
--db-version 23ai \
--character-set AL32UTF8 \
--ncharacter-set AL16UTF16 \
--vnet-id $VNET_ID \
--regular \
--admin-password
11 changes: 11 additions & 0 deletions sql/config.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Enter the configuration information for your Azure OpenAI deployment
*/

-- The endpoint should be the servername only. For example, myopenai.openai.azure.com
define azureOpenAIEndpoint='your-endpoint.openai.azure.com'
define userName='moviestream'
define profileName='gpt4o'
define azureOpenAICredentialName='azure_cred4o'
define azureOpenAIResourceName='your-resource-name'
define azureOpenAIDeploymentName='your-deployment-name'
44 changes: 44 additions & 0 deletions sql/security-vpd.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
CREATE TABLE "MOVIESTREAM"."VGSALES"
( "NAME" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"PLATFORM" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"YEAR_OF_RELEASE" NUMBER,
"GENRE" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"PUBLISHER" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"NA_SALES" NUMBER,
"EU_SALES" NUMBER,
"JP_SALES" NUMBER,
"OTHER_SALES" NUMBER,
"GLOBAL_SALES" NUMBER,
"CRITIC_SCORE" NUMBER,
"CRITIC_COUNT" NUMBER,
"USER_SCORE" NUMBER,
"USER_COUNT" NUMBER,
"DEVELOPER" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP",
"RATING" VARCHAR2(4000 BYTE) COLLATE "USING_NLS_COMP"
) DEFAULT COLLATION "USING_NLS_COMP" ;

CREATE OR REPLACE FUNCTION hide_eu (
v_schema IN VARCHAR2,
v_objname IN VARCHAR2)

RETURN VARCHAR2 AS
con VARCHAR2 (200);

BEGIN
con := 'Year_of_release=2009';
RETURN (con);
END hide_eu;

BEGIN
dbms_rls.drop_policy(object_schema => 'MOVIESTREAM',object_name=>'VGSALES',policy_name=>'hide_year');
end;

BEGIN
DBMS_RLS.ADD_POLICY(
object_schema => 'MOVIESTREAM',
object_name => 'VGSALES',
policy_name => 'hide_year',
policy_function => 'hide_eu',
sec_relevant_cols =>'eu_sales',
sec_relevant_cols_opt => dbms_rls.ALL_ROWS);
END;
15 changes: 15 additions & 0 deletions sql/select-ai-admin-enable.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Run this script as the Autonomous Database ADMIN user */
/* You must enable network access to Azure OpenAI for the database user that will be accessing the service */

-- config.sql contains the endpoints, resource groups and other settings required to connect to your Azure OpenAI deployment
@./config.sql

BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '&azureOpenAIEndpoint',
ace => xs$ace_type(privilege_list => xs$name_list('http'),
principal_name => '&userName',
principal_type => xs_acl.ptype_db)
);
END;
/
Loading