透過rman備份system系統表空間
rman備份工具是我們常用的備份工具。既然重要,那就是要求我們有明確性針對性的進行備份及其管理。
以下用簡單的例子講述以下rman引數的設定,並嘗試備份system系統表空間,然後檢視備份檔案的路徑。
提醒:做備份前,一定要確保資料庫是歸檔模式,這樣避免後面因為丟失系統資料檔案的部分而導致起不了庫。
---檢視資料庫到歸檔模式:
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 5
Current log sequence 7
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
---切換歸檔模式:
SQL> startup mount;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 541068368 bytes
Database Buffers 289406976 bytes
Redo Buffers 2371584 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 6
Next log sequence to archive 8
Current log sequence 8
SQL>
SQL> alter database open;
Database altered.
---開啟rman備份工具:
[oracle@enmo ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Oct 31 22:36:37 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD (DBID=338469376) #這裡顯示的是目標庫的資訊#
---檢視rman引數:
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD.f'; # default
---配置部分備份引數:
--設定備份檔案的存放路徑:
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
new RMAN configuration parameters are successfully stored
--開啟自動備份控制檔案與引數檔案:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
---再次檢視rman引數:
RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD.f'; # default
#其中有兩項的引數已經修改:
---測試恢復系統關鍵資料檔案:
---透過rman備份系統表空間:
RMAN> backup tablespace system; #只備份系統表空間
Starting backup at 31-OCT-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD/system01.dbf
channel ORA_DISK_1: starting piece 1 at 31-OCT-16
channel ORA_DISK_1: finished piece 1 at 31-OCT-16
piece handle=/u01/app/backup/db_01rjp9rn_1_1.rmn tag=TAG20161031T224511 comment=NONE #系統表空間備份的控制程式碼
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:38
Finished backup at 31-OCT-16
Starting Control File and SPFILE Autobackup at 31-OCT-16 #因為上面已經設定自動備份控制檔案
piece handle=/u01/app/oracle/fast_recovery_area/PROD/autobackup/2016_10_31/o1_mf_s_926722009_d1gpbvth_.bkp comment=NONE
#控制檔案以及引數引數檔案備份的控制程式碼
Finished Control File and SPFILE Autobackup at 31-OCT-16
#備份完成。
---檢視兩個生成的備份檔案:
--system表空間的備份檔案:
[oracle@enmo backup]$ ls
db_01rjp9rn_1_1.rmn
[oracle@enmo backup]$ ll
total 660032
-rw-r----- 1 oracle oinstall 675209216 Oct 31 22:46 db_01rjp9rn_1_1.rmn
[oracle@enmo backup]$
--控制檔案與引數檔案的備份檔案:
[oracle@enmo backup]$ cd /u01/app/oracle/fast_recovery_area/PROD/
[oracle@enmo PROD]$ ls
autobackup control02.ctl onlinelog
[oracle@enmo PROD]$
[oracle@enmo PROD]$ cd autobackup/
[oracle@enmo autobackup]$ ls
2016_10_31
[oracle@enmo autobackup]$ ll
total 4
drwxr-x--- 2 oracle oinstall 4096 Oct 31 22:46 2016_10_31
[oracle@enmo autobackup]$
系統表空間rman備份已完成。
以下用簡單的例子講述以下rman引數的設定,並嘗試備份system系統表空間,然後檢視備份檔案的路徑。
提醒:做備份前,一定要確保資料庫是歸檔模式,這樣避免後面因為丟失系統資料檔案的部分而導致起不了庫。
---檢視資料庫到歸檔模式:
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 5
Current log sequence 7
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
---切換歸檔模式:
SQL> startup mount;
ORACLE instance started.
Total System Global Area 835104768 bytes
Fixed Size 2257840 bytes
Variable Size 541068368 bytes
Database Buffers 289406976 bytes
Redo Buffers 2371584 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 6
Next log sequence to archive 8
Current log sequence 8
SQL>
SQL> alter database open;
Database altered.
---開啟rman備份工具:
[oracle@enmo ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Oct 31 22:36:37 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: PROD (DBID=338469376) #這裡顯示的是目標庫的資訊#
---檢視rman引數:
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD.f'; # default
---配置部分備份引數:
--設定備份檔案的存放路徑:
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
new RMAN configuration parameters are successfully stored
--開啟自動備份控制檔案與引數檔案:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
---再次檢視rman引數:
RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_PROD.f'; # default
#其中有兩項的引數已經修改:
---測試恢復系統關鍵資料檔案:
---透過rman備份系統表空間:
RMAN> backup tablespace system; #只備份系統表空間
Starting backup at 31-OCT-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD/system01.dbf
channel ORA_DISK_1: starting piece 1 at 31-OCT-16
channel ORA_DISK_1: finished piece 1 at 31-OCT-16
piece handle=/u01/app/backup/db_01rjp9rn_1_1.rmn tag=TAG20161031T224511 comment=NONE #系統表空間備份的控制程式碼
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:38
Finished backup at 31-OCT-16
Starting Control File and SPFILE Autobackup at 31-OCT-16 #因為上面已經設定自動備份控制檔案
piece handle=/u01/app/oracle/fast_recovery_area/PROD/autobackup/2016_10_31/o1_mf_s_926722009_d1gpbvth_.bkp comment=NONE
#控制檔案以及引數引數檔案備份的控制程式碼
Finished Control File and SPFILE Autobackup at 31-OCT-16
#備份完成。
---檢視兩個生成的備份檔案:
--system表空間的備份檔案:
[oracle@enmo backup]$ ls
db_01rjp9rn_1_1.rmn
[oracle@enmo backup]$ ll
total 660032
-rw-r----- 1 oracle oinstall 675209216 Oct 31 22:46 db_01rjp9rn_1_1.rmn
[oracle@enmo backup]$
--控制檔案與引數檔案的備份檔案:
[oracle@enmo backup]$ cd /u01/app/oracle/fast_recovery_area/PROD/
[oracle@enmo PROD]$ ls
autobackup control02.ctl onlinelog
[oracle@enmo PROD]$
[oracle@enmo PROD]$ cd autobackup/
[oracle@enmo autobackup]$ ls
2016_10_31
[oracle@enmo autobackup]$ ll
total 4
drwxr-x--- 2 oracle oinstall 4096 Oct 31 22:46 2016_10_31
[oracle@enmo autobackup]$
系統表空間rman備份已完成。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2127382/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 非系統表空間損壞,rman備份恢復
- RMAN說,我能備份(3)--RMAN全庫備份和表空間備份
- 實戰RMAN備份傳輸表空間
- oracle監控表空間,JOB,rman備份Oracle
- 【物理熱備】(下)備份恢復系統表空間 手工備份恢復
- Oracle RMAN備份為什麼會大量使用temp表空間?Oracle
- 如何用rman 不備份只讀表空間的資料
- Rman增量壓縮備份來解決備份空間不足
- Oracle 12C RMAN備份佔用大量臨時表空間Oracle
- RMAN使用備份傳輸表空間的各種自定義操作
- 透過xtts遷移單例項檔案系統表空間到RAC ASM儲存表空間TTS單例ASM
- MySQL 遷移表空間,備份單表MySql
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- 使用Oracle可傳輸表空間的特性複製資料(7)實戰RMAN備份傳輸表空間Oracle
- 遷移SYSTEM表空間為本地管理表空間
- ORACLE的SYSTEM 表空間Oracle
- 透過rman全庫備份遷移資料庫資料庫
- 透過RMAN備份standby database成功恢復還原Database
- Backup And Recovery User's Guide-備份資料庫-使用RMAN備份表空間和資料檔案GUIIDE資料庫
- RMAN遷移表空間
- 一次磁碟空間緊缺的RMAN備份策略
- oracle 系統表空間Oracle
- 如何透過ABB代理程式 備份群暉DSM系統
- 【RMAN】SYSTEM表空間資料檔案丟失恢復模擬
- mysql無備份恢復-獨立表空間MySql
- 基於表空間的熱備份指令碼指令碼
- 表空間級資料庫備份恢復資料庫
- 【管理篇備份恢復】rman恢復測試(一) 表空間資料檔案
- Oracle rman 備份與恢復 臨時表空間的檔案問題解決Oracle
- Oracle 11g RMAN恢復-只讀表空間的恢復(備份是在表空間只讀狀態下做的)Oracle
- oracle系統表空間過大問題處理Oracle
- Oracle RMAN 表空間恢復Oracle
- Oracle 傳輸表空間-RmanOracle
- 系統表空間資料檔案丟失,無備份,無重啟,通過控制程式碼恢復
- DB2 使用表空間備份恢復庫DB2
- 透過RMAN備份搭建單節點ADG(oracle11g)Oracle
- win10備份要多大空間_win10系統備份需要多少記憶體Win10記憶體
- 透過sql語句建立表時指定表空間的語法SQL