快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

ORACLE_数据库全备份+归档异地恢复

全备份:

在玉门等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计、做网站 网站设计制作按需定制开发,公司网站建设,企业网站建设,成都品牌网站建设,营销型网站建设,外贸营销网站建设,玉门网站建设费用合理。

#!/bin/bash 

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

export ORACLE_SID=ORCL

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

backtime=`date +"%y%m%d%H%M%S"`

$ORACLE_HOME/bin/rman target /   log=/home/oracle/full_backup_$backtime.log <

run{

allocate channel c1 device type disk;

allocate channel c2 device type disk;

allocate channel c3 device type disk;

allocate channel c4 device type disk;

sql 'alter system archive log current'; 

backup as compressed backupset full database format '/u01/app/oracle/back/full_%d_%T_%U'; 

sql 'alter system archive log current';

backup archivelog all format '/u01/app/oracle/back/arch_%d_%T_%s_%p.bak' delete input ;

backup current controlfile format '/u01/app/oracle/back/ctl_%d_%T_%s_%p.bak';

release channel c1;

release channel c2;

release channel c3;

release channel c4;

}

EOF

备份归档日志

RMAN > run {

backup archivelog all format '/u01/app/oracle/back/arch_%d_%T_%s_%p.bak' delete input ;

backup current controlfile format '/u01/app/oracle/back/ctl_%d_%T_%s_%p.bak';

}

备份参数文件

SQL> create pfile from spfile;

恢复至其他环境

1.修改参数文件路径

vi $ORACLE_HOME/dbs/initORCL.ora

2.启动数据库至nomount

SQL> startup pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora';

3.恢复控制文件

$ cd /u01/app/oracle/backup

RMAN> restore controlfile from '/u01/app/oracle/backup/ctl_ORCL_20200311_19_1.bak';

RMAN> alter database mount;

3.恢复数据库

RMAN> run {

catalog start with '/u01/app/oracle/backup';

set newname for database to '/u01/app/oracle/oradata/DEMO/%U';

restore database;

switch datafile all;

switch tempfile all;

recover database;

}

Do you really want to catalog the above files (enter YES or NO)? yes

5. 修改日志文件

SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/redo01.log' to '/u01/app/oracle/oradata/DEMO/redo01.log';

SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/redo02.log' to '/u01/app/oracle/oradata/DEMO/redo02.log';

SQL> alter database rename file '/u01/app/oracle/oradata/ORCL/redo03.log' to '/u01/app/oracle/oradata/DEMO/redo03.log';

SQL>  ALTER DATABASE CLEAR LOGFILE GROUP 1;

SQL>  ALTER DATABASE CLEAR LOGFILE GROUP 2;

SQL>  ALTER DATABASE CLEAR LOGFILE GROUP 3;

6. 打开数据库

SQL> alter database open resetlogs;


新闻标题:ORACLE_数据库全备份+归档异地恢复
URL标题:http://6mz.cn/article/psdpoh.html

其他资讯