Skip to Main Content
  • Questions
  • About automatic start up of Oracle database on WIndows

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Girish.

Asked: December 25, 2005 - 11:11 pm UTC

Last updated: June 05, 2006 - 7:44 am UTC

Version: 9

Viewed 1000+ times

You Asked

Hi Tom,

We have situation where in all of database backup is taken using OS
that they shutdown database and then backup all of the file system.
Now windows administrator are not confident enough to shutdown the database and they asked us to provide script that will shutdown all databases then they will take backup and they want to automate the startup too

This I have done for UNIX servers using shell/perl reading ORATAB file where I get all database names shutting down one-by-one and starting up one-by-one.That's working fine

Now is it possible to do the same for WINDOWS environment.
Where can I read all database names on WINDOWS like ORATAB in Unix
Could you please answer this ?

Thanks in advance

Regds
Girish



and Tom said...

what a horrible way to backup databases. ugh.

Anyway, you would need to list the running services - find the "oracle ones" (easy to identify, they have oracle in them)

C:\Documents and Settings\tkyte>net start | find "OracleService"
OracleServiceORA10GR1

use the NET command to "stop them" (and hope that they do - unatteneded shutdowns - scary. You'll be getting paged a lot)

do the backup and then use the corresponding NET start command to start them again (and "hope" they start - you'll be getting pages a lot - definitely)

read some of these
</code> http://asktom.oracle.com/pls/ask/search?p_string=unattended <code>

to see why unattended startup/shutdowns are a horribly bad bad idea.



Rating

  (13 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

About automatic start up of Oracle database on WIndows

Girish, December 26, 2005 - 10:55 pm UTC

Hi Tom,

I am helpless in this case because site support guys are not willing to spare few bytes of memory.
I suggested
1.RMAN as first prority
2.Cold back up ( since DB is in noarchivelog mode)

But management disagreed to my suggestions

Regds
Girish


Tom Kyte
December 27, 2005 - 9:33 am UTC

what does memory have to do with anything about backing up??


You are doing #2 - make sure your management understands completely that they will lost all modifications made to their data - soon. It is purely a matter of time before all changes made that day (or however long between backups) is permanently gone.

Has anyone ever attempted a restore? Do you know if you CAN restore a database from these backups?

About automatic start up of Oracle database on WIndows

Girish, December 27, 2005 - 10:58 pm UTC

You said in your response that we will get "lots of pages"
if we use net command in Windos to stop/start database

What is this "lots of pages" means



Tom Kyte
December 28, 2005 - 9:25 am UTC

it is what happens when your pager goes off in the middle of the night/early morning - when the database chooses to not go down or not come back up and needs your help.

Windows Scheduler and Auto Shutdown

reader, December 28, 2005 - 4:37 pm UTC

Girish

not sure what windows os version you are using(we use 2000
Windows Server)...you can schedule the Task Manager to
run the shutdown.bat file at a specific time.

I have a .bat file that gets executed through the Task Manager Scheduler that shuts down the db.

We've been using this system for almost 4 years and it has
never failed unattended(not saying it can't!)..it just hasn't with our system. We use a third party backup system.

here's a copy of the shutdown.bat:

set oracle_sid=ORCL
g:\oracle\oradb92\bin\sqlplus /nolog @g:\oracle\oradata\orcl\shutdb.sql
g:\oracle\oradb92\bin\oradim -shutdown -sid ORCL -shuttype srvc
net stop OracleOradb92TNSListenerORCL



two databases on a windows server,

A reader, January 18, 2006 - 2:09 pm UTC

On a windows server, I created a new database ORCLU and I did all formalities like running catproc.sql and other sql's and now my database is ready for use.

Before creating the ORCLU database, I brough down the the existing database ORCL.

Now I am not sure how to bring up the ORCL database. The service related to ORCL is running. I modified TNSNAMES.ORA file by adding the new ORCLU database and also the in the listener file. I restarted the listener.

But whenever I try to connect to ORCL database, it connects to ORCLU database.

I don't know how to make both the databases running and able to connect to them from my sqlplus.

Thanks,



Tom Kyte
January 19, 2006 - 12:13 pm UTC

what steps did you use to create the database - you should have used the tools (they would have set it all up for you).

It would appear you "kidnapped" your ORCL services - had you done the windows step by steps, you would have used oradim to create a nwe ORCLU service.

I recommend you contact support if this is a "real database" and have them sort out "where exactly you are"

step by step,

A reader, January 24, 2006 - 12:02 pm UTC

First, I set the env variable ORACLE_SID to the new oracle database (ORCLU).
Then using ORADIM, I created a new service for the new database (successfully created by saying INSTANCE CREATED).

Then using CREATE DATABASE script, I created the database.

Now when I try to startup the other database I tried the following steps:

sqlplus /nolog
connect sys/sys@orcl as sysdba (In this case ORCL is not UP, the other database ORCLU is UP and running).

It connected to ORCLU database and now I am not sure how to startup the ORCL database.

Thanks,

Tom Kyte
January 24, 2006 - 8:49 pm UTC

to start the other database, you would start the SERVICE.


you could

set ORACLE_SID=orcl
sqlplus / as sysdba


from the command line (no @orcl, you are not connecting over the network)

sqlplus / as sysdba,

A reader, January 25, 2006 - 10:55 am UTC

If I use the above command I will get the following error

F:\>sqlplus

SQL*Plus: Release 9.2.0.1.0 - Production on 09:44:58 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Enter user-name: / as sysdba
ERROR:
ORA-12560: TNS:protocol adapter error

Tom Kyte
January 25, 2006 - 1:40 pm UTC

sounds like the service isn't started for the database, no database background service on windows == no go.

listener behaving weirdly,

A reader, April 26, 2006 - 3:39 pm UTC

I have two instances running on a windows box. They both share the same oracle home.

One of them is ORCL and the other is ORCLU.

On SQLPLUS prompt, if I try to connect to ORCL database it always connect to ORCLU. But if I try to connect to ORCLU, it still connects to ORCLU.

This is what the status of my listener:

C:\Documents and Settings\snagaraj>lsnrctl status

LSNRCTL for 32-bit Windows: Version 9.2.0.7.0 - Production on 26-APR-2006 14:33:
41

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=9LIVES)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 9.2.0.7.0 - Produc
tion
Start Date 26-APR-2006 14:30:48
Uptime 0 days 0 hr. 2 min. 54 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:\OraHome9201\network\admin\listener.ora
Listener Log File c:\OraHome9201\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=9LIVES.us.planview.world)(PORT=1521)
))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC0ipc)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "ORCLU" has 2 instance(s).
Instance "ORCLU", status UNKNOWN, has 1 handler(s) for this service...
Instance "orclu", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orclu", status READY, has 1 handler(s) for this service...
The command completed successfully


I wonder why it says ORCLU has 2 instance(s). At the bottom, it says "orclu" status READY. I don't see a similar statement for "orcl".

This is how my listener file looks like:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 9LIVES)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\OraHome9201)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCLU)
(ORACLE_HOME = C:\OraHome9201)
(SID_NAME = ORCLU)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = C:\OraHome9201)
(SID_NAME = ORCL)
)
)

This is how my sqlnet.ora file looks like:
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES= (none)
#SQLNET.AUTHENTICATION_SERVICES= (NTS)
#NAMES.DIRECTORY_PATH= (TNSNAMES,ONAMES,HOST NAME)
#TVDB fixed above to help stop TNS-12638


This is how my tnsnames.ora file looks like:

9LIVES =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 9lives)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL)
)
)

9LIVESU =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 9lives)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCLU)
)
)

Thanks,


Tom Kyte
April 27, 2006 - 2:45 pm UTC

everything but....

the syntax you use to connect - like a cut and paste showing what you mean...

follow up,

A reader, May 05, 2006 - 11:12 am UTC

I am sorry for not following up last week.

Anyway, on windows server, at command line prompt,
I say sqlplus /nolog
then..
I say conn sys@9lives as sysdba
(this one always connects to ORCLU database).
for the other database, I say

conn sys@9livesu as sysdba
This connection is good and points to the right database (ORCLU).

I am puzzled.

Thanks,


two listeners,

A reader, June 02, 2006 - 11:26 am UTC

On windows box I have two databases. I have some issues in connecting to both the databases. I have discussed that problem in this thread.

I am thinking of setting up two listeners one for each database. Do you think it is a good idea?



Tom Kyte
June 02, 2006 - 11:34 am UTC

no, you only need one listener.

listener,

A reader, June 02, 2006 - 11:39 am UTC

but my problem still continues. I have my listener file, sqlnet file and they way I connect to the database in this thread. I have no clue now how to make both the databases active in my listener.



Tom Kyte
June 02, 2006 - 11:44 am UTC

"prove it"

show us some cutting and pasting.

show what you do

Holger Bär, June 02, 2006 - 12:03 pm UTC

A reader:

From the output of lsnrctl status it looks like your ORCL instance is not started - else you would get (provided the database came up after the listener) a line saying Service "ORCL" has one instance status "READY".

Try to start the Instance using
oradim -startup -sid orcl

If this works, then
c:\> set ORACLE_SID=orcl
c:\> sqlplus / as sysdba

You should get the sql prompt. If this fails with something like "Shared memory realm doesn't exist" then the instance could not be started. In that case try

c:\> oradim -startup -sid orcl -starttype srv

which should start the service but not the instance.

Now try again
c:\> sqlplus / as sysdba

This should give you an "connected to an idle instance". Now
sql> startup
and report errors if any back.

How do you determin that you're connected to the ORCLU instance? Cut'n paste please?

HTH Holger

Why shut down the database at all?

Ashutosh, June 02, 2006 - 1:32 pm UTC

Hi Tom,

With reference to the original question in this thread - I belong to the school of thought that your Oracle database should NEVER be shut down. NEVER. Every time you shut down, you wipe out your SGA and consequently your shared pool too, and then the costly parse and execute cycle reiterates - leave alone the library cache etc that needs to be rebuilt - at a considerable cost.

I am quite surprised that such significant consequences of shutting down databases at the end of the day/for backups/whatever, escape the notice of DBAs.

With Oracle 10g (and EM running), I believe the database adapts to the workload that it is being subjected to, provided it is running continuously. Shutting down the database defeats this purpose. Will you share your views on this aspect? Thanks.


Tom Kyte
June 02, 2006 - 3:05 pm UTC

it won't defeat it, it will just change "your profile". The database remembers what it was 'thinking' when you shut it down and picks up where it left off - however, the scenario right after a shutdown/startup is very very different than if you just let it run on and on.

So, it won't defeat it, it just changes your "fingerprint" - what you system looks like.

Automatic Startup of oracle in Linux

V K Ravi, June 05, 2006 - 2:08 am UTC

how can we do this task in linux?
thx