Just another RMAN backup-script for Windows

I was asked to deliver a backup-script for a windows-database – really ! However I’m not an o.s.-scripting guru at all and certainly not on Windows, I came to the following. It looks a lot like the one I use on Linux, just tried to translate it into a .cmd-file. The challenge was to get it in one-command file.
I noticed there  are a lot of RMAN backup-scripts, but not very much executed from a cmd-file:

By |May 16th, 2010|Categories: Database, RMAN|Tags: , |1 Comment

RMAN: restore database on another node including rename

In my urge to write down some basic RMAN-checklists I could use in the future,  consider the following:

You’ve got no DataGuard at your disposal. Single node, relying on your RMAN-backup on disk, which is fortunately copied to tape. Now your complete node is burning down. What’s is left is your RMAN-backup (made by this script).
In a bad scenario you’ll have to restore this to another node.

No rocket science, but at that very moment you’re not very relaxed, and will be happy that it’s documented in the past by or for you how to do it. Also to be used to make a copy of the production-database, however I find the technique of ‘duplicating with RMAN‘  easier and more adequate for this purpose. Here are the basics of a restore on another node and give the database another name. Yes, it can be scripted and make it faster at certain points , but that’s not the point in this story….

Example: restore the database DEVDB (node LARRY) on the node ELLISON and give it the name DEVDBNEW.
The daily backups on LARRY are on  /local/data/oracle/rman/DEVDB

On ELLISON, create the same backup-directory:
As root:
>> mkdir –p /local/data/oracle/rman/DEVDB
>> chown –R oracle:oinstall /local
As an alternative: if there is already a /backup/data/oracle or something like that, use a symbolic link:
>> ln –s /backup local

The intention here is to copy the bunch from LARRY to ELLISON, but if it’s possible, you can always mount the directory ‘/local/data/oracle/rman/DEVDB’ on ELLISON to the same directory on LARRY, so you don’t have to copy.  Saves a lot of time, only be aware of the ‘..cfc..’-file. If the origin database is in ‘autobackup’ mode, this file will be overwritten by the origin database when there are changes.  Also the new database is using this file, while restoring and may also be in autobackup-mode.  So make a copy of the original file (which has  a date which is the end of the backup you are using).

Find out where the files should be placed:

select name from v$tempfile
select member from v$logfile
select name from v$datafile
select name from v$controlfile;

or: use ‘report schema’ in RMAN.

As Oracle:
Edit /etc/oratab on ELLISON, with the origin name, temporarily:
Run .oraenv (DEVDB), for the right environment.

Create directories for the database files (these ones already with the new db name):
>>mkdir –p /data10/oradata/DEVDBNEW/arch

Create new backup directories:
>> mkdir –p /backup/ELLISON/DEVDBNEW/export
>> mkdir –p /backup/ELLISON/DEVDBNEW/rman

Create directories for the admin files (with the new db name):
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/adump
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/bdump
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/cdump
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/udump
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/scripts
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/pfile
>> mkdir –p /software/oracle/product/10202/admin/DEVDBNEW/dpdump

By |October 18th, 2009|Categories: Database, RMAN|Tags: , |0 Comments

Cloning / duplicating with RMAN, the basics

It is considered  a skill every DBA should have, cloning a database with RMAN.  But still meeting DBA’s which never used this… Decided to write down some basic RMAN-stuff , just as a notepad, and maybe it’s helpfull for others..

My own basic checklist through an example:

Cloning of the  DEVDB on the node  LARRIE to node ELLISON, new database name DEVDBNEW.  The versions of the Oracle database on LARRY and ELLISON should be equal by the way!

- In order to get the backup on the same place where it stood on LARRIE ( RMAN gets this from the controlfile): create the same directory. E.g. create directory /backup/LARRIE/DEVDB/rman (on ELLISON!)

As root on ELLISON:
>> mkdir -p /backup/LARRIE/DEVDB/rman
>> chown -R oracle:oinstall /backup

- put the new database name  and home in /etc/oratab :
>> DEVDBNEW:/software/oracle/product/10.2:N

As oracle on ELLISON:
- run oraenv, for getting your right environment:
>> . oraenv (DEVDBNEW).

- Create a password file:
>> cd $ORACLE_HOME/dbs
>> orapwd file=orapwDEVDBNEW password=<password> entries=5

- Create directories for your datafiles:
>> mkdir -p /data/oradata/DEVDBNEW/arch
>> mkdir -p /data/oradata/DEVDBNEW/directories

- Create directories for your backup:
>> mkdir -p /data/oradata/backup/DEVDBNEW/export
>> mkdir -p /data/oradata/backup/DEVDBNEW/rman

- Create directories for the admin-files:
>> mkdir -p /software/oracle/admin/DEVDBNEW/adump
>> mkdir -p /software/oracle/admin/DEVDBNEW/bdump
>> mkdir -p /software/oracle/admin/DEVDBNEW/cdump
>> mkdir -p /software/oracle/admin/DEVDBNEW/udump
>> mkdir -p /software/oracle/admin/DEVDBNEW/scripts
>> mkdir -p /software/oracle/admin/DEVDBNEW/pfile
>> mkdir -p /software/oracle/admin/DEVDBNEW/dpdump

By |October 18th, 2009|Categories: Database, RMAN|Tags: , |0 Comments

RMAN-06053 tijdens Point in Time Recovery

Zo’n 6 keer uitgevoerd op een ontwikkel-database: restoren via rman naar een bepaalde tijd. 7e keer gaat het restore-gedeelte goed, recovery niet: RMAN-06053, missing log – terwijl die er toch echt is naar mijn bescheiden mening. Database versie op Suse 9.

By |December 6th, 2008|Categories: RMAN||0 Comments

Backup database shell-script with RMAN

A proper backup is the base for a well and relaxed administration of yout databases.What follows is a backup-script which I use for several customers. It’s backing up all in the same directory and I tested the restore frequently.

There’s however one drawback: I copied the script through word- or notepad apparently, so take care of the (double) quotes used in the script. You may have to re-type them.

By |November 14th, 2008|Categories: RMAN|Tags: , |0 Comments