SQL*Plus Client connections to several Oracle Autonomous (Always-Free)

Oracle Autonomous is a great service and Always-Free is a nice offering launched at OpenWorld 2019. But what happens if I need to connect via SQL*Plus to two or more ADB from the same machine/terminal? The Oracle documentation provides good reference usable when connectiong to one autonomous database but if we need to use several ADB’s, the instructions provided by Oracle will be usable only if we keep changing the local TNS_ADMIN environment variable! That would not be possible for some of my Clients that have single TNS_ADMIN location and content that is managed at entreprise level! So I did the following: Created two serverless ADB by using the Always-Free offer: TRAINING1 is an ADW TRAINING2 is an ATP downloaded the wallets for both databases tested connection via wallets from SQL Developer (GUI) –> OK create two separate directories that will store the wallets and their contents, one for each ADB place the wallets in their own correspondent directory: go into each of the newly created direcotries and unzip the wallets: up to this point, the steps are very similar with Oracle’s documentation and with Tim Hall’s blog. One way to use SQL*Plus at this point would be to change the Oracle delivered sqlnet.ora as per the Oracle documentation and switch the TNS_ADMIN setting towards tohe service I wish to connect to. But I want to avoid setting an environment variable every time I need to change the database I […]

Read More →

Overview: SELECT SAMPLE

One feature that many developers and data analysts are not aware of is the SAMPLE function in Oracle. It is quite an old feature (not sure exactly when it was added). Below is a simple example of how it works. We use a table with 9 000 000 rows and seelct from it with a sample percentage of 0.0001 We […]

Read More →

Estimate Defragmentaton Benefits for a Bigfile Tablespace

Database: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 – Production Version 19.3.0.0.0 I write this post in order to follow step by step how a bigfile tablespace is created and managed in 19c. The main purpose is to find a way to estimate the space benefits of defragmenting the tablespace. I will use two methods: Method 1. By calculating the theoretical size of the tables. It is outlined below in steps 19-20. The limitation of this calculation is that right now it works for tables only Method 2. By using the Segment Advisor. Outlined below in steps 21-22 1. Check the datafile does not exist at OS level: 2. Create the tablespace as user SYSTEM: 3. Check DB file getting created: 4. Login as ‘radu’ user. Create test tables in the test_tbs tablespace: 5. Check size of the DB file. Should not be changed: 11M 6. Run test SQL: Output: 7. Populate first test table with 9 million rows. Example of block used to populate the table: 8. Check size of the DB file –> 291M 9. Run the control SQL from step 6. Used –> 284M 10. Populate second test table with 9 million rows. 11. Check size of the DB file –> 526M 12. Run the control SQL from step 6. Used –> 500M 13. Delete all the rows from the first test table and commit. 14. Check size of the DB file –> 526M. Unchanged 15. Run […]

Read More →

Oracle Instant Client for macOS (Intel x86)

Oracle does not release anymore full client packages for the Mac clients. Therefore, we need to use the Instant Client from: https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html The installation is quite simple but we need to rememeber that, in order to have a functional client for a DBA we would need to download three packages at least: Basic Package – All files required to run […]

Read More →

Remove Last Character of Each Line

I had to modify a file for loading into an Oracle database with SQL*Loader. The file was using as field delimiter the | pipe character and each line was ending in a |. So ideally, I would like to remove the pipe chracter that ends each of the 384 016 850 lines of my text file. One option is to use vim macros but I chose to use sed. The Linux command that would work is: but I noticed with surprise that this command would not work in mac OS! After a bit of investigation, I found out that the sed implementation on macOS is a bit different so the command on macOS is: note the extra characters that make the difference!

Read More →