DEV Community

Cover image for Connecting to your new Flashy Autonomous Database
Project-42
Project-42

Posted on

Connecting to your new Flashy Autonomous Database

By the time you are reading this, I would expect you don't need this, and that you are already using your "Always Free Autonomous Database and Cloud Infrastructure"... if that is not the case, don't worry, is never too late to start!!

Just in case, lets have a look what you got for free, for those that were living under a rock by the time all of this was announced:

Oracle Offers Always Free Autonomous Database and Cloud Infrastructure

Oracle’s Free Tier program has two components:

Always Free services, which provide access to Oracle Cloud services for an unlimited time
Free Trial, which provides $300 in credits for 30 days to try additional services and larger shapes

The new Always Free program includes the essentials users need to build and test applications in the cloud: Oracle Autonomous Database, Compute VMs, Block Volumes, Object and Archive Storage, and Load Balancer. Specifications include:

2 Autonomous Databases (Autonomous Data Warehouse or Autonomous Transaction Processing), each with 1 OCPU and 20 GB storage
2 Compute VMs, each with 1/8 OCPU and 1 GB memory
2 Block Volumes, 100 GB total, with up to 5 free backups
10 GB Object Storage, 10 GB Archive Storage, and 50,000/month API requests
1 Load Balancer, 10 Mbps bandwidth
10 TB/month Outbound Data Transfer
500 million ingestion Datapoints and 1 billion Datapoints for Monitoring Service
1 million Notification delivery options per month and 1000 emails per month

As you can see, even if you dont want to use the Database, you still can take advantage of 2 VMs in the cloud and some Free storage

As far as I notice, the only restrictions is that the DB will be stopped automatically after 7 days if has no connections but I think that is quite fair for a free service For more information on this, have a look here:

https://docs.cloud.oracle.com/en-us/iaas/Content/Database/Concepts/adbfreeoverview.htm

Regarding today's topic, more than share how to do something like connecting to your DB, what I wanted is to share some other people work (much better than mine) on this topic, so before you continue go and bookmak these blogs in case you really want to learn about Oracle cloud:

I don't remember last time I thought about an Oracle topic and didn't find the answer explained already in ORACLE-BASE

Autonomous Database (check for ADW/ATP) is of course no exception to this rule.

Miscellaneous Articles - Cloud

If you still didn't even sign up, you can just follow Tim's Instructions (he has some kind of issues and didn't show the whole credit card number though)

Oracle Cloud : Free Tier Account Sign-Up

Another brilliant set of articles made about this topic and and that you should check, were done by Dimitri Gielis

Best and Cheapest Oracle APEX hosting: Free Oracle Cloud

Very good articles, again from the start of your DB creation, to some cool and interesting deployments like Setup Object Storage and use for File Share and Backups

Anyway, is difficult to come up with good articles seen other people brilliant work, but since my idea was always to start this articles to make me more disciplined about doing some kind documentation when I'm learning new things, let me at least share how I did connect to the Database once I started it for first time Smile :)

The first we need to do is to download our wallet configurations files from the Database GUI interface

For that, just Click in "DB Connection" and then "Download Wallet" in the dialog appearing next:

Alt Text

Alt Text

For this example I used a macOS system with SQLcl already installed on it. I really recommend you to use sqlcl instead of SQL*PLUS

SQLcl Downloads

Extract the Wallet Zip file:

P42@laptop:~/Downloads/DB_WALLET# ls -lrth
total 72
-rw-r--r--@ 1 P42  staff   3.3K  1 Nov 19:26 truststore.jks
-rw-r--r--@ 1 P42  staff   2.1K  1 Nov 19:26 tnsnames.ora
-rw-r--r--@ 1 P42  staff    87B  1 Nov 19:26 ojdbc.properties
-rw-r--r--@ 1 P42  staff   3.2K  1 Nov 19:26 keystore.jks
-rw-r--r--@ 1 P42  staff   6.5K  1 Nov 19:26 ewallet.p12
-rw-r--r--@ 1 P42  staff   6.6K  1 Nov 19:26 cwallet.sso
-rw-r--r--@ 1 P42  staff   135B  1 Nov 20:00 sqlnet.ora
P42@laptop:~/Downloads/DB_WALLET#

Modify the file sqlnet.ora with the path of the wallet location

P42@laptop:~/Downloads/DB_WALLET# cat sqlnet.ora
WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/Users/P42/Downloads/DB_WALLET")))
SSL_SERVER_DN_MATCH=yes
P42@laptop:~/Downloads/DB_WALLET#

Export TNS_ADMIN variable with the right location where we have all the wallet files

P42@laptop:~/Downloads/DB_WALLET# export TNS_ADMIN=/Users/P42/Downloads/DB_WALLET

Now, choose one of the services names mentioned in the file tnsnames.ora:

P42@laptop:~/Downloads/DB_WALLET# cat tnsnames.ora
[......]

db201909271538_high = (description= 
(connect_timeout=1200)(retry_count=20)(retry_delay=3)(transport_connect_timeout=3)(address=(protocol=tcps)(port=1522)(host=adb.[.........]
 BMCS FRANKFURT,O=Oracle Corporation,L=Redwood 
City,ST=California,C=US")))

db201909271538_low = (description= 
(connect_timeout=1200)(retry_count=20)(retry_delay=3)(transport_connect_timeout=3)(address=(protocol=tcps)(port=1522)(host=adb.[.........]
 BMCS FRANKFURT,O=Oracle Corporation,L=Redwood 
City,ST=California,C=US")))

db201909271538_medium = (description=

(connect_timeout=1200)(retry_count=20)(retry_delay=3)(transport_connect_timeout=3)(address=(protocol=tcps)(port=1522)(host=adb.[.........]
 BMCS FRANKFURT,O=Oracle Corporation,L=Redwood 
City,ST=California,C=US")))

db201909271538_tp = (description= 
(connect_timeout=1200)(retry_count=20)(retry_delay=3)(transport_connect_timeout=3)(address=(protocol=tcps)(port=1522)(host=adb.[.........]
 BMCS FRANKFURT,O=Oracle Corporation,L=Redwood 
City,ST=California,C=US")))

db201909271538_tpurgent = 
(description= 
(connect_timeout=1200)(retry_count=20)(retry_delay=3)(transport_connect_timeout=3)(address=(protocol=tcps)(port=1522)(host=adb.[.........]
 BMCS FRANKFURT,O=Oracle Corporation,L=Redwood 
City,ST=California,C=US")))



and voila! we got into the Database:

P42@laptop:~/Downloads/DB_WALLET# sql admin@db201909271538_high

SQLcl: Release 19.2.1 Production on Fri Nov 01 20:01:19 2019

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Password? (**********?) ************
Last Successful login time: Fri Nov 01 2019 20:01:50 +00:00

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0


SQL>

I know this is quite basic, and if you got to see this post, you already know this, but I hope this will make you remember about oracle cloud free tier and start using it (at least is making me think about some unfinished projects I have half completed for it Tongue :p)

Top comments (0)