Skip to content

Instantly share code, notes, and snippets.

@krisrice
Last active February 2, 2021 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisrice/d8ce252c201690f4a9d50a9485b7b473 to your computer and use it in GitHub Desktop.
Save krisrice/d8ce252c201690f4a9d50a9485b7b473 to your computer and use it in GitHub Desktop.
#
# Print current instances for autonomous db
# Uses $OCI_TENANCY for compartment id since that is the "root"
#
cat > db.jq <<EOF
.data[] |
."db-name" + "\tocid:" + .id ,
"\t" + ."db-name" + "_low" ,
"\tORDS Version: " + ."apex-details"."ords-version",
"\tAPEX Version: " + ."apex-details"."apex-version",
"\tSDW: " + ."connection-urls"."sql-dev-web-url",
"\tAPEX: " + ."connection-urls"."apex-url",
"\n\toci db autonomous-database generate-wallet \\\n\t\t--autonomous-database-id " + .id + " \\\n\t\t--file mywallet.zip --password <YOURPASSWORD>",
"\n\toci db autonomous-database generate-wallet--region --file mywallet.zip --password <YOURPASSWORD>",
"\n\t sql -cloudconfig mywallet.zip admin@" +."db-name" + "_low\n"
EOF
oci db autonomous-database list --compartment-id $OCI_TENANCY | jq -r -f db.jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment