Cold backup automated script
Hi--
Can any one provide me one cold backup script,,with that i need to delete 2 days old backup and need to put current backup in that mountpoint.
Thanks in advance.
user8683962 wrote:
We are not using RMAN So what is preventing you from starting? The real value of rman will be when you have to recover, it will already know where all the necessary peices are and what needs to be done. Plus, it will take care of the housekeeping of deleting your old, obsolete backups.
and Hot backups.....So you don't care if you lose any changes that occur between your cold backups?
i want to take a cold backup of my database every day and delete need to delete 2 days old backup, so that i can maintain 2 backups(today's and yesterday's) in my hand... Again, rman will do this for you, and more, and much more simply
for this can any one provide me a script to make it automate by adding to crontab.If someone else hasn't by the time I get back to my hotel room this evening, I'll post an rman solution. It is a waste of time to work on a non-rman solution.
Similar Messages
-
Dear all,
I need a script to take cold backup of oracle database 10.2.0.3.0 .. such that if todays date is 28-oct-08.. then a folder with the name 28oct08 to be created in the backup location.then using the script user should login to the database shutdown the db and listener and make sure this is completely down and copy the complete oracle files and home location to the above mentioned folder in the server.. any links or points will help a lot ?
KaiKai, rather than write a script to perform a cold backup for whatever platform you are on I suggest you write a script to generate the cold backup script. The script can connect to the database, read various v$ and dba views such as dba_data_files to get the necessary data file information, and place the file names into OS copy commands. The resulting script should probably include steps to connect to and stop the database and to restart the database instance when it is complete.
Be sure to include a copy of your control file and the spfile in your backup. You do not need to include the online redo logs in your manual cold backup.
An alternate might be to run an rman backup while the database is in restricted session depending on how freely your site has given out the DBA role and/or restricted session privilege.
HTH -- Mark D Powell -- -
Could anyone please send me Shell script for taking Cold backups on solaris
The script will be run and will start taking backup
if possible Automatically it will Down and UP the Database
Thanks
MarkI'm sure that a short google search should find some example for you.
Here some scripts :
http://orafaq.com/scripts/
http://www.dbasupport.com/oracle/scripts/Backup_Recovery/
But, that would be better to google for more results :
http://www.google.fr/search?q=oracle+script+backup&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:fr:official
Nicolas. -
My cold backup shell script not working
I have written a shell script for cold backup but. It says that line 42 has unexpected syntex error '{' and line 57 unexpected end of file. Please help
BKUP_DIR=/u03/backups/abu/nightly_backup
LOG_FILE=/u03/backups/abu/backup.log
ORACLE_HOME= /u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
# Execute the backup procedure
echo ymd=`date +%Y%m%d` >> $LOG_FILE
echo "Database BACKUP starting." >> $LOG_FILE
ORACLE_HOME=/u01/app/oracle/product/10.2; export ORACLE_HOME
ORACLE_SID=SEED; export ORACLE_SID
PATH="$PATH:$ORACLE_HOME/bin";export PATH
rman target=/ << EOF
shutdown immediate
EOF
if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE
cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
echo "Cold backup of archive logs being performed." >> $LOG_FILE
mv /u01/app/oracle/product/10.2/dbs/arch/* ${BKUP_DIR}/$ymd-${cmsv}.gz
gzip ${BKUP_DIR}/$ymd-${cmsv}
echo "Restarting Database" >> $LOG_FILE
rman target=/ << EOF
startup
EOF
else
echo "Database will NOT start up." >> $LOG_FILE
fi
echo 'ymd='date +%Y%m%d' >> $LOG_FILE
echo "Database BACKUP has completed." >> $LOG_FILE
exitI trying to write that script for our new production database. My script will create a folder automatically and will copy all database files into the folder. Now my script dont copy the files into the direcory that automatically create. I want my directory name with timestamp that i already speciy in my code. The scripts now generate an error that now such files or directory. I mean when it tries to copy files from source to destination folder. Please give me some suggestions.
if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE
cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gzecho "Cold backup of archive logs being performed." >> $LOG_FILE -
제품 : ORACLE SERVER
작성날짜 : 2003-08-04
Automating cold backup on NT
============================
unix에서는 cron 이라는 것을 이용해서 주기적으로 데이타베이스를 원하는 시점에
shutdown 시킨 후 cold backup 을 할수 있다.
그렇다면 nt에서는 어떻게 이런 작업을 수행해 줄 수 있을까.
여기서는 이렇게 주기적으로 database 를 cold backup받는 방법에 관해서 설명
하고자 한다.
데이타베이스 환경은 다음과 같이 가정한다.
ORACLE_HOME = c:\ORANT
ORACLE_SID = ORCL
데이타화일들은 c:\ORANT\DATABASE 디렉토리에 존재한다.
cold backup을 schedule하기 위해서는 windows NT의 AT scheduler utility 가
필요하며
이것의 GUI version은 windows NT의 Resource Kit에 포함되어 있다.
우선은 NT scheduler service가 동작하고 있는지 확인해야 한다.
확인 방법은 NT 제어판을 열고 Service icon을 더블 클릭하여 schedule service가
동작하고 있으며 automatic인지 확인한다.
그러면 schedule 방법을 다음과 같이 정리하였다.
1. 만약 command line scheduler를 사용하고 있다면 다음과 같은 작업을 해준다.
backup.bat라는 batch file 을 만들어서 다음과 같은 내용을 입력한다.
call c:\orant\bin\svrmgr23.exe command="@c:\shutdown.sql"
copy c:\orant\database\*orcl.ora c:\backup
call c:\orant\bin\svrmgr23.exe command="@c:\startup.sql"
backup을 schedule 한다.
NT의 command prompt(Dos prompt)에서 다음과 같은 형식으로 입력한다.
AT time "C:\backup.bat"
eg. C:\> at 14:45 "c:\backup.bat"
2. SHUTDOWN.SQL SCRIPT를 다음과 같이 만들어 준다.
connect internal/password
shutdown immediate
exit
3. STARTUP.SQL SCRIPT를 다음과 같이 만들어 준다.
connect internal/password
startup pfile=C:\ORANT\DATABASE\INITORCL.ORA
exit
이상과 같이 해주면 원하는 시간에 db를 cold backup 받을 수 있을 것이다.
Reference Documents
<Note:74981.1>You must cleanly shutdown database before proceeding with a cold consistent backup, otherwise you compromise database integrity, so recoverability.
By clean shutdown I mean Normal, Transactional or Immediate, never abort. The point is that the last transaction must properly be recorded by the last checkpoint, and no recovery process is required. Additionally, a clean shutdown guarantees consistency acrorss all datafiles.
~ Madrid. -
A script for oracle10g cold backup on linux
Hi,
I have a urgent need to do a cold backup using o/s command. Can anyone please send me a script for this.
Thanks in advance
PKI ended up writing the script
define 3 = &backup_directory
define 4 = &instance_name
define 5 = &user_dump_directory
Set Heading Off
Set Verify Off
Set FeedBack Off
Set LineSize 132
Set PageSize 1000
set termout off
Spool cold_back.sql
select 'connect /as sysdba' from dual;
Select 'Startup Force' || CHR(10) ||
'Shutdown Normal' From Dual;
select '! mkdir '||'&&3'||'/'||to_char(sysdate,'yyyyddmm') from dual
/* Data Files */
Select '!cp ' || File_Name || ' &&3'||'/'||to_char(sysdate,'yyyyddmm') || CHR(10) ||'!gzip ' || '&&3' ||'/'||to_char(sysdate,'yyyyddmm')|| '/' || SubStr(File_Name, InStr(File_Name, '/', -1)+1) From Sys.DBA_Data_Files
/* Redo Log Files */
Select '!cp ' || Member || ' &&3'||'/'||to_char(sysdate,'yyyyddmm') || CHR(10) || '!gzip ' || '&&3'||'/'||to_char(sysdate,'yyyyddmm') || '/' || SubStr(Member, InStr(Member, '/', -1)+1) From V$LogFile
/* Control Files */
Select '!cp ' || name || ' &&3'||'/'||to_char(sysdate,'yyyyddmm') From V$controlfile
/* Init and Config Files */
Select '!cp $ORACLE_HOME/dbs/init&&4' || '.ora &&3'||'/'||to_char(sysdate,'yyyyddmm') From Dual
alter session set tracefile_identifier=coldbackup
alter database backup controlfile to trace
select '!mv '||'&&5/*COLDBACKUP*' ||' &&3'||'/'||to_char(sysdate,'yyyyddmm') FROM dual
Select 'Startup' From Dual;
Select 'Exit' from dual;
set termout on
PROMPT " Run the output cold_back.sql script [sqlplus -s '/as sysdba' @cold_back.sql ]"
Spool Off
----------------------- -
Oracle version : 11G release 2
Platform : AIX
After going through various OTN posts, i wrote the below Cold backup script (Untested). If there are any unnecessary stuff or enhancements required, please let me know
$ rman target /
RMAN>
run
allocate channel c1 type disk format '/u05/rmanbkp/%d_COLD_DB_%u';
sql 'alter system archive log current';
shutdown immediate;
startup mount;
backup database including current controlfile tag='mydbname_full_bkp';
backup spfile tag = 'mydbname_SPFILE';
release channel c1;
}Hi T.Boyd
What do you guys think of the backup script? Any room for improvement? I found in a small percentage of the shutdown immediate commands issued, the instance hangs (specially when the machine is very busy).
I have modified my rman coldbackup the procedure to:
shutdown abort;
host 'sleep 3';
startup restrict;
shutdown immediate;
startup mount;Maybe you can add more channels to improve performance. You can use more resources as there are no users on the database anyway....
Regards,
Tycho -
Script for cold backup using RMAN
Dear all,
db_version:-10.2.0.4
os_version:- Windows 2003 server
I wish to schedule a script that will take cold backup of my database using RMAN.
Any help is appreciated ..
Edited by: user12000301 on May 18, 2011 5:02 AMDear All,
Thanks a lot for your valuable time :
However i have managed to do it as follows :
1. First i have configure the parameter of RMAN ( Since it is my UAT in Noarchive log mode), I have never tried RMAN cold backup on the same.
Following is the out put of SHOW ALL;
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'D:\DB\RMAN_BKP\BACKUPS%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'D:\DB\RMAN_BKP\BACKUPS\DB_%U.%r';
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ENCRYPTION FOR DATABASE OFF;
CONFIGURE ENCRYPTION ALGORITHM 'AES128';
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\DB\RMAN_BKP\BACKUPS\SNCFDB.ORA';
2. I have created a rman_cold_bkp.bat file which has following entry :
cd c:\oracle10g\bin
set oracle_sid=DB
rman target system/*** @D:\DB\RMAN_BKP\SCRIPT\rman_cold_bkp.rcv log=D:\DB\RMAN_BKP\SCRIPT\rman_cold_bkp.log
exit
3. Whereas rman_cold_bkp.rcv file contains following contents:
run
allocate channel C1 device type disk;
shutdown immediate;
startup mount;
backup database;
alter database open;
release channel C1;
exit
I did checked it and it;s working fine for me :-)
Regards,
Girish -
Script for cold backup on windows
looking for a script that can be scheduled nightly to perform
a cold backup to disk of a 8.1.7 database on windows.
while i've seen many, i'm looking for one that will keep 3 days worth
of backups... then write over the oldest etc...
thanks
dgset term off
set head off
set feedback off
set verify off
spool c:\coldbackup.bat
select 'copy '||name||' c:\DBBACKUP' from v$datafile;
select 'copy '||name||' c:\DBBACKUP' from v$controlfile;
select 'copy '||name||' c:\DBBACKUP' from v$tempfile;
select 'copy '||member||' c:\DBBACKUP' from v$logfile;
spool off
shutdown IMMEDIATE
host c:\coldbackup.bat
startup
host del c:\coldbackup.bat
set term on
set head on
set feedback on
set verify on -
Hi,
i want to make a cold backup and schedule it in CRON, but don't know why but it doesn't work. This is what i've in de "full.rman" file:
connect target /
shutdown immediate;
startup mount;
backup database as compressed backupset;
crosscheck backup;
delete expired backup;
alter database open;
exit
i tried to run this script by rman @full.rman
but when i do this i'm getting the following error:
RMAN> backup database as
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "as": expecting one of: "archivelog, backup, backupset, channel, copy, controlfilecopy, current, database, datafile, datafilecopy, delete, diskratio, db_recovery_file_dest, filesperset, format, from, force, include, keep, (, maxsetsize, noexclude, nokeep, not, pool, plus, reuse, recovery, ;, skip, spfile, setsize, tablespace, tag, to"
RMAN-01007: at line 1 column 17 file: full.rman
In the past i had another error where it looked like it wasn't shutting down the database and starting it up in mount mode. So how can i make a script what wil do what i want :)
Thanks in advance.
regards,
OsmanTry:
backup as compressed backupset database; -
10g windows cold backup script ...
we have 10g db on windows server.
I wnat to perform cold backup of db everyday night.
at present I am in process on writting .bat to shoudown 10g db
I nee .bat file to shutdown 10g databaseuser580175 wrote:
Script .bat shutdown database:
C:\oracle\product\10.2.0\bin\oradim -shutdown -sid ORCL -shuttype INST -shutmode immediate
Script .bat startup database:
C:\oracle\product\10.2.0\bin\oradim -startup -sid ORCL -usrpwd oracle -starttype INST -pfile C:\oracle\admin\10.2.0\pfile\initORCL.oraYou might want to get rid of pfile section if using spfile. -
Scripted Cold Backups / Archived Logs / Flashback
Facts:
uname -a:
SunOS {hostname omitted} 5.8 Generic_117350-39 sun4u sparc SUNW,Sun-Fire-V240
select * from v$version:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Solaris: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Archivelog enabled
Flashback enabled
db_flashback_retention_target = 7200 (5 days)
archive_lag_target = 1800 (30 minutes)
No, we are not using rman (yet). This system does not have a 24/7 SLA, so we run a cold backup every Saturday: a shell script shuts down the database and copies all the necessary files to a safe location on another host.
We do have one problem: an accumulation of archived logs. I know that we don't need to keep the logs older than the latest cold backup, but I am unsure of the correct way to clean them up, especially given that we have flashback enabled. Any suggestions?
Thanks!I think maybe I just found the answer to my own question.
Upon examining the flashback_recovery_area more closely, I see an archivelog directory and a flashback directory, which contains a number of flb files going back to 12/14 (today is 12/20). This makes a certain amount of sense since we have the flashback retention target set to 5 days.
Would I be correct in stating that the flashback files are self-managing and completely independent of the archived logs?
Would I also be correct in stating that I can happily delete the archive logs older than my last cold backup?
The thing which gives me pause is that I swear I remember reading somewhere that flashback uses the archived logs. Did I misunderstand something? -
DB version :10.2.0.4
Do you find anything wrong in the below mentioned RMAN cold backup script? Any enhancements, corrections required?
shutdown immediate;
startup mount;
backup database including current controlfile tag='full_bkp';
startup;
crosscheck backup;
delete noprompt obsolete device type disk;
resync catalog;
}Since you are doing a SHUTDOWN IMMEDIATE and STARTUP MOUNT before the BACKUP, there will be no ArchiveLogs generated while the backup is running --- as the database is not OPEN.
However, the PLUS ARCHIVELOG can include ArchiveLogs that had been generated from the previous STARTUP or ALTER DATABASE OPEN.
(In that case, I would suggest an SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT' before the SHUTDOWN IMMEDIATE).
Is your database running in ARCHIVELOG mode ? If not, then this discussion is moot.
If yes, the next question is, obviously : Why not take a Hot Backup while the database is running (in which case you MUST backup archivelogs !)
Hemant K Chitale -
Stop and start database for cold backup
Hi,
Database :Oracle 10g R1
OS : Red hat 3
I have a RAC database with 2 nodes.
I build this script to make a cold backup of the database. (I will put it in the cron tab).
My question is the SRVCTL will work in this scripts??
# ***** COLDBACKUP ORACLE DATABASE ON LINUX *****
DIRECTORY=/u02/backup/script/; export DIRECTORY
cd ${DIRECTORY}
# ***** SHUTDOWN THE DATABASE *******
export oracle_sid=RCDB
srvctl stop database -d RCDB
# *****cold backup for "RCDB" database on 13-FEB-07 ... *****
# ***** COPY FILES *****
# Redo logs
cp /u02/oradata/RCDB/redo01.log ${DIRECTORY}
cp /u02/oradata/RCDB/redo07.log ${DIRECTORY}
cp /u02/oradata/RCDB/redo03.log ${DIRECTORY}
cp /u02/oradata/RCDB/redo08.log ${DIRECTORY}
# Datafiles
#*********START UP DATABASE AND SERVICES********
srvctl start database -d RCDB
exit
Message was edited by:
ASkika
Message was edited by:
ASkikaI need to put a quick policy backup ... and cold
backup it's what I use and it works.And reduces the availability of your cluster.
The problem about RMAN is that we never use it. I
have to learn about it to make scripts to test....
and this will tack me 2 or 3 days...I'd assume that installing RAC didn't go overnight, so why underfund the crucial part of any database system, the backup?
There's even a step by step guide for backup on the Getting Started: DBAs page.
Samples (and changes) on the latest version of RMAN can be found for example in RMAN Enhancements.
Or take a look at this Oracle Magazine article:Faster Backup, Faster Recovery
Backup and Recovery Basics in the user documentation may also be a good starting point.
C. -
Hi,
I am doing the following steps for taking Cold Backup
of my Oracle 9i Database (On Solaris).
The Database is not enabled for Archive Mode.
a)sqlplus /nolog
b)conn / as sysdba
c)start up
d)alter database backup control file to '/backup/control.ctl'
e)alter database backup control file to trace
f)shutdown immediate
g)exit
h)Manually copy all the .dbf and init.ora files to a seperate directory.
Are all the above steps correct.
If yes,can anyone give me a script which i can run manually so as to take the cold Backup.
Regards
DeepakHere is a scrip which I wrote to take a cold backup.
REM
REM Script for backing up the I2ORADEV database running in NOARCHIVELOG mode.
REM Created by Deepak Jaisingh on 24.11.2003.
REM
PROMPT
PROMPT Backup started for I2ORADEV.
PROMPT
REM
REM Stop the listener to restrict access.
REM
HOST LSNRCTL STOP;
PROMPT Listerner stopped.
PROMPT
PROMPT
PROMPT Shutting down I2ORADEV for backup.
shutdown immediate;
PROMPT
PROMPT Backing up database, redolog and control files.
HOST COPY G:\oracle\oradata\apildata\* D:\BACKUP\ORADATA\I2ORADEV\;
HOST COPY G:\ORACLE\ORADATA\I2ORADEV\* D:\BACKUP\ORADATA\I2ORADEV\;
PROMPT
PROMPT Backup for database, redolog and control files complete.
PROMPT
PROMPT Starting I2ORADEV.
startup;
REM
REM START the listener.
REM
HOST LSNRCTL START;
PROMPT Listerner started.
PROMPT
PROMPT Backup for I2ORADEV complete.
PROMPT
Maybe you are looking for
-
Creative Cloud Mac panel blank white
Hi I just migrated to my new Mac, so signed out of CC on the old one, used migration assistant and booted the new mac. Upon load I got a message to tell me that CC was corrupted and I had to reinstall. So I tried, downloaded the install .dmg and star
-
Unable to update payment cards data through ORDERS05 in va02
Hi all, I noticed one thing that in IDOC_INPUT_ORDERS (ie creation of sales order) we have a bdcdata populated for payment cards (for header in VA01) .But when we are changing sales order by IDOC_INPUT_ORDCHG (change sales order VA02) we have no bdc
-
I have the Ipad 2. The people I contact via facetime cannot hear me altough I can hear them. I have already powered down - have tried to speak close to speaker without any luck.
-
Archive only masked records error
Hi SDNers, I want to Archive repository only with 100 records. I have tried Masking those records and on Archiving used the option to select only that Mask. But it is resulting in Archive fail and the report says: 4952 2009/10/13 15:53:20.744 Report
-
It will not turn on need to book appointment with Apple in Cardiff I dunno what wrong with it its less than a year old aswell