|
| 1 | +# Oracle Database@Azure: Sample SQL Scripts |
| 2 | +Numerous SQL scripts are available to help you get started using Autonomous Database on Oracle Database@Azure |
| 3 | + |
| 4 | +Prerequisites: |
| 5 | +* [Create an Autonomous Database](../azure-cli/create-adb.md) |
| 6 | +* A VM deployed on the same VCN as Autonomous Database (or on a network that can access your Autonomous Database) |
| 7 | +* Use these great VS Code extensions that help you develop and debug your database apps: |
| 8 | + * SQL Developer for VS Code ([Learn More](https://www.oracle.com/database/sqldeveloper/vscode/) | [Marketplace](https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer)) |
| 9 | + * 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)) |
| 10 | + |
| 11 | +## Connect to Autonomous Database |
| 12 | +There are [numerous client tools](../azure-cli/create-adb.md#whats-next) that you can use to start working with Autonomous Database. This includes the built-in SQL Worksheet that's part of the Database Tools (and available from the linked OCI Console) or a tool like VS Code and one an Oracle Database extension. |
| 13 | + |
| 14 | +## Sample scripts |
| 15 | +Try out these scripts to learn how to get started using Autonomous Database. Simply update the [`config.sql`](#configuration-file) script prior to running the samples: |
| 16 | + |
| 17 | +|Script|Description| |
| 18 | +|----|---| |
| 19 | +|[data-create-sample-schema.sql](data-create-sample-schema.sql)|Create a sample user and install sample data| |
| 20 | +|[data-create-synthetic-data.sql](data-create-synthetic-data.sql)|Use AI to generate sample data sets| |
| 21 | +|[data-import-from-datalake.sql](data-create-synthetic-data.sql)|Import sample data from Azure Data Lake. Sample data was uploaded using the [`create-all-resources.sh`](../azure-cli/create-all-resources.sh)and [`create-data-lake-storage.sh`](../azure-cli/create-data-lake-storage.sh) scripts. You can run [`show-data-lake-storage-info.sh`](../azure-cli/show-data-lake-storage-info.sh) to get connection information to the storage container.| |
| 22 | +|[data-export-to-datalake.sql](data-export-to-datalake.sql)|Export data from a table to your data lake storage| |
| 23 | +|[select-ai-admin-enable.sql](select-ai-admin-enable.sql)|Autonomous Database is secure by default. In order to access external services, you will need to enable connectivity. This script enables connectivity to your Azure OpenAI resource.| |
| 24 | +|[select-ai-create-profile.sql](select-ai-create-profile.sql)|A Select AI profile is used to connect to your AI provider. It includes information about your provider plus tables and view that you want to be targets for natural language queries| |
| 25 | +|[select-ai-nl2sql.sql](select-ai-nl2sql.sql)|Use natural language to query your data| |
| 26 | +|[select-ai-sql-function.sql](select-ai-sql-function.sql)|Use Select AI SQL functions to apply AI to your data. These examples summarize a support chat and make product recommendations based on info in your database| |
| 27 | +|[select-ai-rag.sql](select-ai-rag.sql)|Select AI makes it easy to create AI vector pipelines and then ask questions using AI and your organization's knowledge base| |
| 28 | + |
| 29 | + |
| 30 | +### Configuration file |
| 31 | +Many of the SQL scripts rely on information found in your [config.sql](config.sql) file. Update the config file prior to running any of the scripts. |
| 32 | + |
| 33 | +>**IMPORTANT:** This file will contain sensitive data that should be protected. Set the file's permissions so that only the file's owner can view its contents: |
| 34 | +```bash |
| 35 | +chmod 600 config.sql |
| 36 | +``` |
| 37 | + |
| 38 | +|Setting|Description|Example| |
| 39 | +|----|----|----| |
| 40 | +|CONN|JDBC Connection. [Go here](../azure-cli/create-adb.md#jdbc-example) to see how to get the connection details.|jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1521)(host=your-host.oraclecloud.com))(connect_data=(service_name=my_quickstart_medium.adb.oraclecloud.com))(security=(ssl_server_dn_match=no))) |
| 41 | +|USER_NAME|Database user that will contain sample data|'moviestream'| |
| 42 | +|USER_PASSWORD|Password for the sample database user|'watchS0meMovies#' |
| 43 | +|**Select AI and GenAI**| |
| 44 | +|AZURE_OPENAI_RESOURCE_NAME|Name of the Azure OpenAI endpoint|'dev-adb-azure-openai'| |
| 45 | +|AZURE_OPENAI_ENDPOINT|Your Azure OpenAI endpoint (server name only)|'my-openai.openai.azure.com'| |
| 46 | +|AZURE_OPENAI_DEPLOYMENT_NAME|Your Azure OpenAI deployment name|'gpt-4o'| |
| 47 | +|AZURE_OPENAI_KEY|Azure OpenAI secret key|'3Cu9AB...H53'| |
| 48 | +|AZURE_OPENAI_PROFILE_NAME|The Select AI profile that will reference your Azure OpenAI deployment|'gpt4o'| |
| 49 | +|AZURE_OPENAI_CREDENTIAL_NAME|The database credential that will be used to connect to Azure OpenAI|'azure_cred4o'| |
| 50 | +|**Azure Data Lake Storage**| |
| 51 | +|STORAGE_ACCOUNT_NAME|Name of your Azure Data Lake Storage Gen 2 account. You can run [`show-data-lake-storage-info.sh`](../azure-cli/show-data-lake-storage-info.sh) to get storage details|'mysamplestorage'| |
| 52 | +|STORAGE_URL|Azure data lake storage URL|'https://mysamplestorage.blob.core.windows.net/adb-sample' |
| 53 | +|STORAGE_KEY|The secret key used to connecto Azure Data Lake Storage|'dJVNxq1YTT...jp/g==' |
| 54 | + |
| 55 | +You can find the Azure OpenAI settings in the Azure OpenAI Studio: |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +<hr> |
| 60 | +Copyright (c) 2024 Oracle and/or its affiliates.<br> |
| 61 | +Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/ |
0 commit comments