Try this simple cold backup script

Backup and recovery tip #1 from "30 tips in 30 minutes," brought to you by the IOUG.


The following is backup and recovery tip #1 from "30 tips in 30 minutes," brought to you by the IOUG. Return to...

the main page for more tips on this topic.


Need to perform a cold backup fast? This script lets you create a backup from SQL*Plus connected as SYSDBA.

Rem Set SQL*Plus variables to manipulate output
set feedback off heading off verify off
set pagesize 0 linesize 200
Rem Set SQL*Plus user variables used in script
Rem Linux User variables
define dir = '/backup'
define fil = '/tmp/closed_backup_commands.sql'
prompt *** Spooling to &fil
spool &fil
select 'host cp '|| name ||' &dir' from v$datafile order by 1;
select 'host cp '|| member ||' &dir' from v$logfile order by 1;
select 'host cp '|| name ||' &dir' from v$controlfile order by 1;
select 'host cp '|| name ||' &dir' from v$tempfile order by 1;
spool off;
Rem Shutdown the database cleanly
shutdown immediate;
Rem Run the copy file commands
@&fil
Rem Start the database again
startup;

On Linux, connect to SQL*Plus as SYSDBA and run this script like this:

LINUX> sqlplus /nolog
SQL> connect system/manager as sysdba
SQL> @closed_backup.sql

For more information see Chapter 4 of "Oracle backup and recovery 101."


Get more tips in minutes! Return to the main page.

About the author: Kenny Smith has been working with Oracle technology on HP servers for over a decade. He specializes in Oracle database architecture, database administration and development. He has presented at numerous Oracle conferences on two continents. He has published many articles describing Oracle solutions and has co-authored "Oracle backup and recovery 101" from Oracle Press.

IOUG: Become a member of the IOUG to access the paper referenced here and a repository of technical content created for Oracle users by Oracle users.

Dig Deeper on Oracle database backup and recovery

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close