RMAN 10G script examples
Hi all,
I plan to start using RMAN soon. After doing a lot of reading, I have a pretty good feel for how it works and the syntax.
I'd appreciate getting some good example scripts that I can compare with mine. I realize I can compare with the DBA manual, but I'd rather see something that someone has been using successfully. Perhaps I'll use them as a starting point for my on RMAN scripts.
If it makes a difference, we are at RMAN 10G and our server is Windows 2003.
Thanks a bunch.
Full Database backup
rman
connect rcvcat username/password@rmancat
connect target username/password@target
run {
set command id to 'rman 10g database';
allocate channel tape1 type 'SBT_TAPE' format '%d_full_%U';
allocate channel tape2 type 'SBT_TAPE' format '%d_full_%U';
allocate channel tape3 type 'SBT_TAPE' format '%d_full_%U';
backup incremental level=0 tag="target_Level0_full" (database filesperset=25 include current controlfile);
sql 'alter system archive log current';
change archivelog all validate;
backup filesperset 5 archivelog all;
backup current controlfile format '%d_cf_%U';
release channel tape1;
release channel tape2;
release channel tape3;
Archive log backup and delete
rman
connect rcvcat username/password@rmancat
connect target username/password@target
run {
set command id to 'rman 10g archive backup';
allocate channel tape1 type 'SBT_TAPE' format '%d_full_%U';
allocate channel tape2 type 'SBT_TAPE' format '%d_full_%U';
allocate channel tape3 type 'SBT_TAPE' format '%d_full_%U';
sql "alter system archive log current";
backup tag="target_Level0_arch" filesperset 10 archivelog until time 'sysdate - 1/24' delete input;
release channel tape1;
release channel tape2;
release channel tape3;
}
Similar Messages
-
I am trying to automate the backups and disk maintenence on a test machine using a "Host Command" in the 10g EM environment. If I run the script from the command on the target host the scripts completes successfully.
This is the script:
ORACLE_HOME=/u01/app/oracle/product/9.2.0
export ORACLE_HOME
ORACLE_SID=coeusdba.
export ORACLE_SID
rman <<EOF
connect target sys<password>@coeusdba;
connect catalog <user>/<password>@recv;
replace script coeusdba_full_bkp {
allocate channel Channel1 type disk format '/u03/orabkp/coeusdba/b_%u_%p_%c';
backup
( database include current controlfile );
backup ( archivelog all delete input );
run { execute script coeusdba_full_bkp;}
EOF
/u01/app/oracle/product/9.2.0/dbs/scripts/coeusdba_new.sh
exit
When I execute the same script from a 10g EM "Host Command" job the script fails at the PERL command step with the following output:
Recovery Manager: Release 9.2.0.7.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
RMAN>
RMAN>
connected to target database: COEUSDBA (DBID=1916078485)
RMAN>
RMAN>
connected to recovery catalog database
RMAN> 2> 3> 4> 5> 6> 7> 8>
replaced script coeusdba_full_bkp
RMAN>
RMAN>
executing script: coeusdba_full_bkp
allocated channel: Channel1
channel Channel1: sid=10 devtype=DISK
Starting backup at NOV-01-2005 10:32:32
channel Channel1: starting full datafile backupset
channel Channel1: specifying datafile(s) in backupset
including current controlfile in backupset
input datafile fno=00006 name=/u02/oradata/coeusdba/users01.dbf
input datafile fno=00002 name=/u03/oradata/coeusdba/undotbs01.dbf
input datafile fno=00004 name=/u03/oradata/coeusdba/index01.dbf
input datafile fno=00005 name=/u03/oradata/coeusdba/tools01.dbf
input datafile fno=00007 name=/u03/oradata/coeusdba/xdb01.dbf
input datafile fno=00001 name=/u02/oradata/coeusdba/system01.dbf
input datafile fno=00003 name=/u02/oradata/coeusdba/drsys01.dbf
channel Channel1: starting piece 1 at NOV-01-2005 10:32:33
channel Channel1: finished piece 1 at NOV-01-2005 10:33:28
piece handle=/u03/orabkp/coeusdba/b_3rh2l4q1_1_1 comment=NONE
channel Channel1: backup set complete, elapsed time: 00:00:55
Finished backup at NOV-01-2005 10:33:28
Starting backup at NOV-01-2005 10:33:29
current log archived
channel Channel1: starting archive log backupset
channel Channel1: specifying archive log(s) in backup set
input archive log thread=1 sequence=49 recid=200 stamp=573215609
channel Channel1: starting piece 1 at NOV-01-2005 10:33:32
channel Channel1: finished piece 1 at NOV-01-2005 10:33:33
piece handle=/u03/orabkp/coeusdba/b_3sh2l4rr_1_1 comment=NONE
channel Channel1: backup set complete, elapsed time: 00:00:02
channel Channel1: deleting archive log(s)
archive log filename=/u04/arch/coeusdba/1_49.dbf recid=200 stamp=573215609
Finished backup at NOV-01-2005 10:33:35
Starting Control File and SPFILE Autobackup at NOV-01-2005 10:33:35
piece handle=/u04/orabkp/coeusdba/ctl_file_bkps/c-1916078485-20051101-00 comment=NONE
Finished Control File and SPFILE Autobackup at NOV-01-2005 10:33:38
released channel: Channel1
RMAN>
RMAN>
Recovery Manager complete.
syntax error at /u01/app/oracle/product/9.2.0/EM10g_1/perl/lib/5.6.1/warnings.pm line 306, near "{^"
syntax error at /u01/app/oracle/product/9.2.0/EM10g_1/perl/lib/5.6.1/warnings.pm line 311, near "{^"
BEGIN failed--compilation aborted at /u01/app/oracle/product/9.2.0/EM10g_1/perl/lib/5.6.1/English.pm line 38.
BEGIN failed--compilation aborted at /u01/app/oracle/product/9.2.0/dbs/scripts/rmanc.pl line 20
Is anyone having this problem in 10g and if so , can you provide me with some insight with respect to resolution?The .sh script calls a perl script that parses the output of the report obsolete command in rman and deletes the obsolete datasets from disk. This shell completes from the command line with no errors. Here is the .sh and the perl script. Like I said the odd thing is that this shell executes successfully from the command line. Thanks for your interest in looking at this.
cat coeusdba_new.sh
/u01/app/oracle/product/9.2.0/dbs/scripts/rmanc.pl target sys/<password>@coeusdba catalog rmantest/<password>@recv redundancy 2
rmanc.$ cat rmanc.pl
#!/usr/bin/perl -w
# NAME
# rmanc.pl - delete obsolete backups and copies
# DESCRIPTION
# This perl script automates deletion of obsolete datafilecopies and
# backup pieces. It uses perl strin manipulation to process the output of the RMAN
# "report obsolete" command and creates rm commands to delete the files
# NOTES
# Some customization is necessary.
# Adapted from Oracle 8i rman1.sh Unix shell script.
# benmalek 03/08/2003 - Modified to delete backup sets and datafilecopies only
# Does not touch backup records.
use strict;
#use English;
#$ENV{ORACLE_OWNER}='oracle';
#$ENV{ORACLE_HOME}='/disk01/app/oracle/product/9.2.0';
$ENV{NLS_DATE_FORMAT}='DD-MON-YYYY:HH24:MI:SS';
&PrintEnv;
sub Usage {
my ($arg1, @arg2) = @_;
my $base_name = `basename $0`;
chop($base_name);
CASE: {
if (!defined($arg1)) {last CASE; }
if ($arg1 =~ /\S/) {print ("\nUnknown argument or incorrect value for: $arg1\n\n"); last CASE; }
my $example1 = 'rmanc.pl target sys/orclpass@orcl catalog rman/rmanpass@rec redundancy 5';
my $example2 = 'rmanc.pl target sys/orclpass@orcl nocatalog redundancy 5';
my $usage_txt =
" Usage: $base_name [option] ...
option: [target CNCTSTR] [catalog CNCTSTR | nocatalog] [params 'PARMS'] [redundancy NUMBER]
Option Description
target CNCTSTR Connect to the target db using CNCTSTR.
catalog CNCTSTR Connect to catalog db using CNCTSTR.
nocatalog Don't use a recovery catalog.
parms 'PARMS' Use PARMS string for SBT_TAPE maintenance channel.
You can use single or double quotes depending on
your needs. In the rman script, single-quotes
will be used.
redundancy NUMBER Set redundancy of backups to NUMBER.
The catalog or nocatalog option must be specified. All others are optional
The target option must also be specified
Examples:
$example1
$example2 ";
print ("$usage_txt \n");
die "Exiting subroutine 'Usage'.\n";
# Initialize default connect string variables:
my $target=""; # force user to supply target option
my $catalog=""; # force user to supply catalog option;
my $parms="";
my $redun=""; # force user to supply redundancy option;
# process target and catalog arguments
my $args = @ARGV;
while ( $args > 0 ) {
ARGS: {
if (($ARGV[0] eq "target") && defined($ARGV[1]))
{$target="$ARGV[0] $ARGV[1]"; shift(@ARGV); last ARGS;}
if (($ARGV[0] eq "catalog" || $ARGV[0] eq "rcvcat") && defined($ARGV[1]))
{ $catalog="$ARGV[0] $ARGV[1]"; shift(@ARGV); last ARGS;}
if ($ARGV[0] eq "nocatalog") { $catalog="$ARGV[0]"; last ARGS;}
if (($ARGV[0] eq "parms") && defined($ARGV[1])) { $parms = "$ARGV[0] $ARGV[1]"; shift(@ARGV); last ARGS;}
if (($ARGV[0] eq "redundancy") && defined($ARGV[1]) && !($ARGV[1] =~ /\D/))
{$redun=$ARGV[1]; shift(@ARGV); last ARGS;}
&Usage($ARGV[0]);
shift(@ARGV);
$args= @ARGV;
if ((!defined($catalog) || $catalog eq "") || (!defined($target) || $target eq "") || (!defined($redun) || $redun eq "" )) {&Usage;}
#print (" target=$target \n catalog=$catalog \n parms=$parms \n redundancy=$redun\n");
# Get a list of obsolete disk files to delete:
my @rman_out=`rman $target $catalog << EOF
report obsolete redundancy=$redun device type disk;
exit;
EOF`;
# debug
print ("############################################\n");
print ("Output of REPORT OBSOLETE REDUNDANCY=$redun\n");
print @rman_out;
print ("############################################\n");
#my $command = `rman $target $catalog << EOF
# report obsolete redundancy=$redun device type disk;
# exit;
# EOF"
#open (RMAN, "$command |" );
#my @rman_out=<RMAN>;
# Extract the names of the obsolete files to delete
my $line;
my @files;
my @dates;
my @pieces;
foreach $line (@rman_out) {
if (($line =~ /Backup Piece/) && ($line =~ /\S/)) {
my @fields=split (/\s+/, $line);
my $nelem=@fields;
push(@pieces, $fields[$nelem-3]);
push(@dates, $fields[$nelem-2]);
push(@files, $fields[$nelem-1]);
# Verify files exists
my $i=0;
foreach $line (@files) {
if (-e $line) {
print ("Deleting backup piece or file copy: $pieces[$i] $dates[$i] $line\n");
system("rm $line");
} else {
# print ("file $line does not exist. \n");
$i = $i + 1;
sub PrintEnv{
my $var;
foreach $var (sort keys %ENV) {
print "$var: \"$ENV{$var}\".\n"
pl -
How to update host username/password in RMAN - 10g Enterprise manager bkp
Hi,
We have RMAN - 10g Enterprise manager scheduled.
Last week we changed OS - Oracle password.
Now backups are failing.
Please let me know where to update Host username/password details in 10g Enterprise manager...it is showing sys credentials only.
I see the following tips in Enterprise manager.
"Normal credentials are used by Enterprise Manager functions that need operating system access but do not require administrator privileges. Privileged credentials are used by functions that do need administrator privileges. Database functions and jobs that require host credentials do not use the credentials set on this page; they instead use database-specific host credentials set on the Database Preferred Credentials page."
Please let me know where can i set database-specific host credentials ?
Message was edited by:
user589334 -
ABAP SCRIPTS Examples Programs ,Screen shots ...i need?
Hi to ALL
hru?
Friends
i need ABAP SCRIPTS Examples Programs and screen shots those are most useful for me and pdf file.
plz help to me send immid.
Thanking U
MuraliYour imany nterview type questions have all been locked => please read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting again.
Many thanks,
Julius -
RMAN Backup Script not running in cron tab
Hi,
I am having rman backup script which is being executed successfully through shell.
but when scheduled in cron the script is being called but RMAN commands are not getting executed.
i have scheduled cron using oracle user.
Attached below the rman script for taking LEVEL 1 backup
#! /bin/ksh
DATE=`date +%Y-%m-%d`
export ORACLE_SID=ACIDC
export ORACLE_BASE='/home/app/oracle/product/10.2.0'
PATH=$PATH:${ORACLE_HOME}/bin
export PATH
export ULIMIT=unlimited
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
export LIBPATH=$LD_LIBRARY_PATH:/usr/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
cd $ORACLE_HOME/bin
rman TARGET= / << EOF > /oraclebkp/rmanlogs/ACIDC/$DATE.log
backup incremental level 1 database;
report obsolete;
delete noprompt obsolete;
exit;
EOF
exit 0
Attached cron script
SHELL=/bin/sh
PATH=:/usr/ucb:/bin:/usr/bin
10 17 * * 2 /oraclebkp/rmanscripts/rmandclvl1.sh 2>&1 >/oraclebkp/cronlogs/delobs.log
Files delobs.log
and oraclebkp/rmanlogs/ACIDC/$DATE.log are being created but with 0 bytes .
Thanks in Advance
HariPriya,rman TARGET= / << EOF > /oraclebkp/rmanlogs/ACIDC/$DATE.log Change this line to and try..
$ORACLE_HOME/bin/rman TARGET= / << EOF > /oraclebkp/rmanlogs/ACIDC/$DATE.log -
Hi
can anybody forward be sap scripts examples . Please forward me the documents on [email protected] .
Print program examples .
Configuration in nace , spro etc.
Thanks and regardsHi Naval,
Check these links.
http://www.sap-img.com/sapscripts/sample-sapscripts-label-printing-program.htm
http://www.sap-img.com/sapscripts/a-sample-sap-scripts-reports.htm
Also check these links.
SAP SCRIPT and the report
about sap script
Hope this resolves your query.
<b>Reward all the helpful answers.</b>
Regards -
Requiremen​ts Gateway OT-Script example 2.Trail
Hi BlueOnes,
I am still waiting for a small answer on following thread.
http://forums.ni.com/t5/NI-TestStand/Requirements-Gateway-OT-Script-example/td-p/2648861
Regards
Juergen
=s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=Duplicated:
See here
http://forums.ni.com/t5/NI-TestStand/Requirements-Gateway-OT-Script-example/m-p/2648861
=s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e= -
Requiremen​ts Gateway OT-Script example
Hi,
I have written my own TestStand NIRG intermidiate file generator as a COM compontent.
Now i would like to integrate it in NIRG via the OT-Script.
I have created a new .br file placed a new Method inside there.
Well at the moment i see my Teststand convert tool in the convert tool's drop-down list in types editor panel.
Of course i am not famous with this kind of scripts.
In the other br files there is a lot of code, but there are no comments.
Is there a suitable example or documentation on OT-Scripts ?
Regards
Juergen
=s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=Duplicated:
See here
http://forums.ni.com/t5/NI-TestStand/Requirements-Gateway-OT-Script-example/m-p/2648861
=s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e= -
Hi, I am inquiring as to how to create a job to run an rman script without using the Enterprise manager to schedule and create the job.
Thanks
JamesYou are going to want to at least set the following RMAN parameters. You may need to set other depending on your environment.
RETENTION POLICY
CONTROLFILE AUTOBACKUP ON
CONTROLFILE AUTOBACKUP FORMAT
PARALLELISM
CHANEL DEVICE TYP FORMAT
SNAPSHOT CONTROLFILE NAME
Below is an example of how I have these set on a test system. This from a 10g database
RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/backup/ecmtst/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/ecmtst/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/backup/ecmtst/snapcf_ecmtst1.f';
RMAN> -
Generate RMAN backup Script using unix shell script
Hello,
Could somebody give me a unix shell script that would generate RMAN script based on some user defined parameters in a config file.
e.g.
rman.conf
CHANNELS=4
USE_CATALOG=Y
DEVICE='sbt_tabe'
etc.,
many thanks,
kamYou can actually encapsulate the RMAN commands inside the shell script.
However if you really want to create a seperate RMAN script file, you can use the unix shell's "echo" command to write set variables to a file.
Thus, for example,
echo "rman target / catalog rman/rmanpassword@crcat" > RMAN_Script.rmn
echo "backup database plus archivelog" >> RMAN_Script.rmn
echo "backup archivelog all" >> RMAN_Script.rmn
creates RMAN_Script.rmn with 3 commands. -
Rman dataguard script for oracle10g
Dear Friends ,
I am going to configure oracle10g dataguard on oracle wnterprise linux 5.0 . I am trying to do this configuration
using RMAN .
After succesfully configuration of the PRIMARY End as well as I am going to configure standby end .
n the standby end I have to run the below rman script and got the syntax error :
[oracle@server dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 29 12:59:01 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile=initstan.ora
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
SQL>
6) Run RMAN and connect to the Standby database and make an auxiliary connection to the Primary database like below :
bash-3.2$ rman target sys@prim
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Mar 24 10:54:37 2000
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database:PRIM (DBID=1247570709)
RMAN> connect auxiliary sys/sys123@stan
connected to auxiliary database: STAN (not mounted)
RMAN
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate channel prmy5 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'prim','stan'
set db_unique_name='prim'
set db_file_name_convert='/u01/app/oracle/oradata/prim/','/u01/app/oracle/oradata/stan/'
set log_file_name_convert='/u01/app/oracle/oradata/prim/','/u01/app/oracle/oradata/stan/'
set control_files='/u01/app/oracle/oradata/stan/control01.ctl','/u01/app/oracle/oradata/stan/control02.ctl','/u01/app/oracle/oradata/stan/control03.ctl'
set log_archive_max_processes='5'
set fal_client='stan'
set fal_server='prim'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(prim,stan)'
set log_archive_dest_2='service=prim ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=prim'
NOFILENAMECHECK
Each and every time when I run the above script got the below error :
RMAN> 2> 3> 4> 5> 6> 7> 8>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "from": expecting one of: "dorecover, db_file_name_convert, nofilenamecheck, ;"
RMAN-01007: at line 9 column 39 file: standard input
RMAN>
RMAN>
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "allocate, alter, backup, beginline, blockrecover, catalog, change, connect, copy, convert, create, crosscheck, configure, duplicate, debug, delete, drop, exit, endinline, flashback, host, {, library, list, mount, open, print, quit, recover, register, release, replace, report, renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, switch, spool, startup, shutdown, send, show, test, transport, upgrade, unregister, validate"
RMAN-01008: the bad identifier was: parameter_value_convert
RMAN-01007: at line 2 column 1 file: standard input
Does anybody please correct the above script for 10g or if there any document for configuring oracle10g dataguard
using RMAN , then please help me .
Thx in advance .. ..shipon_97 wrote:
Dear Friends ,
I am going to configure oracle10g dataguard on oracle wnterprise linux 5.0 . I am trying to do this configuration
using RMAN .
After succesfully configuration of the PRIMARY End as well as I am going to configure standby end .
n the standby end I have to run the below rman script and got the syntax error :
You cannot use FROM ACTIVE DATABASE - option, If your database version is 10g .
Regards
Mahir M. Quluzade -
Hi,
We currently have an RMAN script that runs nightly to backup the database, including the archivelogs and purge. We are using flashback and would like to keep the archivelog available for 3 days.
I changed this:
backup check logical as compressed backupset archivelog all format '${RMAN_DIR}/%d_ARC_%Y%M%D_%s_%p'
delete input;
To this:
backup check logical as compressed backupset archivelog until time 'sysdate-3' format '${RMAN_DIR}/%d_ARC_%Y%M%D_%s_%p'
delete input;
I changed "all" to "until time 'sysdate-3'" and want to confirm this before I do anything. Thanks.Kamran's video would clear you everything.
I just want to add few quick steps from my side.
Step1.Make sure RMAN is connected to the right target database and the recovery catalog.
Then run the CREATE SCRIPT command, as shown in this example:
CREATE SCRIPT full_bkup
allocate channel ch1 type disk format '/backups/rman/%n%M%D%Y%s%U.bak' maxpiecesize 4G;
sql 'alter system archive log current';
sql 'alter system switch logfile';
backup incremental level 0 tag=rman_10 filesperset=5 database include current controlfile;
sql 'alter system archive log current';
sql 'alter system switch logfile';
release channel ch1;
Step2.Create a shell script rman_bkup_10g.ksh as below and initiate execution of the above script from this shell script.
rman target sys/sys-pwd@tgt-db-conn-str catalog rman/rman-pwd@rec-cat-conn-str
run {execute script *full_bkup*;}
exit
Step3.Schedule the shell script rman_bkup_10g.ksh in crontab as below(The example shows,the shell script gets executed everyday at 05:30)
30 05 * * * /path/to/script/rman_bkup_10g.ksh >> /path/to/log/rmanbkup.log
You may please tailor the scripts as per your need.
Edited by: bharathDBA on Aug 8, 2011 3:27 AM
Edited by: bharathDBA on Aug 8, 2011 3:52 AM
Edited by: bharathDBA on Aug 8, 2011 3:54 AM -
Oracle 9i Rman backup script !!
hi,
We are taking rman backup level 0. While making this backup the backup size is very big i.e. let's suppose if DB size is some 100GB then backup size would be somewhere around 60-70 GB. I need to know , does anybody having any script which compresses the backup sets after they get generated during the backup i.e. lets suppose 10 backup sets get generated, what I need to know is when RMAN is generating lets say 2 backup can we compress 1st backupset and so on like when 3rd backup set is getting generated we compress the 2nd backupset and so on till 10th backup set.
Let me know if anybody needs more information on this...I know it's a typical requirement :o))hello Hamir,
what operating system are you working on
after the backup you could call a routine in unix to gzip file_name
or in windows to use winzip.
however in 9i to restore the database you would then need to unzip the files first.
what possibility do you have to upgrade to 10g, this has the ability to automatically compress the backup set from within RMAN.
rgds
alan -
Rman hotbackup script log help needed
Hi I am trying this script to do a hot backup of the db. The db is 10g R2.
The script runs and does the backup. But the log file is not created and there is a file called rman_.log which is getting appended with
ps -ef | egrep pmon_$ORACLE_SID | grep -v grep
date +%d-%m-%y
Also I am unable to log the rman job. Can anyone advise what am I doing wrong. Thanks in advance.
# ~~~~~ set the variables ~~~~~ #
ORACLE_HOME=/u01/app/oraprd/product/10.2.0/db_1
ORACLE_BASE=/u01/app/oraprd
ORACLE_SID=testdb
DATE_TODAY='date +%d-%m-%y'
export ORACLE_HOME ORACLE_BASE ORACLE_SID
export DATE_TODAY
LOG_FILE=/scripts/rman_$ORACLE_SID_$DATE_TODAY_hot_bkp.log
export LOG_FILE
db_status="CLOSED"
# ~~~~~ Check if output file exists ~~~~~ #
if [ ! -e $LOG_FILE ] ; then
touch /scripts/rman_$ORACLE_SID_$DATE_TODAY_hot_bkp.log
chmod 755 /scripts/rman_$ORACLE_SID_$DATE_TODAY_hot_bkp.log
fi
# ~~~~~ Check status of database ~~~~~ #
pmon='ps -ef | egrep pmon_$ORACLE_SID | grep -v grep'
echo $pmon >> $LOG_FILE
echo $DATE_TODAY >> $LOG_FILE
if [ "$pmon" = "" ]; then
db_status="CLOSED"
echo "The db was closed; now starting to take backup" >> $LOG_FILE
else
db_status=sqlplus -s '/ as sysdba' <<EOF
startup;
exit
EOF
fi
if [ $db_status = "MOUNTED" -o $db_status = "OPEN" ]; then
echo "The db was open; now starting to take backup" >> $LOG_FILE
exit
EOF
fi
rman target / nocatalog log=$/scripts/rman_scripts/rman_${ORACLE_SID}_${DATE_TODAY}_hot_bkp.log <<EOF
run {
sql "alter system archive log current";
backup current controlfile;
backup database plus archivelog;
delete noprompt obsolete;
exit;
eofHi,
Now the script is logging but I am unable to run as a cron job.
$chmod 755 script
verfied the owner
$ crontab -l
00 02 * * * /scripts/rman_scripts/rman_prod_hot_bkp.sh >> /scripts/logs/rman_prod.hot_bkp.log 2>&1
but it does not work. when I
$ /scripts/rman_scripts/rman_prod_hot_bkp.sh
it works and the db is backed up. I know it is unix thing, but just can't seemt to figure out. Any ideas ???? -
Need Advice on RMAN backup script
Hi;
Can any one advice if any error or guide to make RMAN backup proper :
Backup Policy are:
1. 0 level backup
2. current log file is arvhived before backing up
3. backup whole database (datafiles)
4. backup separate control file
5. backup is done on disk
6. control file auto backup ON
7. only 7 days archive log are need to be preserve ; old need to be deleted
### one time paramters seting
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'O:\rman\backup\Auto_Ctrl_weekly_%F';
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
### Command for weekly 0 level backup
run {
allocate channel c1 type disk;
sql 'alter system archive log current';
backup incremental level 0 tag = weekly_database format 'o:\rman\backup\full_weekly_%d_%s_%p_%t'(database);
release channel c1;
configure controlfile autobackup format for device type disk to 'o:\rman\backup\auto_ctrl_weekly_%f';
allocate channel c1 type disk;
backup tag = weekly_arch archivelog until time 'sysdate-7' format 'o:\rman\backup\archive_weekly_%d_%s_%p_%t';
delete archivelog until time 'sysdate-7';
release channel c1;
Regards
SmithDear Pierre F.;
Actually, I just added in my backup plan to have daily backup through RMAN, instead of COLD backup.
I have planned to take cold backup once a week. here is the side of data:
*** datafile 410
*** size of database : 86 GM
*** relog files size : 250MB
*** daily archive logs are : 250MB * 4(number of files) = 1GM aprox.
yes, time constraint is there; just because of the size of database. and we r going for 24/7
Is this script going to run only one per week ?
Ans: no I this was level 0 backup; i will take level 1 incremental backup with same script daily too.
Do you have any other RMAN script ?
ANS: no, I will modify same script for incremental.
after local copy of backup all backup files (RMAN) will be copy over network to backup server or we can install LTO tape device to copy directly from database server.
kindly advise me I am new in RMAN.
regards;
SMITH
Maybe you are looking for
-
Headphones do not work for Mac Book Pro on Windows 7
Hi, Can any one give me an advice what can be a solution to this situation when I plug in my headphones in Windows 7 and there is no sound in the headphones. Though it all reports working fine in Sound on Control Panel. I tired ti reinstall sound car
-
Problem logging in to MOS with Opera
I'm on a Mac running Lion 10.7.3 using Opera 11.61 with Flash version 11.1.102.62 and am having problems using the actual My Support site. For instance, backspace doesn't work in text entry fields; if I type wrong I have to mark the text with the mou
-
I have an iPhone 4. My other half has one too. They were purchased and activated on the same day by her at the verison store. She does not have an iCloud account but I do. When I go to iCooud settings in my phone and then click on Backup and Storage
-
Is there a way to restore or save old events in iCal?
I just sorted out my at iCal and figured out the syncing process with Mobile Me and iPhone. I am quite happy. A bit disappointed that Mobile Me does not do subscription calendars like holidays. Birthdays are different between iCal and Mobile me, subs
-
What adapter/converter do I use for my USA mac book pro in NEW ZEALAND?
I'm studying abroad in New Zealand for 2 months and was wondering what type of adapter/converter do I use? I'm actually already here in New Zealand but buy a converter/adapter before I left. What should I look for on the box? I have a mac book pro 13