Monthly Archives: August 2010

Get a Midnight DateTime Value in Powershell

иконографияиконикухненски маси

Some quick methods of obtaining a midnight DateTime value for almost any date.

# Get Midnight for current date
Get-Date -Hour 0 -Minute 00 -Second 00
# Another way

# Get Midnight for date a week ago
(Get-Date -Hour 0 -Minute 00 -Second 00).AddDays(-7)
# Or use this 

# Get Midnight for date a month ago
Get-Date -Month $((Get-Date -Format "MM") - 1) -Hour 0 -Minute 0 -Second 0

# Get Midnight for a date one year ago
Get-Date -Year $((Get-Date -Format "yyyy") - 1) -Hour 0 -Minute 0 -Second 0

Oracle 11g Installation Default Bites

Beware of a new default when installing Oracle 11g! This default can raise its ugly head and bite you in the ass! It just happened to me.

The default has to do with enforcing a password expiration when creating a user. I don’t know about you but we generally have applications (Oracle based as well as SQL Server) which rely on user logins specific for that application. These applications also have configurations in which you specify the user login, sometimes in several locations. Users and application managers come and go and along with them the knowledge of application configurations and where they are. Consequently, we do not change application passwords! As soon as you do, applications break and it could take hours or even days to get them working again.

With this in mind, you might seriously think about changing the Oracle 11g default policy as one of your steps immediately after installation. I did not change the policy as I was unaware of it. I had several user logins become disabled duet to expiring passwords. These also included SYSTEM and DBSNMP! Talk about a real PITA!

Here’s how you can change the password policy:


Oh! And by-the-way, if the password does expire, you cannot unexpire it. You are forced to supply a new password even if it is the same as the old one. Unfortunately in my case, the application was installed by a third party and they were not sure of the password.