全備份:
在玉門(mén)等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專(zhuān)注、極致的服務(wù)理念,為客戶(hù)提供網(wǎng)站設(shè)計(jì)、做網(wǎng)站 網(wǎng)站設(shè)計(jì)制作按需定制開(kāi)發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),營(yíng)銷(xiāo)型網(wǎng)站建設(shè),外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè),玉門(mén)網(wǎng)站建設(shè)費(fèi)用合理。
#!/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'; } 備份參數(shù)文件 SQL> create pfile from spfile; 恢復(fù)至其他環(huán)境 1.修改參數(shù)文件路徑 vi $ORACLE_HOME/dbs/initORCL.ora 2.啟動(dòng)數(shù)據(jù)庫(kù)至nomount SQL> startup pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initORCL.ora'; 3.恢復(fù)控制文件 $ cd /u01/app/oracle/backup RMAN> restore controlfile from '/u01/app/oracle/backup/ctl_ORCL_20200311_19_1.bak'; RMAN> alter database mount; 3.恢復(fù)數(shù)據(jù)庫(kù) 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. 打開(kāi)數(shù)據(jù)庫(kù) SQL> alter database open resetlogs;
當(dāng)前名稱(chēng):ORACLE_數(shù)據(jù)庫(kù)全備份+歸檔異地恢復(fù)
文章來(lái)源:http://weahome.cn/article/psdpoh.html