Check mount option in linux

I did not find a clean way to check the mount option in Linux. For instance wsize=32768 On AIX, I simply type “mount” and see the mount option… For some reasons, my Linux does not show me the complete mount options ! $ mount precision:/nfsserver on /nfsclient type nfs (rw,bg,addr= $ grep nfsclient /proc/mounts precision:/nfsserver […]

What does # mean in sqlplus?

The script used to be shutdown abort it has been replaced by #shutdown abort shutdown immediate Let’s try ! SQL> #shutdown abort ORACLE instance shut down. SQL> shutdown immediate ORA-01012: not logged on sqlplus just silently ignored the # symbol and executed the first statement. Thanks to Maxim comment, here is a new case to […]

[Hello World] run c# from powershell

How to run csharp code from command line with powershell. One line PS> add-type ‘public class c{public const string s=”hello world”;}’;[c]::s hello world You can also execute visual basic directly from powershell. PS> Add-Type -language visualbasic ‘public class v >> public const s as string = “Hello World” >> end class’ >> PS> [v]::s Hello […]

[Windows] Email of current user

I hate having to type my email address, so I created a long one-liner to do the trick of getting my email from Exchange and copying it in my clipboard powershell -noprofile -command “$o=New-Object DirectoryServices.DirectorySearcher; $o.SearchRoot=New-Object DirectoryServices.DirectoryEntry;$o.Filter=’samaccountname=’+$ENV:USERNAME;write-host ($o.FindOne().Properties.mail)” | clip save this as “C:\WINDOWS\E.BAT” Then, when you have to enter your email in a form […]

My first .NET gui in Powershell

I managed to interface Oracle and a GUI via powershell. First, load the Oracle and the .NET assemblies [void] [Reflection.Assembly]::LoadFile(“C:\oracle\product\11.2.0\client_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll”) [void] [Reflection.Assembly]::LoadWithPartialName(“Drawing”) [void] [Reflection.Assembly]::LoadWithPartialName(“Windows.Forms”) Now, let’s retrieve EMP in a powershell array. I hope one of my reader will advise me on a better way 🙂 $connection=New-Object Oracle.DataAccess.Client.OracleConnection(“Data Source=DB01; User Id=scott; password=tiger”) $ $command=new-object Oracle.DataAccess.Client.OracleCommand(“select […]

EURO symbol, sqlplus, cmd.exe and various issues

One customer reported a not-correctly displayed Euro Symbol (€) in the database from sqlplus (msdos). Why? First, the character set did not support it. select * from v$nls_parameters where PARAMETER like ‘%CHARACTERSET%’; PARAMETER VALUE —————————— ————— NLS_CHARACTERSET WE8ISO8859P1 NLS_NCHAR_CHARACTERSET AL16UTF16 If you are still using WE8ISO8859P1, consider migrating to WE8MSWIN1252 using csalter sqlplus “/ as […]

Create helloworld.exe file in powershell

PS> Add-Type -outputtype consoleapplication -outputassembly helloworld.exe ‘public class helloworld{public static void Main(){System.Console.WriteLine(“hello world”);}}’ PS> .\helloworld.exe hello world Probably my first .exe this century 🙂

Toad 11.5 is out

The latest Toad is now in production, 11.5, get it from If you have an old license key, 9.6 or older, it may complain at installation time, just ignore. It will be fine at run time. Enhanced TAB browsing experience, nicer and more visible colors for your connection (production=red…), read-only connections. Currently it still […]

How to get rid of corrupted blocks without a backup

First, you identify the blocks in alert log or with db verify $ dbv BLOCKSIZE=8192 file=sysaux01.dbf DBV-00201: Block, DBA 12629823, marked corrupt for invalid redo application … DBVERIFY – Verification complete Total Pages Examined : 131072 Total Pages Processed (Data) : 69691 Total Pages Failing (Data) : 0 Total Pages Processed (Index): 28669 Total Pages […]

weekinmonth in powershell starts on Sunday…

This April month is full of surprises! Not only I did not have the opportunity to trick my colleagues on Sunday April first, but I had some bug of my code due to the start of the week. [int](get-date).dayofweek and (Get-WmiObject Win32_LocalTime).dayofweek both refer Sunday as day 0. PS> get-date Wednesday, 11. April 2012 18:31:52 […]

[alert] AIX Posix Timezone issue

Maybe you did get or you will get an issue with the date command in AIX. expected behavior, Linux $ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 date Sat Mar 17 00:14:54 NZDT 2012 $ TZ=Pacific/Auckland date Sat Mar 17 00:14:58 NZDT 2012 unexpected behavior, AIX $ TZ=Pacific/Auckland date Sat Mar 17 00:15:50 GMT+13:00 2012 $ TZ=NZST-12NZDT,M10.1.0/2,M3.3.0/3 date Fri Mar 16 […]

Powershell and dates

I wrote about unix timestamp i powershell. I wrote : It is chockingly easy ! but I should have written : … it is not correct 🙁 PS> ./perl -e “print time.’`n'” 1331454753 PS> get-date -u %s 1331458358.05694 there is about 3605 seconds difference. 1 hour for Europe/Zurich and 5 seconds to type on a […]

to ADO or to ODP ?

I just read on System.Data.OracleClient Namespace that System.Data.OracleClient are deprecated. The types in System.Data.OracleClient are deprecated. The types are supported in version 4 of the .NET Framework but will be removed in a future release. Microsoft recommends that you use a third-party Oracle provider. The alternative is to use ODP (from Oracle) instead of ADO […]

on Windows Management Instrumentation

I have a bit versed into powershell over the last months, I just cannot stop discovering new gems. Ex : Win32 Classes Self-explanatory examples : PS> (get-wmiobject win32_processor).currentclockspeed 3292 PS> (get-wmiobject win32_operatingsystem).version 5.1.2600 PS> (get-wmiobject win32_proxy).ProxyServer PS> (get-wmiobject win32_proxy).ProxyPortNumber 8080 it goes on and on and on… the ways those things are accessible from […]

Unix timestamp in powershell

I was a bit playing with powershell. I wanted to know the week of month, day of weeks, and other gems. It is chockingly easy ! Unix Timestamp : PS> get-date -uformat %s 1329322194.18894 To get the day of week as number, you can chose between [int](get-date).dayofweek and get-date -uformat %u What does uformat stand […]

This system is for the use of authorized users only.

How to bypass the login banners? There is actually more than one banner to bypass. One of the them is the message of the day banner, commonly located in /etc/motd. Typically friendly, example in AIX **************************************************************************** * * * * * Welcome to AIX Version 6.1! * * * * * * Please see the […]

The new metalink interface

I just started using the New My Oracle Support User Interface It is a zero-flash interface with more capabilities than the “html” interface we used the previous years. It still provides about the same browser experience as the flash one. Have a try… according to Oracle : “it will eventually replace the Flash version” To […]

change system wide PATH variable in Windows

This is utterly simple and mostly you did it with the mouse. To do it with command line and powershell, proceed this way. Open a powershell window powershell or if you have no right to edit the machine-wide environment, runas admin runas /user:yourdomain\youruserplusadmin powershell then access the environment assembly [environment]::setEnvironmentVariable(“PATH”,”c:\oracle\product\11.2.0\client_1\bin;C:\WINDOWS\;C:\WINDOWS\system32;C:\Program Files\Putty;C:\Program Files\Perforce;C:\Program Files\TortoiseSVN\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0″,”MACHINE”) MACHINE is […]

Transport tablespace over db links

You do not want to export the metadata from the source database, but rather use a database link to get this. As prerequisite, you have made a set of self-contained tablespaces in read-only mode and you have copied the datafiles. SQL> create tablespace test datafile ‘/u02/oradata/db01/test01.dbf’ size 10m; Tablespace created. SQL> create table scott.x(x number) […]

Fast start failover

There are loads of things to do to prepare you for a fast start failover. First you must have a working set of primary / standby database Then you must have both databases in flashback mode. Then verify your dataguard configuration with OEM. Ok, once you are so far, you will need to review your […]

Failover to standby with a delay (until time)

Disaster scenario : 1) you have a primary database 2) you have a standby database 3) you want to be able to failover to the standby database until a given time (ex: within the last 24 hours) First, you create your primary and standby databases. If you have dataguard broker, you then set the DELAYMINS […]

Enterprise Manager command line interface

emcli has been around for a while, but in 12c the installation has never been easier do not search on otn for the jar, go to download with : Setup –>My Preferences –>Command line interface –> download install with : java -jar emclikit.jar client -install_dir=/u01/app/oracle/emcli configure with : emcli setup -url= -username=sysman -password=sysmanpw -dir=/u01/app/oracle/emcli. That’s […]

delete unused shared memory segments from an Oracle instance

Once upon a time, a dba issues some kill -9 to clean up dying database processes. Or the database instance crashes. This will left some shared memory segments. Note 68281.1 describe how to remove them on a server with multiple databases. First, list the ipc process $ ipcs IPC status from /dev/mem as of Mon […]

TNSNAMES and Active Directory

It is highly probable you already have MS AD in your company. Probably you use a local tnsnames.ora. Apart from setting a Oracle Internet Directory or Oracle Virtual Directory, there is one more option that you may want to consider : AD. Ok, here is a bit of a road map : – Schema Extension […]

Check if it a program is already running in Unix

There is more than one way to do it, the safe is probably to check if /home/lsc/OH_YES_I_AM_RUNNING exists and believe it. This is called the file.PID method and is widely used (Apache used to use it since a long long time). It needs file. It needs cleanup if you reboot your server in the middle […]

shell and list of files

How do you loop thru a list of files? For instance you want to archive than delete all pdf documents in the current directory : Bad practice : tar cvf f.tar *.pdf rm *.pdf There are multiple issue with the command above 1) new files could come during the tar, so the rm will delete […]