Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # This script prepares an embedded Oracle database to be able to use RMAN. It
- # only ever needs to be run once for a particular database, however running it
- # multiple times is safe.
- # Matthew Booth <mbooth@redhat.com> 22/09/2006
- # Make sure we're root
- # Could just be Oracle, but root is simpler for administrators
- if [ `id -u` -ne 0 ]; then
- echo This script must be executed as root
- exit 1
- fi
- # Check the rhn database isn't already running
- if service rhn-database status; then
- echo You must stop the rhn-database service before running this script
- exit 1
- fi
- # Become the oracle user
- su - oracle -c "/bin/bash -s" <<-'ORACLE'
- export ORACLE_SID=rhnsat
- # Enable archive log on the database
- sqlplus "/ as sysdba" <<-'EOF'
- startup nomount;
- alter database mount exclusive;
- alter database archivelog;
- shutdown immediate;
- EOF
- # Configure the rman retention policy
- rman target / nocatalog <<-'EOF'
- startup;
- configure retention policy to redundancy 2;
- shutdown;
- EOF
- ORACLE
- # vim: ts=4 sw=4 smartindent noexpandtab
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement