Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Off-line backup in Windows NT/2K

0 views
Skip to first unread message

Dino Hsu

unread,
Aug 1, 2001, 9:45:06 PM8/1/01
to
Dear all,

I have written scripts to do off-line backup of a database as follows:

<backup_twdm.bat begin>
@ECHO OFF
IF "%1"=="" GOTO ERROR
SET ORACLE_SID=TWDM
svrmgrl @shutdown_twdm.sql
"c:\program files\winzip\wzzip" -rP d:\twdm.bak\twdm_%1 d:\twdm
svrmgrl @startup_twdm.sql
GOTO END
:ERROR
ECHO Usage backup_twdm.bat yyyymmdd
GOTO END
:END
<backup_twdm.bat end>

<startup_twdm.sql begin>
connect internal;
startup pfile=d:\twdm\ctlfile\inittwdm.ora;
<startup_twdm.sql end>

<shutdown_twdm.sql begin>
connect internal;
shutdown immediate;
<shutdown_twdm.sql end>

Among which wzzip.exe is the command-line add-on of WINZIP 8.0. With
the help from a compression program such as WINZIP, the size of the
backup can be dramatically decreased to about only 1/20 and makes
backup process much easier.

There are some issues here, however, to be discussed about:
1.I used to see a script in AIX like this:
svrmgrl <<EOF
cmd-1...
cmd-2...
cmd-3...
EOF
which embeds SQL or SQL*Plus commands in the shell program. If I can
do this in a DOS/Windows batch program, the startup_twdm.sql and
shutdwon_twdm.sql can be suppressed; but I don't know how.
2.This batch program (backup_twdm.bat) has one parameter, date with
format yyyymmdd, to be used as part of the archive file name. I wish
this batch program can get the current date automatically, but I don't
know how. Maybe some outside programming is necessary.
3.WINZIP 8.0 cannot compress files bigger than 8G, so make sure the
datafiles are not too big. (but I don't know the exact limitation, I
cannot find it)
4.WINZIP 8.0 doesn't seem to generate a log, either.

I don't think this problem exists in any Unix platforms because the
shell program is so powerful. It is a problem, however, in Windows
NT/2K environments. Any comments are highly appreciated.

Dino

Bart

unread,
Aug 2, 2001, 9:29:49 AM8/2/01
to
Dino,

As far as I know - one can correct me if I am wrong - it is not
possibile in NT to read input (with ENTERS etc.) like you can do in
UNIX. The script you made with calling SQLPLUS @filename.sql is the
only alternative.

If you prefer Unix tools, you can always try to use their ports to NT
as you can find them for instance at the following link :
http://www.weihenstephan.de/~syring/win32/UnxUtils.html.
There is also a link to ZSH-shell for Win32.

I Hope this will help you.

Kind regards,

Bart.

Dino Hsu <dino1_...@ms1.hinet.net> wrote in message news:<cs8hmtk62kkbqkh7d...@4ax.com>...

Dino Hsu

unread,
Aug 3, 2001, 3:10:49 AM8/3/01
to
Dear all,

In addition, if I want to keep the last n (say 3) copies of backup
files, it is also difficult in Windows NT/2K.

Dino

Pieter Claerhout

unread,
Aug 4, 2001, 3:39:48 AM8/4/01
to
Why don't you go with one of the numerous scripting languages that are
available on Windows? You could give Python a try for example. I will give
you an easy syntax and you'll be able to do lots more than with just batch
scripts. It has a very powerful module that enables you to connect to Oracle
(called DCOracle) and it would allow you to everything you describe below
(and lots more of course).

VBScript together with ADO could also be an option...

Cheers,

Pieter

"Dino Hsu" <dino1_...@ms1.hinet.net> wrote in message

news:4hjkmt4h8auba3qco...@4ax.com...

Dino Hsu

unread,
Aug 5, 2001, 3:48:36 AM8/5/01
to
Dear all,

Among the three scripting language candidates in Windows NT/2K:
python, perl, and VBScript, can you provide comments in terms of the
following aspects?
1.Easy of use
2.Free of charge
3.Good for system administration tasks

Thanks,
Dino

Pieter Claerhout

unread,
Aug 5, 2001, 4:35:44 AM8/5/01
to
Hi Dino,

all of them are free of charge actually. VBScript is included by default on
any Windows NT/Windows 2000 server.

In terms of ease of use, I think Python will be the winner. Second place
would be for VBScript, and on the last place I would put Perl. Python has a
very clean and clear syntax, has a very good and very helpful mailing list,
and also has lots of documentation. VBScript is ok as well, but there's less
documentation, unless you want to go digging in Microsoft's MSDN. Perl has a
very ugly syntax, but also has lots of documentation.

I think both Python and Perl are really good for system administration.
There's absolutely nothing you can't do in Perl or Python that you can do in
batch scripts. I actually use Python every day for system administration,
and I can automate practically everything on a Windows 2000 or Windows NT
server.

Something worth mentioning is that Perl and Python run on a variety of
platforms, meaning Windows, Unix, Linux, Mac, ... so whatever you produce in
one of those languages, could be used on different platforms as well (unless
you do really platform specific things).

If you want, I can write you a Python version of the script below (or a
VBScript version). If you want me to do so, please contact me offline.

For more information about these scripting languages, please consult the
following websites:
- Python: http://www.python.org/
- VBScript: http://msdn.microsoft.com/scripting/
- Perl: http://www.perl.com/

Cheers,

Pieter

"Dino Hsu" <di...@ms1.hinet.net> wrote in message
news:r3upmt04rgi7jb8r9...@4ax.com...

Dino Hsu

unread,
Aug 5, 2001, 10:44:27 AM8/5/01
to
Dear Pieter,

It is so kind of you. Because the current project has been written in
Access 97 VBA, which schedules complicated ETL (extract, transfer,
load) process for warehousing. I will try python in my next project.

For the time being, why don't you show the off-line backup example
from my original question? That is quite simple, it takes you only 5
min. to do that, I suppose. Thanks again.

Dino

On Sun, 05 Aug 2001 08:35:44 GMT, "Pieter Claerhout"

Galen Boyer

unread,
Aug 13, 2001, 11:40:14 PM8/13/01
to
On Thu, 02 Aug 2001, dino1_...@ms1.hinet.net wrote:

> There are some issues here, however, to be discussed about: 1.I
> used to see a script in AIX like this: svrmgrl <<EOF cmd-1...
> cmd-2... cmd-3... EOF which embeds SQL or SQL*Plus commands
> in the shell program. If I can do this in a DOS/Windows batch
> program, the startup_twdm.sql and shutdwon_twdm.sql can be
> suppressed; but I don't know how.


The cygwin utils have ported UNIX to the windows desktop and your
*.sh files should run as you are used to. The HEREIS
functionality works quite nicely.

> 2.This batch program (backup_twdm.bat) has one parameter, date
> with format yyyymmdd, to be used as part of the archive file
> name. I wish this batch program can get the current date
> automatically, but I don't know how. Maybe some outside
> programming is necessary.

,----[ Here is the quick sh script on NT with Cygwin ]
| #!/bin/sh
|
| date
`----

,----[ Here is the shell output ]
| > tmp.sh
| Mon Aug 13 00:22:19 2001
`----

The options work as well.
--
Galen Boyer
It seems to me, I remember every single thing I know.

Dino Hsu

unread,
Aug 14, 2001, 12:41:05 AM8/14/01
to

I am studying the python language now, and there are so many posts in
comp.lang.python, it seems to be an interesting shell language.

As for cygwin, this is the first time I heard it, some comparision
with perl or python might be necessary. Is it free of charge?

Dino

On 13 Aug 2001 22:40:14 -0500, Galen Boyer <galen...@hotpop.com>
wrote:

Galen Boyer

unread,
Aug 14, 2001, 9:40:14 PM8/14/01
to
On Tue, 14 Aug 2001, dino1_...@ms1.hinet.net wrote:

> I am studying the python language now, and there are so many
> posts in comp.lang.python, it seems to be an interesting shell
> language.

You got the wrong idea. Cygwin isn't a scripting language. It
is a distribution of Unix tools that run on the windows desktop.

It has a sh.exe and a bash.exe, which allows you to run UNIX
shell scripts on windows and copy that code to a UNIX machine and
also execute it there.

Make sense.

> As for cygwin, this is the first time I heard it, some
> comparision with perl or python might be necessary.

It has a perl and a python distribution in it.

> Is it free of charge?

Yes. Comes from the Redhat guys.

http://www.cygwin.com/

0 new messages