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.rcv和backuplevel1.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/arch1_%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
週日和週三凌晨1:00執行0級備份,週一、二、四、五、六凌晨1:00執行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');
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31520497/viewspace-2156853/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle冷備份的通常步驟Oracle
- Oracle的差異增量備份和累積增量備份Oracle
- Linux下Oracle9i RMAN備份及恢復步驟(轉)LinuxOracle
- Oracle之差異增量備份與累積增量備份Oracle
- Oracle的差異增量備份和累積增量備份(zt)Oracle
- Oracle RMAN 增量備份Oracle
- linux 下的差異和增量備份(轉)Linux
- linux下rsync和tar增量備份梳理Linux
- Oracle 11g RMAN備份-增量備份Oracle
- 轉:DB2離線和線上全備、增量備份及恢復的操作步驟DB2
- oracle資料庫備份之exp增量備份Oracle資料庫
- ORACLE在linux下的安裝步驟OracleLinux
- oracle聯機熱備份的原理,及rman增量備份原理Oracle
- Oracle聯機熱備份的原理及rman增量備份原理Oracle
- Linux 平臺下 RMAN 全備 和 增量備份 shell 指令碼Linux指令碼
- ORACLE DB建立步驟-運用冷備份和RMANOracle
- Oracle9i RMAN備份及恢復步驟Oracle
- oracle 增量備份恢復驗證Oracle
- oracle聯機熱備份的原理及rman增量備份原理(zt)Oracle
- SVN服務備份操作步驟
- Oracle備份及備份策略及基於Linux下 Oracle 備份策略(RMAN)OracleLinux
- Mysql增量備份MySql
- 增量備份 PostgreSQLSQL
- 完全備份、差異備份、增量備份的區別
- Oracle9i RMAN備份及恢復步驟(zt)Oracle
- XtraBackup完整備份與增量備份的原理
- oracle10g RMAN增量備份策略Oracle
- Linux下安裝Oracle的一般步驟LinuxOracle
- Nocatalog 下的RMAN 增量備份 shell指令碼指令碼
- TSM備份軟體實施步驟
- rman備份和增量備份指令碼指令碼
- linux下mount步驟Linux
- Backup And Recovery User's Guide-RMAN備份概念-增量備份-累積增量備份GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-增量備份-差異增量備份GUIIDE
- Backup And Recovery User's Guide-RMAN備份概念-增量備份-多級增量備份GUIIDE
- 講解Oracle資料庫冷備份恢復的具體步驟Oracle資料庫
- linux下oracle熱備份指令碼LinuxOracle指令碼
- 【MySql】innobackupex 增量備份的bugMySql