LINUX下ORACLE增量备份的步骤是什么

发布时间:2021-11-04 16:58:07 作者:柒染
来源:亿速云 阅读:172

这期内容当中小编将会给大家带来有关LINUX下ORACLE增量备份的步骤是什么,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

操作步骤:

 

1     查看操作系统版本

[oracle@localhost ~]$ cat /proc/version

Linux version 2.6.18-164.el5 (mockbuild@x86-003.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:51:48 EDT 2009

 

2     查看数据库版本

 

SQL>  select * from v$version;

BANNER

----------------------------------------------------------------

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 Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

 

3     查看数据库的名字

 

SQL> show parameter db_name;

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_name                              string      NACEC

 

4     查看归档状态

 

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     42

Next log sequence to archive   44

Current log sequence           44

 

5     设置归档日志的格式

 

SQL>alter system set log_archive_format='ARC%s%t%r.log' scope=spfile;

 

6     设置归档日志的存放路径

 

SQL>alter system set db_recovery_file_dest_size=2G

SQL>alter system set db_recovery_file_dest=’/dat/DBSoftware/oracle/flash_recovery_area’;

SQL>alter system set log_archive_dest_1=’location=/home/FRA’

SQL>alter system set log_archive_dest_10=’LOCATION=USE_DB_RECOVERY_FILE_DEST’;

SQL>shutdown immediate

SQL>startup

SQL>alter system switch logfile;

 

7     启动控制文件的自动备份

 

RMAN> configure controlfile autobackup on;

new RMAN configuration parameters:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

new RMAN configuration parameters are successfully stored

RMAN> show controlfile autobackup;

RMAN configuration parameters are:

CONFIGURE CONTROLFILE AUTOBACKUP ON;

 

8     查看是否用spfile参数文件

 

SQL> show parameter spfile

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string

VALUE的值为空,数据库是用pfile文件启动的,如果有值,则为spfile启动

创建spfile参数文件

SQL> create spfile from pfile;

File created.

会在$oracle_home/dbs/下生成spfileSID.ora

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area  268435456 bytes

Fixed Size                  1218868 bytes

Variable Size              88082124 bytes

Database Buffers          171966464 bytes

Redo Buffers                7168000 bytes

Database mounted.

Database opened.

SQL> show parameter spfile;

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      /dat/DBSoftware/oracle/product/10.2.0/db_1/dbs/spfilenacec.ora

 

9     使用rman的冗余策略,默认为7

 

RMAN> configure retention policy to recovery window of 15 days;

 

10    启动块更改跟踪文件

 

SQL>alter database enable block change tracking using file '/home/rob10gr2_block_change.fil';  

 

11    /home/NACEC/BackupDatabase/下创建backuplevel0.rcvbackuplevel1.rcv脚本

 

backuplevel0.rcv内容:

#   script.:bakuplevel0.rcv

#   creater:liu shiming

#   date:2010/6/28

#   desc:backup level0 database datafile in archive with rman

# connect database

#!/bin/bash

export ORACLE_BASE=/home/DBSoftware/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORACLE_SID=NACEC

export PATH=/home/DBSoftware/oracle/product/10.2.0/db_1/bin:$PATH

rman target/ << EOF_RMAN

run{

allocate channel c1 type disk;

backup incremental level 0 tag 'db0' format '/home/liusm/BackupDatabase/rmanbackup/db0_%d_%T_%s' database include current controlfile;

sql'alter system archive log current';

backup filesperset 3 format '/home/liusm/BackupDatabase/rmanbackup/arch0_%d_%T_%s' archivelog all delete input;

release channel c1;

}

# end

 

backuplevel1.rcv内容:

#   script.:bakuplevel1.rcv

#   creater:liu shiming

#   date:2010/6/27

#   desc:backup level1 database datafile in archive with rman

# connect database

#!/bin/bash

export ORACLE_BASE=/home/DBSoftware/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORACLE_SID=NACEC

export PATH=/home/DBSoftware/oracle/product/10.2.0/db_1/bin:$PATH

rman target/ << EOF_RMAN

run{

allocate channel c1 type disk;

backup incremental level 1 tag 'db1' format '/home/liusm/BackupDatabase/rmanbackup/db1_%d_%T_%s' database include current controlfile;

sql'alter system archive log current';

backup filesperset 3 format '/home/liusm/BackupDatabase/rmanbackup/arch2_%d_%T_%s' archivelog all delete input;

release channel c1;

}

# end

 

给这两个脚本授予执行的权限:

 

[oracle@NACEC BackupDatabase]$ chmod +x  *.rcv

(注意:要试运行脚本:./backuplevel1.rcv)

 

12   crontab指定执行时间

 

[oracle@NACEC BackupDatabase]$ crontab -e

crontab: installing new crontab

[oracle@NACEC BackupDatabase]$ crontab -l

0 1 * * 0  /home/NACEC/BackupDatabase/backuplevel0.rcv

0 1 * * 3  /home/NACEC/BackupDatabase/backuplevel0.rcv

0 1 * * 1-2  /home/NACEC/BackupDatabase/backuplevel1.rcv

0 1 * * 4-6  /home/NACEC/BackupDatabase/backuplevel1.rcv

周日和周三凌晨100执行0级备份,周一、二、四、五、六凌晨100执行1级备份

内容:

0 1 * * 0  /home/NACEC/BackupDatabase/backuplevel0.rcv

0 1 * * 3  /home/NACEC/BackupDatabase/backuplevel0.rcv

0 1 * * 1-2  /home/NACEC/BackupDatabase/backuplevel1.rcv

0 1 * * 4-6  /home/NACEC/BackupDatabase/backuplevel1.rcv

 

13   建立基于数据库的自动备份,使用JOB完成

begin

dbms_scheduler.create_job(

job_name=>'nacec_job0',

job_type=>'executable',

job_action=>'/dat/DBData/oradata/scripts/backuplevel0.sh',

repeat_interval=>'freq=weekly;byday=WED,SUN;byhour=01;byminute=00');

end;

/

exec dbms_scheduler.enable('nacec_job0');

 

begin

dbms_scheduler.create_job(

job_name=>'job1_nacec',

job_type=>'executable',

job_action=>'/dat/DBData/oradata/scripts/backuplevel1.sh',

repeat_interval=>'freq=weekly;byday=MON,TUE,THU,FRI,SAT;byhour=01;byminute=00');

end;

/

exec dbms_scheduler.enable('job1_nacec');

 

上述就是小编为大家分享的LINUX下ORACLE增量备份的步骤是什么了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. Linux 环境下安装Oracle 11.2.0.4.0 详细步骤
  2. Linux下启动Oracle服务和监听程序步骤

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux oracle

上一篇:提升web前端开发效率的工具有哪些

下一篇:Promise的基本用法是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》