Home » Infrastructure » Windows » problem with my batch file that run the oracle (10g , XP SP2)
icon5.gif  problem with my batch file that run the oracle [message #309515] Thu, 27 March 2008 14:39 Go to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

I have batch file run to me oracle 10g ...... and that's the codes in it :-

SC START OracleDBConsoleorcl
SC START OracleOraDb10g_home1iSQL*Plus
SC START OracleOraDb10g_home1TNSListener
SC START OracleServiceORCL


it's working great , but today when I pressed it ... that's what happen :-

C:\>ora10g.bat

C:\>SC START OracleDBConsoleorcl
'SC' is not recognized as an internal or external command,
operable program or batch file.

C:\>SC START OracleOraDb10g_home1iSQL*Plus
'SC' is not recognized as an internal or external command,
operable program or batch file.

C:\>SC START OracleOraDb10g_home1TNSListener
'SC' is not recognized as an internal or external command,
operable program or batch file.

C:\>SC START OracleServiceORCL
'SC' is not recognized as an internal or external command,
operable program or batch file.


and the oracle didn't run ..... that makes me to go to
Control Panel > Administrative Tools > Services

and than run this services manually :-

OracleDBConsoleorcl
OracleOraDb10g_home1iSQL*Plus
OracleOraDb10g_home1TNSListener
OracleServiceORCL


what's the problem that I face , and what is the solution ?
Re: problem with my batch file that run the oracle [message #309517 is a reply to message #309515] Thu, 27 March 2008 14:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is SC?

Regards
Michel
Re: problem with my batch file that run the oracle [message #309523 is a reply to message #309517] Thu, 27 March 2008 15:06 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
I just happen to know that there is a "sc.exe" in some Windows resource pack or another that is basically a "Service Control" program to start and stop windows services form the command line.

So this seems to belong into the Windows Platform Forum, and the problem is most likely that this sc.exe is either missing from the box in question, or the path variable got mangled up.
Re: problem with my batch file that run the oracle [message #309534 is a reply to message #309517] Thu, 27 March 2008 16:01 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9077
Registered: November 2002
Location: California, USA
Senior Member
Michel Cadot wrote on Thu, 27 March 2008 12:45
What is SC?



C:\Windows\System32>sc
DESCRIPTION:
        SC is a command line program used for communicating with the
        Service Control Manager and services.
USAGE:
        sc <server> [command] [service name] <option1> <option2>...


        The option <server> has the form "\\ServerName"
        Further help on commands can be obtained by typing: "sc [command]"
        Commands:
          query-----------Queries the status for a service, or
                          enumerates the status for types of services.
          queryex---------Queries the extended status for a service, or
                          enumerates the status for types of services.
          start-----------Starts a service.
          pause-----------Sends a PAUSE control request to a service.
          interrogate-----Sends an INTERROGATE control request to a service.
          continue--------Sends a CONTINUE control request to a service.
          stop------------Sends a STOP request to a service.
          config----------Changes the configuration of a service (persistent).
          description-----Changes the description of a service.
          failure---------Changes the actions taken by a service upon failure.
          failureflag-----Changes the failure actions flag of a service.
          sidtype---------Changes the service SID type of a service.
          privs-----------Changes the required privileges of a service.
          qc--------------Queries the configuration information for a service.
          qdescription----Queries the description for a service.
          qfailure--------Queries the actions taken by a service upon failure.
          qfailureflag----Queries the failure actions flag of a service.
          qsidtype--------Queries the service SID type of a service.
          qprivs----------Queries the required privileges of a service.
          delete----------Deletes a service (from the registry).
          create----------Creates a service. (adds it to the registry).
          control---------Sends a control to a service.
          sdshow----------Displays a service's security descriptor.
          sdset-----------Sets a service's security descriptor.
          showsid---------Displays the service SID string corresponding to an arbitrary name.
          GetDisplayName--Gets the DisplayName for a service.
          GetKeyName------Gets the ServiceKeyName for a service.
          EnumDepend------Enumerates Service Dependencies.

        The following commands don't require a service name:
        sc <server> <command> <option>
          boot------------(ok | bad) Indicates whether the last boot should
                          be saved as the last-known-good boot configuration
          Lock------------Locks the Service Database
          QueryLock-------Queries the LockStatus for the SCManager Database
EXAMPLE:
        sc start MyService

Would you like to see help for the QUERY and QUERYEX commands? [ y | n ]:
y

QUERY and QUERYEX OPTIONS:
        If the query command is followed by a service name, the status
        for that service is returned.  Further options do not apply in
        this case.  If the query command is followed by nothing or one of
        the options listed below, the services are enumerated.
    type=    Type of services to enumerate (driver, service, all)
             (default = service)
    state=   State of services to enumerate (inactive, all)
             (default = active)
    bufsize= The size (in bytes) of the enumeration buffer
             (default = 4096)
    ri=      The resume index number at which to begin the enumeration
             (default = 0)
    group=   Service group to enumerate
             (default = all groups)

SYNTAX EXAMPLES
sc query                - Enumerates status for active services & drivers
sc query eventlog       - Displays status for the eventlog service
sc queryex eventlog     - Displays extended status for the eventlog service
sc query type= driver   - Enumerates only active drivers
sc query type= service  - Enumerates only Win32 services
sc query state= all     - Enumerates all services & drivers
sc query bufsize= 50    - Enumerates with a 50 byte buffer
sc query ri= 14         - Enumerates with resume index = 14
sc queryex group= ""    - Enumerates active services not in a group
sc query type= interact - Enumerates all interactive services
sc query type= driver group= NDIS     - Enumerates all NDIS drivers


C:\Windows\System32>sc start
DESCRIPTION:
        Starts a service running.
USAGE:
        sc <server> start [service name] <arg1> <arg2> ...

C:\Windows\System32>
Re: problem with my batch file that run the oracle [message #309537 is a reply to message #309523] Thu, 27 March 2008 16:13 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9077
Registered: November 2002
Location: California, USA
Senior Member
As ThomasG said, probably either sc.exe is missing or you are running it from a different directory than usual and/or the directory is not in your path.

First, confirm that it is on your system, by going to your command prompt and going to your root directory (if you have more than one drive, then do it on each one):

cd\

then search for it in all of the sub-directories:

dir sc.exe/s

If it is missing, then that is the problem. Otherwise, once you find the right directory:

C:\>dir sc.exe/s/p
 Volume in drive C is OS
 Volume Serial Number is B841-3E7B

 Directory of C:\Windows\System32

11/02/2006  02:45 AM            31,744 sc.exe
               1 File(s)         31,744 bytes


then try running the sc command from the command prompt in that directory. If it still does not run, then the file is corrupted. If it runs, then you either need to run it from that directory and modify your .bat file to do so or if the .bat file runs in the current directory, then run it from that directory, or add that directory to your path in your windows environment.

Re: problem with my batch file that run the oracle [message #309579 is a reply to message #309534] Fri, 28 March 2008 00:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Thanks Barbara but it was a rhetoric question, just a way to point OP to the direction to search for.

Regards
Michel
icon1.gif  Re: problem with my batch file that run the oracle [message #309766 is a reply to message #309515] Fri, 28 March 2008 13:42 Go to previous messageGo to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

I think you not understand me quite ....... download the attachment and than change the extension to .bat

than go to :-
Control Panel > Administrative Tools > Services
and than make this services work manually :-

OracleDBConsoleorcl
OracleOraDb10g_home1iSQL*Plus
OracleOraDb10g_home1TNSListener
OracleServiceORCL

and than restart the computer , and when be on desktop open SQL*PLUS ..... you will see that error :-
ORA-12560: TNS:protocol adapter error

than .... go to the file ( ora10g.bat ) and open it ... wait a little bit , and than go to SQL*PLUS and open it and connect without any problems .

=======================================================

the problem that i mean that when i open the ( ora10g.bat ) that's appear to me :-

C:\>SC START OracleDBConsoleorcl
'SC' is not recognized as an internal or external command,
operable program or batch file.

C:\>SC START OracleOraDb10g_home1iSQL*Plus
'SC' is not recognized as an internal or external command,
operable program or batch file.

C:\>SC START OracleOraDb10g_home1TNSListener
'SC' is not recognized as an internal or external command,
operable program or batch file.

C:\>SC START OracleServiceORCL
'SC' is not recognized as an internal or external command,
operable program or batch file.


and of course when i open SQL*PLUS ..... i saw that error :-
ORA-12560: TNS:protocol adapter error


in additional information .... this batch file was working correctly without any problems until I installed the forms 6i by then the problem appear.

that's all .... I hope the problem is clear now for you all.

waiting for answer ...... and thanks in advance .
  • Attachment: ora10g.txt
    (Size: 0.13KB, Downloaded 1630 times)
Re: problem with my batch file that run the oracle [message #309768 is a reply to message #309766] Fri, 28 March 2008 13:55 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Well, the problem is pretty clear.

"sc.exe" is not found by the batch script.

-> So the Oracle services are not started when you run the batch file.

-> So you get a TNS:protocol adapter error when you try to connect to oracle.

-> So you don't seem to understand the answer : "make sure sc.exe is there and can be found by the batch script"

Or forget the batch script, an start the services with Administrative Tools -> Services by hand, or set them to start automatic.

Re: problem with my batch file that run the oracle [message #309846 is a reply to message #309768] Sat, 29 March 2008 03:49 Go to previous messageGo to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

I'm certainly sure that I have the SC.exe ....... have a look :-

http://img182.imageshack.us/img182/9692/schy7.png

but my batch still not working correctly as I explain in my previous post Sad

so ...... what's the solution Question Exclamation Rolling Eyes
Re: problem with my batch file that run the oracle [message #309847 is a reply to message #309846] Sat, 29 March 2008 03:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Check PATH INSIDE the batch file.
Why don't you already post the script?

Regards
Michel
Re: problem with my batch file that run the oracle [message #309849 is a reply to message #309847] Sat, 29 March 2008 04:01 Go to previous messageGo to next message
ThomasG
Messages: 3211
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
You could try changing the

sc START ...


lines in the script to

c:\windows\system32\sc.exe START ...


To have it work regardless of any PATH environment.
icon14.gif  GREAT [message #309854 is a reply to message #309849] Sat, 29 March 2008 05:48 Go to previous messageGo to next message
Hany Freedom
Messages: 256
Registered: May 2007
Location: Egypt
Senior Member

Quote:
c:\windows\system32\sc.exe START ...


thank you very much ThomasG ...... you my Savior
your idea working perfectly Thumbs Up and I can now connect to Oracle without any problems Grin

and thanks a lot for all who participates to this thread .
Re: GREAT [message #309911 is a reply to message #309854] Sat, 29 March 2008 14:28 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You should ask yourself who/what removed c:\windows\system32 out of the path. Because, typically it IS part of the PATH environment variable by default.
Previous Topic: how to start database automatically?
Next Topic: Oracle9i client installation hang
Goto Forum:
  


Current Time: Thu Mar 28 05:35:44 CDT 2024