Install Oracle Developer 10G on Windows 11

Today I re-installed Windows 11 on my computer. Actually I had upgraded from Windows 10 to Windows 11 on October 5th, 2021 the same day Microsoft released the half baked OS to public & all of a sudden I realized that, it was a blunder. So, after regretting over a month, I decided to re-install the OS and started installing all my development tools & you know what, I had to refer my Windows 7 post for installing Oracle Developer Suite 10g on my Windows 11!

Much of the post below is from the earliest post that I had for Windows 7, explaining hacks to install Oracle Database 10g and the Suite. Oracle Database 10g is not anymore significant, hence I removed the database part and posting the rest for few unfortunate Oracle developers out there. Well, 10g is used by many business application as on date & if you are looking for a method to install Oracle Database 10g on Windows 11, Please search the blog for Database 10g and you will land on multiple posts explaining to how (Refer Windows 10 articles)

Step 1 Setup Virtual Memory

If your computer has 8GB or more physical memory, all you need is to setup the Virtual Memory for the name sake. Limit the virtual memory to 2048 (2G) or max 4096 (4G). Please use the below images only for reference purposes. After changing the Virtual Memory, You will be asked to restart the computer and please restart.

Step 2 Setting up the Developer Suite

Depending upon the media that you are using for the installation, Oracle Developer 10g has 2 discs & I have copied the content from both disks inside a folder on my computer. (As you could see in the image above)

Open the Disk 1 folder and locate “Setup.exe’, right click and change the compatibility to Windows XP Service Pack 2 or 3 (doesn’t make any difference)

That’s all. Right click and run “setup.exe” as Administrator. If you have a JAVA installation already on the computer, you might receive a warning message for missing entry point, that you can safely ignore.

Follow the same compatibility setting for patch sets, if you have any. Let me know about your experience through comments.

Install Oracle 21c database on Windows

If you have already installed Oracle 19c following instructions available here, installing Oracle database 21c is not much different. Basically 21c is “Innovation Release” & 19c is going to be the long supported version as on date. It plainly means, there is no need to hurry to upgrade your 19c to 21c as next release will be the next long supported version.

Let us see how to install Oracle 21c on Windows (Installed on Windows 10 21H1) & the instructions are same for Windows 11 also.

You can download the 21c Windows installation media from Oracle Database 21c Download for Microsoft Windows x64

Extract the .zip and change the root folder to something like “Oracle12c” (or a name that prefer. Please avoid using spaces with the folder name, example: “Oracle 21c”)

I used a virtual machine with single drive, hence the zip file was extracted and I renamed the extracted folder root to “Oracle21c”

Once the folder is renamed to your choice, open the folder and execute the “setup.exe” as administrator. Please note, you must start the setup as administrator, regardless whether your Windows user account has administrator privileges on the system.

This will kick start the installation process and depending upon the resources available it could take minutes before the installation GUI appears for you.

Choose “Server class” regardless whether you are installing it on a Server OS or client OS. It’s all about managing the resources.

Now, this is a very interesting perspective. “The software directory is the Oracle Database home directory” & the path that you will mention in the edit box is going to be the Oracle base. I hope, now you understood why renaming the media extracted folder to a very meaningful name is important. As usual Oracle suggests you the defaults, however I recommend you to follow a pattern that you can feel comfortable with.

As you could see, the default installation sets up one pdb. You may rename the default PDB at this level.

Here I left everything to defaults as my intentions were pretty limited to installation. Unless you have a reason to set up Automatic Memory management, go ahead with the well trusted manual management, that gives you granular level control on how the memory is utilized by the database.

You can change the database character set to another from the “Choose from the following list of character sets” (Specifically for Arabic and other left to right languages)

You may choose a different location for the database data files. Just make sure that the current user has full access to the path.

Use the same password for a TEST installation & follow the Oracle recommendations for PRODUCTION environments. Please note, it’s better to use the complex passwords with expiry disabled for the default profile.

That’s all folks. It’s not like the earlier times when one had to hack the installation files to install Oracle database on newer Windows OS. Starting from 11g, Oracle database gets installed on Windows 7 and later OS without complaining as long as the OS is fully patched with updates and .NET components.

Hope this post helps few newbies (& me)

Oracle “directory” object | OS level permissions

We are using Oracle EBS R12 and for a custom module, wanted to log the Oracle seeded API outputs to custom log files for later scrutiny & error corrections.

Following the standard procedure, create the folder like below

create or replace directory OMS_LOGS as '/u01/applmgr/oms_logs'

and started testing the directory using SQL Developer where I am logged in as APPS user

I kept getting the below errors

ERROR at line 1:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at line 8

and the detailed errors said this could be due to OS level access permissions. Luckily I landed on a stackoverflow discussion & one of the answers clearly said this error “could” be due to the file/folder permissions for user “oracle”.

As “root” I changed the permissions for the path “/u01/applmgr/oms_logs” like below

chmod g+w /u01/applmgr/oms_logs

and that fixed the invalid file operation errors. Hope this helps someone out there!

Windows 11 | Dial a VPN Connection using PowerShell script

I started blogging once after upgrading to Windows 7 & posted mostly about the ridiculous bugs Microsoft exported with that OS. Gradually Windows 7 got matured (hardly ever fixing the yellow triangle network icon issue) & my entire attention switched to what I do for salaries, Oracle development & later much of my posts were about the stack.

Now Microsoft has released another half cooked OS, Windows 11. From a layman perspectives I cannot understand how someone could make such decisions that affect the established stability and ease of use of an OS that creates huge disappointments for general userbase!

Other than cosmetic changes and revamped settings area, I cannot defer Windows 11 from Windows 10, plus the disappointment of losing the start menu that I was getting used to after loads of patience and efforts. Among many of such grievances, connecting to VPN at work is so ridiculous, requiring 4 mouse clicks! So I decided to go with a cmd/powershell script this time to avoid those 4 mouse clicks.

After weighing the possibilities of extending , I decided to go with PowerShell (Version 5)

So let us check how it works. Copy the following in to a text file

rasdial.exe "Your VPN Name"

Save the file as “Dial VPN.ps1” or any other name you prefer with extension “.ps1”.

Make sure you wrap the VPN name using double quotes. “rasdial.exe” is not a powershell cmdlet, an old Windows OS friendly dialer. This executable is generally found in the Windows\System32 folder and there is no need to specify the path, unless you modified the PATH environment variable. Now create a new shortcut on the desktop and type/copy the following (Please adjust the file path as per your setup) as command for the shortcut

powershell.exe -File "C:\scripts\Dial-VPN.ps1"

Usually I keep all my scripts in a folder named “Scripts” on the C: drive. Hence the -File parameter clearly mentions the script’s path.

That’s all, you can double click and open the pre-configured VPN connection without going through the 4 click hassles on Windows 11 (or multiple clicks on other Windows OS versions)

Now, let us look at a fancier version of the above. What if you want to connect if not connected and disconnect if already connected? Please note, this script could be extended beyond this level depending upon specific requirements. I have started with the skeleton and will be happy to receive better scripts from you.

#https://community.spiceworks.com/topic/2271983-auto-connect-vpn
#http://woshub.com/popup-notification-powershell/
            
$vpnname = "Your VPN Name"
$vpnusername = "YOURUSERNAME"
$vpnpassword = "YOURPASSWORD"
$cmd = $env:WINDIR + "\System32\rasdial.exe"
            
try{
$vpn = Get-VpnConnection -Name $vpnname -ErrorAction Stop
Write-Host $vpn.ConnectionStatus
}
catch {
$message = $_
$wshell = New-Object -ComObject Wscript.Shell
$Output = $wshell.Popup("Failed to retrieve Connection status. $message",0,"VPN Connection Status",64)
}
            
if ($vpn.ConnectionStatus -eq "Disconnected")
{
$expression = "$cmd ""$vpnname"" "
Invoke-Expression -Command $expression 
$wshell = New-Object -ComObject Wscript.Shell
$Output = $wshell.Popup("VPN Connected",0,"VPN Connection Status",64)
}
else {
$wshell = New-Object -ComObject Wscript.Shell
$Output = $wshell.Popup("Your VPN Connection will be disconnected, Are you sure?",0,"VPN Connection Status",4+32)

if($Output -eq 6){
$expression = "$cmd ""$vpnname"" /DISCONNECT"
Write-Host $expression
Invoke-Expression -Command $expression 
$wshell = New-Object -ComObject Wscript.Shell
$Output = $wshell.Popup("VPN Disconnected",0,"VPN Connection Status",64)
}

}
#start-sleep -seconds 30
 

Please note, I am a beginner with PowerShell(Also) and always will be. As usual, I have provided the links to original codes & possible other links those helped me to device the above.

The above can, dial your VPN connection, warn you before you disconnect etcetera. For my ease, I prefer to use the extended version of the script as I keep on switching the connections. You may able to extend the script once again by accepting the VPN connection name, so that you can use the same script for dialing different VPN connections (if you have many)

Have suggestions? please pass them to me through the comments section.

Windows 11 | Remote Server Administration Tools (RSAT)

A wonderful article about installing RSAT (Remove server administration tools) on Windows 11 is available at How To Install RSAT On Windows 11 PCs HTMD Blog (anoopcnair.com)

I would like reiterate something Anoop has mentioned in his article. If you are using Microsoft SCCM or Windows Update Services (WU), then you must enable the local group policy as he has mentioned clearly in his post.

The image attached by Anoop could be bit confusing for the local group policy setup, hence I am uploading one with better visibility. The path is “Computer Configuration->Administrative Templates->System” & you need to open “Specify settings for optional component installation and component repair”

No need to reboot the computer for installing RSAT components. Follow Anoop’s thread and be a happy Administrator!

Linux | File Cleaner | bash script

Recently we setup a Linux server for keeping backups & decided not to use certain switches while the backups were synched from Windows machines. This created an additional situation like maintaining the storage space based on different business requirements and using our own solutions. So the following script was developed. Please note, this script has been tested on CentOS/RHEL/OEL 7 environment & executed with root privileges.

#!/bin/bash

# Cleanup tool for Linux Samba Server
# Rajesh Thampi
# Date: Sep 2021
# Instructions
# Copy the script to a file with .sh extension
# Make it executable (eg: chmod +x filecleaner.sh)
# Execute! (eg:./filecleaner.sh 1>filecleaner.log 2>filecleaner.err
# And be careful :)


function purgeit(){
# local DIRNAME="$1"
# local FILETYPE="$2"

cd "$1"
echo "Entered Directory: ${PWD}"
#Logic
#Check whether $3 number of files matching the patterns provided by $2 are present those were created within $4 days, then delete all files older than $4 days
 
if [ $(find -maxdepth 1 -name "$2" -type f -mtime -"$4" | wc -l) -ge $3 ]; then
local OBSFILECNT=$(find -maxdepth 1 -name "$2" -type f -mtime +"$4" | wc -l)
echo "There are ${OBSFILECNT} files & will be purged"
local obsfiles=$(find -maxdepth 1 -name "$2" -type f -mtime +"$4")

#The below loop is ONLY for logging purpose
#We'll delete all files matching the pattern in a single line command using "find"

        if [ $OBSFILECNT -gt 0 ]; then
        echo "Below Files will be deleted"
        for eachfile in "$obsfiles"
                do
                echo "$eachfile"
                done
                #find and delete will eliminate the need to treat files with space and other escape characters in the filenames.
                find -maxdepth 1 -name "$2" -type f -mtime +"$4" -exec rm -rf {} \;
        fi
fi
}

#Call the function passing four variables: path, type of the files to purge, number of files to keep & age of the files
#those need to be deleted

#syntax: purgeit "/backup/server_sql" ("*.txt" OR "my*.php" OR "*" OR "*.*") 4 5
#example: purgeit "/backup/server_sql" "*.zip" 4 5
#You can call this function N number of times passing different paths and other values

Now let us see the logic in details.

Consider you have a path “/backup/server_sql” where your Microsoft SQL Server is uploading a full backup daily. As we are synching the backup files using ROBOCOPY from the Windows server without mirroring, the daily full backup files will start mounting in the Linux files server. Then we came up with a business plan to:

  • Keep minimum 4 number of most recent full backups for the SQL server in the Linux path those were created within last N number of days. If there are no files for last N days found, existing files will not deleted (gives an opportunity to investigate why there are no files uploaded to Linux file server)
  • Delete files those are 5 days or older from the Linux path after insuring minimum N number of files are within the repository.
  • Combined with a function send alert emails, this small snippet could function as both a storage maintenance and monitoring tool.

Interested about including email alerts? Let us know and will share the additional code with you exclusively.

Oracle Application | “apps” user account is locked!

Today while running automatic configuration on the Application Tier, I entered the “apps” user password wrong! After the automatic configuration completed, having errors, I couldn’t start the Application tier.

It just said invalid password or database is not open.

Later after going through adautoconfig log files, I could see a number of failed connection attempts stating the account was locked, however I least expected this account to be “apps” (issues that one runs into when not properly exposed to the stack)

I opened SQL from application user and tried to login as apps/apps & was told the account was locked. I unlocked the apps account and ran the autoconfig once again, this time supplying the correct password. Everything went smooth and I was able to start the Application Tier.

So this is what happened. I supplied a wrong password for autoconfig & consecutive attempts to connect database from different scripts used the same credentials & after 10 failed attempts the account got locked up! causing rest of the issues.

So, be very careful when you are supplying apps password to scripts. As I am not an APPS DBA, it took me a while to figure this one out!

Optionally you may apply a better solution as mentioned here. Regardless, just be careful when you are supplying “apps” user password

Windows | Search & WIFI cannot type

There are situations, especially while using Windows 10 gen OS (Windows 2016+ Servers included) a user might not able to type inside

  • Windows Search Textbox
  • WIFI Password Textbox

For some strange reasons, typing inside these text boxes are supported by “CTF Loader”(C:\Windows\System32\ctfmon.exe)” & that is loaded into computer’s memory normally after a restart/reboot.

This is facilitated by one of the Windows Tasks & certain attempts like using KMSPICO tool to activate Microsoft software, which is ILLEGAL and many times breaks this Task.

So, how do we fix it? There are two different approaches

  • Rebuild the Task
  • Using Registry

We’ll see both methods in detail now.

1# Rebuild the Task

If the KMSpico tool or other reason corrupts the Task, you will not find any entries in the folder “TextServicesFramework”

Edited image for demo.

when an intact task should look like below

So how do we recreate this task, that is a custom handler?

Browse to “C:\WINDOWS\System32\Tasks\Microsoft\Windows\TextServicesFramework” & check whether you can find a file “MsCtfMonitor” inside the folder. If you cannot find the file in this folder, copy the file from another Windows machine that has the same version.

Copy the file to desktop and add the extension “.xml” to it.

Opening the file with notepad or another text editor should look like the following:

Go back to Task Scheduler and right click on “TextServiceFramework” and select “Import Task”

Point to the xml file that you have created in the desktop & apply. This should create a new task under the folder “TextServiceFramework”

Restart and confirm you can type in the search box and WIFI password text boxes. Alternatively you can use the Task Manager to check whether “CTF Loader” has been loaded.

2# Registry

Remember, registry entries might get removed through updates/new versions. However, as a temporary measure you can use the following hack to address the keyboard issues.

Make a full backup for the Registry. You must know, tampering registry could force you to a fresh installation of the OS!

Once a full backup for the Registry is made, browse to “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run”

Create a new string key and call it anything that you want. Example

I have called the string key as “CTFLoader” and for the Value make sure to enter “ctfmon”=”CTFMON.EXE”

Reboot the computer and check whether the typing issues resolved. Alternatively use Task Manager to check whether CTF Loader has been loaded.

Although both fix the typing issues, the right way is to recreate the missing Task. Choose wisely & don’t pirate! We know many interesting software are pricely and many of us cannot afford them. There are free alternatives for maximum pirated software like

And many more software that you need for Office/School/Home works! Piracy not only breaks the businesses that develop them, helps cyber criminals to unleash attacks like Ransomware through serial number generators and patches.

Hope this has helped you today.

Windows 10 | Windows cannot connect to the printer

There are times when you come across the error “Windows cannot connect to the printer” (error 0x000003e3) while trying to connect to a shared printer that is connected to another Windows 10 computer.

Quite possible that the drivers installed on the source machine is either not compatible with the client/target machine or not getting copied to the target machine. Now, install the correct version of printer driver to the target machine and try to connect again. There could be few other items you must check and insure for a successful connection.

  • Make sure both the computers network property shows the connection as either domain or private.
  • Make sure you have File & Printer sharing enabled for the network

That’s all folks

RMAN on Windows | Backup & Restore 11g R2 database

11g R2? too late to post anything for 11g? Wait, there are thousands of Businesses still using Oracle database 10g. So let us see how RMAN could be simplified on Windows. I hardly see many articles explaining such for Windows platform in general.

Considering you have 11g database already installed & setup for Archive logging, we’ll start by setting up RMAN backup first, then try a restore routine on a different sever.

Like cron jobs on Linux environment, for Windows we will use Task Scheduler for RMAN backups. Here are couple of batch files we will be using for making RMAN backup on Windows.

run
{
ALLOCATE CHANNEL c1 DEVICE TYPE disk;
ALLOCATE CHANNEL c2 DEVICE TYPE disk;
ALLOCATE CHANNEL c3 DEVICE TYPE disk;
ALLOCATE CHANNEL c4 DEVICE TYPE disk;
crosscheck archivelog all;
crosscheck backup;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT 'D:\RMAN_BACKUP\PROD_comp_%d_ lvl0_%U' TAG "dailyfull_db_lvl0_bkp" INCLUDE CURRENT CONTROLFILE;
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT 'D:\RMAN_BACKUP\archive_%d_lvl0_%U';
DELETE NOPROMPT archivelog all completed before 'sysdate-7';
backup current controlfile format 'D:\RMAN_BACKUP\bkpcontrol_file.ctl_%d_%T'               ;
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 7 DAYS;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
}

Save this script as “rman_backup.cmd”. You can save it with any other name ending with .cmd or .bat extension. Make sure you change the name in the next script incase if you choose a name other than “rman_backup.cmd”. Please note, I am taking backup on “D:\RMAN_BACKUP” folder, you should change “D:\RMAN_BACKUP” with the exact location that is used for the backup!

Now, we will create another cmd file that will call the above script.

@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a%%b)
:: echo %mydate%_%mytime%

set filename="D:\RMAN_BACKUP\logs\%mydate%_%mytime%_rman_backup.log"
:: echo %filename%

rman target / nocatalog cmdfile='D:\scripts\rman_backup.cmd' log='%filename%'

Once again you can save this file with anytime, provided the extension is either .cmd or .bat. I saved this cmd file as “callrman.cmd”

Make sure the path ” D:\RMAN_BACKUP\logs” or equivalent exists prior running the scripts.

Now fire up Windows Task scheduler and create a basic job

That’s all. Everyday, at a said time, RMAN backups will be created and kept in the destination folder. We are using 7 days retention policy with the script file, so on the 8th day obsolete backups will be purged. Depending upon the disk space available, you should adjust the retention policy for your backups. Don’t forget to copy those backup pieces to an external medium to insure maximum availability during a crisis.

That completes the simplest form of Oracle RMAN backups on Windows platform.

RMAN Restore

Currently we are discussing about restoring the RMAN backup to same version of Oracle database. If you want to restore RMAN backup to a higher version of Oracle database, it will be an entirely different exercise.

RMAN backups are the fastest, easiest incase if you are doing it right. No hassles like creating tablespaces, schemas and then waiting hours for the import process to complete! The biggest size of the database I ever dealt with is 550GB and a server with 2×4 core processors, 16GB total memory restores the 140GB backup in less than 1.5 hours. I suggest you to start using RMAN backups the soonest possible regardless whether your database is just few megabytes in size.

Today we will see how to restore RMAN backup from Server A to Server B, ie, to a different physical server with a different database name.

It might sound bit unethical to ask you to create a new database using Oracle database creation wizard for this purpose, however this is what we will do for this exercise. This will save us some time figuring out setting up many other parameters for the new database at later stages.

So let us start.

Start DBCA and create a database with a database name that you prefer for the purpose, for eg: “ORCL”

Once the database created, shut it down & delete all the datafiles from the data store. For example, I had all my data files in the folder C:\oracle\oradata\orcl, where orcl is the database name!

Now copy the RMAN backups from Server A to Server B. I’ve copied only one day backups from Server A to Server B and make a note of the exact location where you copied the backup files. In my case, I copied the files to “C:\RMAN”

From an elevated command prompt start SQLPLUS as sysdba & start the database in non mounted mode.

Now, start another elevated command prompt and connect to RMAN in Auxiliary mode, for duplication of the database.

We are all set to restore the RMAN backup to Server B now. However, there are few things we have to insure to make a successful restoration. For example renaming the datafiles. Based on the new datastore location where you are restoring the database files, each data file should be renamed. Please refer the below sample script for the same.

run
{
ALLOCATE AUXILIARY CHANNEL c1 DEVICE TYPE disk;
ALLOCATE AUXILIARY CHANNEL c2 DEVICE TYPE disk;
ALLOCATE AUXILIARY CHANNEL c3 DEVICE TYPE disk;
ALLOCATE AUXILIARY CHANNEL c4 DEVICE TYPE disk;
duplicate database to "ORCL" backup location 'C:\RMAN' nofilenamecheck
db_file_name_convert=('D:\Oracle\oradata\PROD','C:\Oracle\oradata\orcl')
LOGFILE
GROUP 1 (
'C:\Oracle\oradata\orcl\redo01a.log',
'C:\Oracle\oradata\orcl\redo01b.log'
) SIZE 1000M ,
GROUP 2 (
'C:\Oracle\oradata\orcl\redo02a.log',
'C:\Oracle\oradata\orcl\redo02b.log'
) SIZE 1000M ,
GROUP 3 (
'C:\Oracle\oradata\orcl\redo03a.log',
'C:\Oracle\oradata\orcl\redo03b.log'
) SIZE 1000M ,
GROUP 4 (
'C:\Oracle\oradata\orcl\redo04a.log',
'C:\Oracle\oradata\orcl\redo04b.log'
) SIZE 1000M ;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
}

As I am duplicating the database to existing one, I don’t have to go through the tedious process of changing the dbid or database name etc. Once the restore is done, all I need is to disable the archive logging and go online! We will see those in next few steps.

Please give attention to “db_file_name_convert“, Server A had the datafiles in the path “D:\oracle\oradata\PROD” and the Server B, we will be restoring the datafile to C:\oracle\ordata\orcl folder. So we must mention those changes here in the script. The same way we need to rename the logfiles and locations also. I hope the above script is self explanatory on that regard.

You may not need all those channel allocation for a small database, please adjust the number of cannels allocated as per your requirements. Give a try with less or more number of channels incase if you want to learn what happens :)

Execute the above script from the RMAN prompt.

If there are no errors, based on the size of the database & hardware resources RMAN will return to the prompt once the activities are finished.

Before doing anything else, we need to insure that the Archive logging is disabled for the newly restored database. Rush to the previous SQLPlus session that you started with nomount. This session is already disconnected, hence reconnect and shutdown immediate.

Now start the database in mount state and disable the archive logging.

Shutdown the database and restart normally.

That’s all, your Server B “orcl” has all the data from Server A “PROD” database now. If this is a production recovery, you can change the database name using “NID” utility, that is supported from Oracle database 9i onwards. Hope this helps few Oracle database beginners out there.

As we have restored full database with archive logs, there is no need to restore logs. Cross verify the database details

Cheers guys!