Alex,

You could do what you want in a batch or shell script before
calling RMan.  Below is a snippet of a *.cmd file used by
Veritas NetBackup to do a cold backup with RMan.  It's for
Windows2000 or NT, but you could do something similar on
UNIX.

@REM --- Set the
variables --------------------------------------------------
---
...
@set OUTF=%~dpn0.out
...
@set TMPF=%~dpn0.tmp
...
@set ORACLE_HOME=d:\oracle\ora81
...
@set ORACLE_SID=mysid
...
@REM -------------------------------------------------------
--------------------
@REM Call Server Manager to shutdown the target database in
immediate priority.
@REM This lets current calls to the database complete, but
prevents further
@REM logons or calls.
@REM
@REM The shutdown-startup logic of this script can be
commented out if you know
@REM that the database will always be mounted and in a
consistent state before
@REM this script is executed.
@REM -------------------------------------------------------
--------------------

@echo connect internal/oracle > %TMPF%
@echo shutdown immediate >> %TMPF%
@echo exit >> %TMPF%

@echo # >> %OUTF%
@echo %ORACLE_HOME%\bin\%SVRMGR% >> %OUTF%
@type %TMPF% >> %OUTF%
%ORACLE_HOME%\bin\%SVRMGR% < %TMPF% >> %OUTF%

@REM -------------------------------------------------------
--------------------
@REM Startup the database in case it had crashed or was not
shutdown cleanly
@REM prior to starting this script.  This will perform a
crash recover if
@REM it is needed. Use the RESTRICT option because we are
going to shutdown
@REM again right away and we don't want to let users in
during the short
@REM interval. The default init<SID>.ora file will be used
by startup. If it was
@REM moved, the name was changed, or ORACLE_HOME and
ORACLE_SID are not set, use
@REM the pfile= option on the startup command.
@REM -------------------------------------------------------
--------------------

@echo connect internal/oracle > %TMPF%
@echo startup restrict open >> %TMPF%
@echo shutdown immediate >> %TMPF%
@echo exit >> %TMPF%

@echo # >> %OUTF%
@echo %ORACLE_HOME%\bin\%SVRMGR% >> %OUTF%
@type %TMPF% >> %OUTF%
%ORACLE_HOME%\bin\%SVRMGR% < %TMPF% >> %OUTF%

@REM -------------------------------------------------------
--------------------
@REM Now we know that the database is cleanly closed and is
ready for a
@REM cold backup. RMAN requires that the database be started
and mounted
@REM to perform a backup.
@REM -------------------------------------------------------
--------------------

@echo connect internal/oracle > %TMPF%
@echo startup mount >> %TMPF%
@echo exit >> %TMPF%

@echo # >> %OUTF%
@echo %ORACLE_HOME%\bin\%SVRMGR% >> %OUTF%
@type %TMPF% >> %OUTF%
%ORACLE_HOME%\bin\%SVRMGR% < %TMPF% >> %OUTF%

@REM -------------------------------------------------------
--------------------
@REM Temporary file no longer needed.
@REM -------------------------------------------------------
--------------------

@if exist %TMPF% del %TMPF%

@REM -------------------------------------------------------
--------------------
@REM What kind of backup will we perform.
@REM -------------------------------------------------------
--------------------

@if "%NB_ORA_INCR%" == "1" goto differential

@if "%NB_ORA_CINC%" == "1" goto cumulative

@REM -------------------------------------------------------
--------------------
...
now call RMan and do the cold backup...
------------------------------------------------------------
--------------------


Hope this helps you.

Jack

--------------------------------
Jack C. Applewhite
Database Administrator/Developer
OCP Oracle8 DBA
iNetProfit, Inc.
Austin, Texas
www.iNetProfit.com
[EMAIL PROTECTED]


-----Original Message-----
Berindei
Alex
Sent: Friday, March 09, 2001 1:51 PM
To: Multiple recipients of list ORACLE-L



Hi smart guys,

I need a RMAN script command to close a database, do you
think this can be
done.

What I know is I can start the database, for "MOUNT" state
to "OPEN" with
next script, using a SQL command:

{
  allocate channel type disk ....
  sql 'ALTER DATABASE OPEN';
}

What I have?
I have an open database in NOARCHIVE log mode (don't ask
why) which I want
to backup.
What I want?
To put database in MOUNT state from RMAN script, backup
whole database,
reopen the database.
{
????HERE NEED COMMAND TO PUT DATABASE IN MOUNT STATE
  allocate channel type disk ....
  backup .... whole database in MOUNT state
  sql 'ALTER DATABASE OPEN';
}

Thanks alex.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jack C. Applewhite
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to