Friday, May 11, 2018

Troubleshooting Setting up Oracle 12c R2 and using it with Older Clients

Here are the problems I have every time I setup up Oracle.

Oracle 12c R2 on Windows Server added more complexity than even 12c R1.


1) Windows user name cannot have a space in it.  The Oracle Setup will hang up before it completes (with no explanation).


2) Turn off Password Complexity on Windows Server or Oracle Setup can't create a user for Oracle (if you are wanting it to create a user)


3) In listener.ora and tnsname.ora, change  "localhost" to your machine name or you will not be able to connect from other machines.


4) If you need older clients to connect with Oracle 12c R2, in the sqlnet.ora, you will have to add: 

SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8

You can use a different minimum (instead of 8), but this is the lowest.

You will get this error on other machine if this is the case:

ORA 28040: No matching authentication protocol


5) If you have already created users in Oracle before adding the entries to sqlnet.ora, you will have to reset the passwords if you want to connect from the older versions.

ALTER USER  IDENTIFIED BY 

You will get the following error until this is done (for no apparent reason):

ORA-01017 Invalid Username/Password 


----

Resources:


https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9533918300346989898

https://community.microstrategy.com/s/article/ORA-28040-No-matching-authentication-protocol-when-connecting-to-Oracle-12c-or-higher-database

https://stackoverflow.com/questions/37615088/unable-to-connect-to-oracle-12c-from-client-machine


Friday, January 6, 2017

Welcome to the world of Pluggable Databases in Oracle 12c

I'm new to pluggable databases in Oracle 12c, so I thought I would put my most common problems here in hopes that the solutions might help someone else.


Everything worked fine in my database until I rebooted the machine, and then I got:


ORA-01033: ORACLE initialization or shutdown in progress
01033. 00000 -  "ORACLE initialization or shutdown in progress"
*Cause:    An attempt was made to log on while Oracle is being started up
           or shutdown.
*Action:   Wait a few minutes. Then retry the operation.
Vendor code 1033


The problem was that the pluggable databases do not automatically open by default, not that the initialization or shutdown is in progress.  It doesn't matter how long you wait (as directed by the message).

First, you must open the pluggable database to get it running again:

alter pluggable database all open;

I said "all" but you could specify a specific pluggable database.

This will get the database running until you reboot.  If you want it to automatically open, you must save the state:

alter pluggable database all save state;

Again I said "all" instead of the pluggable database name.

The following Ask Tom post goes into more detail on this topic, but it doesn't mention the misleading message you get from Oracle.

https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:9531671900346425939

Thursday, April 23, 2015

Get Schema/DDL from Oracle Data Pump Export

Reposting this from the linked Stack Overflow article because this solutions works well and I want to be able to easily find it again:

impdp '/ as sysdba' dumpfile=<file> logfile=import_log.txt sqlfile=ddl_dump.txt

http://stackoverflow.com/questions/95578/how-to-determine-the-schemas-inside-an-oracle-data-pump-export-file


Thursday, March 26, 2015

Adding more than one Datafile to an Oracle Tablespace

If you need to add an additional data file to an Oracle Tablespace:

ALTER TABLESPACE 
   users 
ADD DATAFILE 
   'AdditionalUsersTablespace.dbf' 
size 100m
AUTOEXTEND ON
NEXT 10M


More info from these posts:

http://www.dba-oracle.com/t_alter_tablespace_add_datafile.htm

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_3002.htm



Tuesday, January 27, 2015

Problems registering a Windows Phone 8.1 for Development

Why is it that things that should be simple are not.   Connecting my Window Phone to a Windows 8.1 machine to deploy my apps.    So, I installed Zune (???) and the Windows Phone SDK 8.1 (it took hours) and still had errors.   I ran the Windows Phone Registration tool and it consistently fails.  Reboots (phone and computer) do nothing to help, nor do new/different USB cables help.  There are many items out there to help.

This link:

http://stackoverflow.com/questions/24153897/getting-error-unable-to-connect-to-a-phone-make-sure-the-windows-phone-ip-over


And it leads to this link:

http://irisclasson.com/2013/10/28/problems-and-fixes-when-registering-a-windows-phone-8-device-to-deploydebug-applications/


The solution (for me) turned out that I had to manually restart the Windows Phone IP Over USB Service.  It doesn't matter that you just rebooted, and it says it is running.  I got "Unable to connect to a phone. Make sure the Windows Phone IP over USB transport service is running" ever time until I manually restarted it.

Monday, June 30, 2014

How To Adjust Environment Variables

How To Adjust Environment Variables
by Charlie Marlin

This post is similar to a post by Joey Rogers on Friday, February 11, 2011.  It has slight differences in language and syntax, but I thought I should share it just the same.  Windows 7 installations should also see the “Fly in Ointment” note at the end.

Sometimes you need to change a system variable for a section of code.  Where I work, we have some Oracle databases on the 11g version and some on version 8.  They reside on different servers.  When we want to use one, it often works fine.  If we need to use the other, we have to edit the PATH variable on our machines to move the reference to the unwanted Oracle version further down the path than the desired version.  I have lived with this limitation for years, hoping the old database would get upgraded, but last week I was placed in a situation of telling a user who does not have admin credentials that will allow him to edit the environment variables to use one laptop for one thing and another laptop for the other.  Embarrassing.  So I groped around and found this, tested it, delivered it to the user, and to my astonishment it worked.

(Let’s name the old Oracle 8 server “Aristophanes” and the more modern Oracle 11g server “Moliere”. In the code before I need “C:\ORANT\BIN:” not to come before the home for Oracle 11g I place this code:)

' First, we need to change the PATH environment variable in order to reach Moliere...
Dim oraclePathAristophanes As String = Environment.GetEnvironmentVariable("path")
Dim oraclePathMoliere As String = oraclePathAristophanes

oraclePathMoliere = oraclePathAristophanes.Replace("C:\ORANT\BIN;", "")
'MessageBox.Show("Oracle PATH edited: " & vbCrLf & oraclePathMoliere)

Environment.SetEnvironmentVariable("path", oraclePathMoliere)
' restore oraclePathAristophanes further down once we are done with Moliere...
'MessageBox.Show("Oracle PATH set: " & vbCrLf & Environment.GetEnvironmentVariable("path"))

(then later in the sub I restore the old path variable)

' restore oraclePathAristophanes once we are done with Moliere...
Environment.SetEnvironmentVariable("path", oraclePathAristophanes)

'MessageBox.Show("Oracle PATH restored: " & vbCrLf & Environment.GetEnvironmentVariable("path"))



Fly in Ointment

This approach fails on Windows 7 for non-admin users, but the following article lets you step over that obstacle:  http://williamfaulkner.co.uk/2009/04/vbnet-run-as-administrator-impersonate-a-user-2008/

Tuesday, April 8, 2014

Turning On/Off/Flipping specific Bits in a Value

Here is a nice set of functions to do your bit manipulation in C#:


http://codeidol.com/community/dotnet/turning-bits-on-or-off/8901/



Here they are in VB.NET:

Public Function TurnBitOn(value As Integer, bitToTurnOn As Integer) As Integer Return (value Or bitToTurnOn)
End Function


Public Function TurnBitOff(value As Integer, bitToTurnOff As Integer) As Integer Return (value And Not bitToTurnOff)

End Function




Public Function FlipBit(value As Integer, bitToFlip As Integer) As Integer Return (value Xor bitToFlip)
End Function




Public Function TurnBitPositionOn(value As Integer, bitPosition As Integer) As Integer Return (value Or (1 << bitPosition))
End Function




Public Function TurnBitPositionOff(value As Integer, bitPosition As Integer) As Integer Return (value And Not (1 << bitPosition))
End Function




Public Function FlipBitPosition(value As Integer, bitPosition As Integer) As Integer Return (value Xor (1 << bitPosition))
End Function