1 2 Previous Next 21 Replies Latest reply on Mar 25, 2008 10:26 PM by 617544 Go to original post
      • 15. Re: Differences Oracle on Windows, Unix.
        Niall Litchfield
        Well...the scripting flexibility you can have with
        ORATAB is not possible in Windows. Thats is
        enough to hate Windows. :)

        Alex.
        Can you give one, or more, examples?

        Niall Litchfield
        • 16. Re: Differences Oracle on Windows, Unix.
          108476
          Hi Alex,

          Microsoft released Windows Services For UNIX (SFU) to more closely emulate a variety of UNIX shells and UNIX utilities to ease the migration from a UNIX to a Windows environment. While SFU is certainly a more comprehensive solution than the native command prompt, it is a more complicated and does not provide total compatibility for porting UNIX scripts to Windows.

          That's another option . . . .

          By and large, I agree, batch scripting in Windows is a major pain . . . .


          ***********************
          Hi Niall,
          example of ORATAB
          I think that he means the "ORATAB loop" to spin through all instances on a server, like this script:

          #!/bin/ksh

          for ORACLE_SID in `cat /etc/oratab|egrep ':N|:Y'|grep -v \*|cut -f1 -d':'`
          do
          ORACLE_HOME=`cat /etc/oratab|grep ^$ORACLE_SID:|cut -d":" -f2`
          DBA=`echo $ORACLE_HOME | sed -e 's:/product/.*::g'`/admin
          find $DBA/$ORACLE_SID/bdump -name \*.trc -mtime +14 -exec rm {} \;
          $DBA/$ORACLE_SID/udump -name \*.trc -mtime +14 -exec rm {} \;
          find $ORACLE_HOME/rdbms/audit -name \*.aud -mtime +14 -exec rm {} \;
          done
          • 17. Re: Differences Oracle on Windows, Unix.
            Actitud
            Hey Don!

            Yes!. Thats what I was talking about...ORATAB loop!!!

            I have create many scripts in order to perform the same task in 400 databases using ORATAB like set autoextend=on in n databases, get user like '%BOB%', create a spreadsheet with all the space info on each database and so on.

            Maybe its possible to do it in Command Prompt as well, but I don´t want (like) to waste my time in an ugly and bad developed tool like cmd.

            Thanks
            Alex.
            • 18. Re: Differences Oracle on Windows, Unix.
              Niall Litchfield
              Hey Don!

              Yes!. Thats what I was talking about...ORATAB
              loop
              !!!

              I have create many scripts in order to perform the
              same task in 400 databases using ORATAB like set
              autoextend=on in n databases, get user like '%BOB%',
              create a spreadsheet with all the space info on each
              database and so on.

              Maybe its possible to do it in Command Prompt as
              well, but I don´t want (like) to waste my time in an
              ugly and bad developed tool like cmd.

              Thanks
              Alex.
              Learning WMI would be beneficial, for example the following outputs all SIDs and Oracle Homes on the server to a .csv file - though servers with many SIDs on them should be the exception rather than the rule under windows. Extending this do actually do things is relatively trivial, and of course you can use a single workstation to control all the db servers in your org this way if you wish.
              ' VBScript source code
              Const ForAppending = 8
              Set FSO = CreateObject("Scripting.FileSystemObject")
              Set LogFile = FSO.OpenTextFile("c:\scripts\listhomes.txt", _ 
                  ForAppending, True)
              
              strComputer = "."
              
              ListOracleHomes
              
              sub ListOracleHomes
              
                   ' write header
                   LogFile.Write ("SID,ORACLE_HOME")
                   
                   strQuery = "Select * from Win32_Service where DisplayName like 'OracleService%'"
              
                   ' get list of services
                   Set OraServices = GetObject("winmgmts:\\" & strComputer).ExecQuery(strQuery)     
                   
                   For each s in OraServices
                        LogFile.Write(vbCrLf)          
                        LogFile.Write(mid(s.PathName,instr(1,s.PathName," ")+1))
                        LogFile.Write(",")
                        LogFile.Write(left(s.PathName,instr(1,s.PathName,"bin") - 1))
                   next
              end sub
              • 19. Re: Differences Oracle on Windows, Unix.
                617544
                good point. Programming in WMI is not as easy as writing unix shell script but it is powerfull too. A further step, by learning a little .NET programming and using familiar WMI objects, you can create very nice progs benefit from a high level programming language. For example if you have an already installed web service which serves to send messages to cellular phones, then by adding a few more lines of code you can send error message to your cell phone.
                • 20. Re: Differences Oracle on Windows, Unix.
                  Actitud
                  I can not deny that this is a good patch to solve the missing ORATAB on Windows, but, it's just a patch.

                  I've actually did the same on UNIX just with the console. I'm talking about unification SIDs/HOMEs. Of course, in two lines.

                  You can do almost anything you want, but, in UNIX is more simple.

                  Thanks for show me a good way to do it on Windows.
                  Alex.
                  • 21. Re: Differences Oracle on Windows, Unix.
                    617544
                    lastly i want to add this. In my organization usually i handle scripting on windows and even my collage find it difficult. But what i learned is when you get familiar with WMI it becomes more easy to google, find and use.
                    By the way, previously i tried installing awk, grep, tail and similar progs on windows to do it like unix scripting in batch script. You can find most of these at sourceforge under GNU license. However, i dont suggest that way, i gave up. Windows has its own way and it is WMI
                    1 2 Previous Next