Oracle cold backup and Hot Backup scripts

Source: Internet
Author: User
Oracle cold backup script: setfeedbackoffsetheadingoffsetverifyoffsettrimspooloffsetechooffsettimeoffsettimin

Oracle cold backup script: set feedback off set heading off set verify off set trimspool off set echo off set time off set timin

Oracle cold backup script:

Set feedback off
Set heading off
Set verify off
Set trimspool off
Set echo off
Set time off
Set timing off
Set pagesize 0
Set linesize 200
Define dir = '/backup/cold/Mi ';
Define diroutmike = '/u01/scripts/coldscr/mikecoldout. SQL ';
Spool & diroutmike
Select '! Cp '| name |' & dir' from v $ datafile order by file #;
Select '! Cp '| name |' & dir' from v $ controlfile;
Spool off;
Shutdown immediate;
@ & Diroutmike

Startup;

The preceding scripts are stored in/u01/scripts/coldscr/mikecold. SQL.

You can run this script for cold backup during database operation.

Oracle hot backup script:

Set feedback off
Set pagesize 0
Set heading off
Set verify off
Set linesize 100
Set trimspool on
Set echo off
Set time off
Set timing off
Undefine mikedir
Undefine mikescp
Define mikedir = '/backup/hot'
Define mikescp = '/u01/scripts/hotscr/mikehotout. SQL'
Declare
Cursor cur_tablespace is select tablespace_name from dba_tablespaces where status <> 'read ONLY 'a
Nd contents not like '% TEMP % ';
Cursor cur_datafile (tn varchar2) is select file_name from dba_data_files where tablespace_name = tn;
Begin
For ct in cur_tablespace loop
Dbms_output.put_line ('alter tablespace '| ct. tablespace_name | 'in in backup ;');
For cd in cur_datafile (ct. tablespace_name) loop
Dbms_output.put_line ('! Cp '| cd. file_name |' & mikedir ');
End loop;
Dbms_output.put_line ('alter tablespace '| ct. tablespace_name | 'end backup ;');
End loop;
End;
/


The preceding scripts are stored in/u01/scripts/hotscr/mikehot. SQL.

You can run this script for hot backup when the database is running.

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.