- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: help backup script
Operating System - HP-UX
1753808
Members
7518
Online
108805
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2007 01:06 PM
тАО02-05-2007 01:06 PM
help backup script
Dear experts.
I'm new to the shell script to unix.
can you give me advice.
that script is supposed to execute the oracle backup online.
you can see the backup procedure first 5 lines.
in script.
when i run the script, it has some error
like 'syntax error at line 115: `end of file' unexpected'
I really appreciate to help the script.
so many experts' help is need to do the script
=========
script below
$ cat a.active
######BACKUP STRATEGY##########################################################################
# 1. Copy each tablespace in turn by setting tablespace into hot backup mode , copy the
# tablespace files using unix copy command and then finally releasing the tablespace from
# backup mode.
# 2. Force a log switch .
# 3. copy all the archived log files.
# 4. Backup the control file.
###############################################################################################
#!/usr/bin/ksh
# Get DB info
$ORACLE_HOME/bin/sqlplus /nolog < DB_INFO
connect / as sysdba;
set linesize 200;
select db_unique_name, dbid from v\$database;
select name ||':' || block_size from v\$controlfile;
select file_name ||':'||tablespace_name||':'|| status from dba_data_files
order by tablespace_name;
exit
EOF
#Get DB INFO IN ACT
$ORACLE_HOME/bin/sqlplus /nolog < DB_INFO_ACT
connect / as sysdba;
set linesize 200
set echo off
set head off
select b.file_name||':'||a.status from v\$backup a, dba_data_files b
where a.file#=b.file_id and a.status !='active';
exit
EOF
DB_NAME=`/usr/bin/awk '$2 == "2859985154" { print $1}' DB_INFO`
CONTROLFILE=`/usr/bin/awk -F: '$2 == "16384" { print $1 }' DB_INFO`
DBF_FILE=`/usr/bin/awk -F: '$3 == "AVAILABLE" { print $1 }' DB_INFO`
DBF_FILE_ACT=`/usr/bin/awk -F: '$2 == "NOT ACTIVE" { print $1 }' DB_INFO_ACT`
TABLESPACE_NAME=`/usr/bin/awk -F: '$3 == "AVAILABLE" { print $2 }' DB_INFO`
#PERIPHERAL PARAMETERS################
DATE=`/usr/bin/date +%y%m%d`
BACKUP_HOME=/oracle/backuplog
BACKUP_LOG=${BACKUP_HOME}/`/usr/bin/basename $0 | /usr/bin/cut -d. -f1`.iaeisdb.${DATE}
echo $DB_NAME
echo $CONTROLFILE
echo $DATE
echo $DBF_FILE
echo $DBF_FILE_ACT
echo $TABLESPACE_NAME
########BACKUP DBF_FILE IN TABLESPACE EACH########
for tablespace_name in $TABLESPACE_NAME
do
echo Beginning back up of tablespace ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s < / as sysdba
set heading off feedback off
alter tablespace ${TABLESPACE_NAME} begin backup;
exit
EOF
########BACKUP .DBF IN ACTIVE###############################################
for dbf_file_act in $DBF_FILE_ACT
do
save -s 10.10.10.21 -b oracle -l full $DBF_FILE_ACT
done
echo Finishing back up of tablespace ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s < / as sysdba
set heading off feedback off
alter tablespace ${TABLESPACE_NAME} end backup;
exit 1
EOF
# $TABLESPACE_NAME = $TABLESPACE_NAME_NEXT
# $FILE_NAME = $FILE_NAME_NEXT
done
#if [$TABLESPACE_NAME == $TABLESPACE_NAME_NEXT]
# save -s 10.10.10.21 -b oracle -l full $DBF_FILE_NEXT
#else
#echo Finishing back up of tablespace ${TABLESPACE_NAME} >> ${BACKUP_LOG}
#${ORACLE_HOME}/bin/sqlplus -s < #/ as sysdba
#set heading off feedback off
#alter tablespace ${TABLESPACE_NAME} end backup;
# exit 1
# EOF
#fi
#done
########2.Force a log switch & 3.Copy all the archived log files.##########################
echo Beginning back up of archive log file ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s < / as sysdba
set heading off feedback off
alter system switch log file
exit
EOF
save -s 10.10.10.21 -b oracle -l full /oradata1/Archive
########4. Backup the control file.###############
echo Beginning back up of control file ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s < / as sysdba
set heading off feedback off
alter backup controlfile to ${ORACLE_HOME}/dbs/control.${DATE}
exit
EOF
I'm new to the shell script to unix.
can you give me advice.
that script is supposed to execute the oracle backup online.
you can see the backup procedure first 5 lines.
in script.
when i run the script, it has some error
like 'syntax error at line 115: `end of file' unexpected'
I really appreciate to help the script.
so many experts' help is need to do the script
=========
script below
$ cat a.active
######BACKUP STRATEGY##########################################################################
# 1. Copy each tablespace in turn by setting tablespace into hot backup mode , copy the
# tablespace files using unix copy command and then finally releasing the tablespace from
# backup mode.
# 2. Force a log switch .
# 3. copy all the archived log files.
# 4. Backup the control file.
###############################################################################################
#!/usr/bin/ksh
# Get DB info
$ORACLE_HOME/bin/sqlplus /nolog <
connect / as sysdba;
set linesize 200;
select db_unique_name, dbid from v\$database;
select name ||':' || block_size from v\$controlfile;
select file_name ||':'||tablespace_name||':'|| status from dba_data_files
order by tablespace_name;
exit
EOF
#Get DB INFO IN ACT
$ORACLE_HOME/bin/sqlplus /nolog <
connect / as sysdba;
set linesize 200
set echo off
set head off
select b.file_name||':'||a.status from v\$backup a, dba_data_files b
where a.file#=b.file_id and a.status !='active';
exit
EOF
DB_NAME=`/usr/bin/awk '$2 == "2859985154" { print $1}' DB_INFO`
CONTROLFILE=`/usr/bin/awk -F: '$2 == "16384" { print $1 }' DB_INFO`
DBF_FILE=`/usr/bin/awk -F: '$3 == "AVAILABLE" { print $1 }' DB_INFO`
DBF_FILE_ACT=`/usr/bin/awk -F: '$2 == "NOT ACTIVE" { print $1 }' DB_INFO_ACT`
TABLESPACE_NAME=`/usr/bin/awk -F: '$3 == "AVAILABLE" { print $2 }' DB_INFO`
#PERIPHERAL PARAMETERS################
DATE=`/usr/bin/date +%y%m%d`
BACKUP_HOME=/oracle/backuplog
BACKUP_LOG=${BACKUP_HOME}/`/usr/bin/basename $0 | /usr/bin/cut -d. -f1`.iaeisdb.${DATE}
echo $DB_NAME
echo $CONTROLFILE
echo $DATE
echo $DBF_FILE
echo $DBF_FILE_ACT
echo $TABLESPACE_NAME
########BACKUP DBF_FILE IN TABLESPACE EACH########
for tablespace_name in $TABLESPACE_NAME
do
echo Beginning back up of tablespace ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s <
set heading off feedback off
alter tablespace ${TABLESPACE_NAME} begin backup;
exit
EOF
########BACKUP .DBF IN ACTIVE###############################################
for dbf_file_act in $DBF_FILE_ACT
do
save -s 10.10.10.21 -b oracle -l full $DBF_FILE_ACT
done
echo Finishing back up of tablespace ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s <
set heading off feedback off
alter tablespace ${TABLESPACE_NAME} end backup;
exit 1
EOF
# $TABLESPACE_NAME = $TABLESPACE_NAME_NEXT
# $FILE_NAME = $FILE_NAME_NEXT
done
#if [$TABLESPACE_NAME == $TABLESPACE_NAME_NEXT]
# save -s 10.10.10.21 -b oracle -l full $DBF_FILE_NEXT
#else
#echo Finishing back up of tablespace ${TABLESPACE_NAME} >> ${BACKUP_LOG}
#${ORACLE_HOME}/bin/sqlplus -s <
#set heading off feedback off
#alter tablespace ${TABLESPACE_NAME} end backup;
# exit 1
# EOF
#fi
#done
########2.Force a log switch & 3.Copy all the archived log files.##########################
echo Beginning back up of archive log file ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s <
set heading off feedback off
alter system switch log file
exit
EOF
save -s 10.10.10.21 -b oracle -l full /oradata1/Archive
########4. Backup the control file.###############
echo Beginning back up of control file ${TABLESPACE_NAME} >> ${BACKUP_LOG}
${ORACLE_HOME}/bin/sqlplus -s <
set heading off feedback off
alter backup controlfile to ${ORACLE_HOME}/dbs/control.${DATE}
exit
EOF
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2007 07:36 PM
тАО02-05-2007 07:36 PM
Re: help backup script
hi,
if you are using Oracle 8i or later, please start using Oracle RMAN for backup.
With RMAN, you will just have to run:
RMAN> backup database fileperset 1 plus archivelog delete input.
For more information see also Oracle10g Documentation References:
Oracle Database Backup and Recovery Advanced User's Guide Guide - more information about the recovery catalog>
http://www.oracle.com/pls/db102/to_toc?pathname=backup.102%2Fb14191%2Ftoc.htm&remark=portal+%28Books%29
Oracle├В┬о Database Backup and Recovery Reference - CREATE CATALOG command syntax
http://www.oracle.com/pls/db102/to_toc?pathname=backup.102%2Fb14194%2Ftoc.htm&remark=portal+%28Books%29
Oracle Database Backup and Recovery Basics - more information about configuration settings.
http://www.oracle.com/pls/db102/to_toc?pathname=backup.102%2Fb14192%2Ftoc.htm&remark=portal+%28Books%29
More tips on best practices are available in metalink note: 388422.1
hope this helps!
kind regards
yogeeraj
if you are using Oracle 8i or later, please start using Oracle RMAN for backup.
With RMAN, you will just have to run:
RMAN> backup database fileperset 1 plus archivelog delete input.
For more information see also Oracle10g Documentation References:
Oracle Database Backup and Recovery Advanced User's Guide Guide - more information about the recovery catalog>
http://www.oracle.com/pls/db102/to_toc?pathname=backup.102%2Fb14191%2Ftoc.htm&remark=portal+%28Books%29
Oracle├В┬о Database Backup and Recovery Reference - CREATE CATALOG command syntax
http://www.oracle.com/pls/db102/to_toc?pathname=backup.102%2Fb14194%2Ftoc.htm&remark=portal+%28Books%29
Oracle Database Backup and Recovery Basics - more information about configuration settings.
http://www.oracle.com/pls/db102/to_toc?pathname=backup.102%2Fb14192%2Ftoc.htm&remark=portal+%28Books%29
More tips on best practices are available in metalink note: 388422.1
hope this helps!
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2007 08:02 PM
тАО02-05-2007 08:02 PM
Re: help backup script
Hi,
can you please:
1. move the #!/usr/bin/ksh to be the first line in the file
2. List all the output you get when you run the script. Do you see:
the $DB_NAME data
the $CONTROLFILE data
the $DATE data
the $DBF_FILE data
the $DBF_FILE_ACT data
the $TABLESPACE_NAME data
Also please provide:
cat ${BACKUP_LOG}
sed -n 115p a.active
can you please:
1. move the #!/usr/bin/ksh to be the first line in the file
2. List all the output you get when you run the script. Do you see:
the $DB_NAME data
the $CONTROLFILE data
the $DATE data
the $DBF_FILE data
the $DBF_FILE_ACT data
the $TABLESPACE_NAME data
Also please provide:
cat ${BACKUP_LOG}
sed -n 115p a.active
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP